Question: Use Python Consider an encryption scheme where each letter in the alphabet is represented by a number. In this code, the letter a is represented

Use Python

Use Python Consider an encryption scheme where each letter in the alphabet

Consider an encryption scheme where each letter in the alphabet is represented by a number. In this code, the letter "a" is represented by 0 and each individual alphabetic character is assigned a number in sequence through the letter " z " which is represented by the number 25. In this code, the word "bed" would be represented by the numbers: 1,4,3. Your task is to write a Python program that asks the user for a word and produces the numeric code that represents the word. Example 1: Program to encode a word Enter a word: beaded The code for "beaded" is: 140343 l Example 2: Program to encode a word Enter a word: ABC The code for "ABC" is: 012 Example 3: Program to encode a word Enter a word: abc The code for "abc" is: 012 Note: For loops are generally used to traverse data structures using their iterable property ... there is no need to subscript a sequence. Do not use the range () function to generate an index ... this is NOT the "Python way". Instead, use for c in s : to access each character (c) in the string (s). Hints: 1. The string provided by the user must be converted to all lowercase before attempting to generate the code for each letter. 2. Use a for loop to traverse the string so each character can be isolated in sequence. 3. Use the ord ( ) built-in function to convert each character to the number used by the system to represent it. Then, subtract ord (a) to find the number that represents the character

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!