SequencevsIterationwithoutSolution

Run Settings
LanguagePython
Language Version
Run Command
print("Sequence vs. Iteration") print() # Sequence print("This is sequence.") # A # Python built-in function ord() letter = "A" value = ord(letter) # ord("A") takes a character/letter and returns an integer value. print(f"The character {letter} is {value} in ASCII.") # Output: 65 # B # Python built-in function ord() letter = "B" value = ord(letter) # ord("B") takes a character/letter and returns an integer value. print(f"The character {letter} is {value} in ASCII.") # Output: 66 # C # Python built-in function ord() letter = "C" value = ord(letter) # ord("C") takes a character/letter and returns an integer value. print(f"The character {letter} is {value} in ASCII.") # Output: 67 # 120 # Python built-in function chr() value = 120 letter = chr(value) # chr(120) takes an integer value and returns a letter/character. print(f"The value {value} is {letter} in ASCII.") # Output: x # 121 # Python built-in function chr() value = 121 letter = chr(value) # chr(121) takes an integer value and returns a letter/character. print(f"The value {value} is {letter} in ASCII.") # Output: y # 122 # Python built-in function chr() value = 122 letter = chr(value) # chr(122) takes an integer value and returns a letter/character. print(f"The value {value} is {letter} in ASCII.") # Output: z print() print() # Iteration print("This is iteration.") plaintext = "this is a secret" ciphertext = "" # This for loop converts plaintext into ciphertext. for letter in plaintext: temp = 0 # integer variable # missing code block # # missing block of code ciphertext += str(temp) + " " print("PLAINTEXT: " + plaintext) print("CIPHERTEXT: " + ciphertext) # THE END
Editor Settings
Theme
Key bindings
Full width
Lines