Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1.  
  2. 11.9 Lab Exam 2 - ASCII Coding
  3. This section has been set as optional by your instructor.
  4.  
  5. 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.
  6.  
  7. With this information in hand, you will make a program that counts the number of capital letters in a string.
  8.  
  9. Your program should take as input a single string, and output the number of capital letters in it.
  10.  
  11. Example 1: if the input is:
  12.  
  13. 'UC Irvine'
  14.  
  15. then the output is:
  16.  
  17. 3
  18.  
  19. Example 2: if the input is:
  20.  
  21. 'ics31'
  22.  
  23. then the output is:
  24.  
  25. 0
  26.  
  27. 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