3. a. Write a for loop that prints the ASCII code of each character in a string named S. Usethe built-in function ord(character) to convert each character to an ASCII integer. b. Next, change your loop to compute the sum of the ASCII codes of all characters in a string 4. Use a for loop and the list append method to generate the powers of 2 to produce the following result [1, 2, 4, 8, 16, 32, 64, 128] 5. Write a for loop that prints a dictionary's items in sorted (ascending) order.
3. a. Write a for loop that prints the ASCII code of each character in a string named S. Usethe built-in function ord(ch
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
3. a. Write a for loop that prints the ASCII code of each character in a string named S. Usethe built-in function ord(ch
3. a. Write a for loop that prints the ASCII code of each character in a string named S. Usethe built-in function ord(character) to convert each character to an ASCII integer. b. Next, change your loop to compute the sum of the ASCII codes of all characters in a string 4. Use a for loop and the list append method to generate the powers of 2 to produce the following result [1, 2, 4, 8, 16, 32, 64, 128] 5. Write a for loop that prints a dictionary's items in sorted (ascending) order.