Computer Science, asked by williambarnes, 1 year ago

Must be python edhesive.
Write a program that uses a loop to print the uppercase alphabet with the correct ASCII number next to each letter. (e.g. one line might be A 65).

Answers

Answered by prasadkolhatkar17
3

Answer:

letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ascii_code = {}

for ch in sorted(letters):

   ascii_code[ch] = ord(ch)

print(ascii_code)

Explanation:

ord() is inbuilt function gives ascii code for character

and sorted() sorts dic obj to display letters alphabetically.

Similar questions