Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 5 - Loops - Programming Exercises - Page 160: 5.17

Answer

Finding by ASCII codes

Work Step by Step

$Statement:$ (Display the ASCII character table) Write a program that displays the characters in the ASCII character table from ! to ~. Display ten characters per line. The characters are separated by exactly one space. $Code:$ numberOfCharPerLine=10 count=0 for a in range(33,126): $ $ $ $ $ $ $ $ count=count+1 $ $ $ $ $ $ $ $ if count %10==0: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(chr(a)) $ $ $ $ $ $ $ $ else: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ print(chr(a)," ") $Output:$ ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | }
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.