Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 11.9 Lab Exam 2 - ASCII Coding
- This section has been set as optional by your instructor.
- ASCII, abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes are used to represent text in computers, where each character gets assigned a value. The alphabet starts at 65 (capital A), B value is 66, …, Z value is 90. Lowercase letters start at 97 (lowercase a), b is 98, …, z is 122.
- With this information in hand, you will make a program that counts the number of capital letters in a string.
- Your program should take as input a single string, and output the number of capital letters in it.
- Example 1: if the input is:
- 'UC Irvine'
- then the output is:
- 3
- Example 2: if the input is:
- 'ics31'
- then the output is:
- 0
- HINT: To get the ASCII value of a single character, you can use the ord function. For instance, if you use ord('A') it will return 65.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement