- Write A Function Count Upper S The Function Gets As A Parameter A String The Function Returns As A Result The Number 1 (81.06 KiB) Viewed 21 times
Write a function: count_upper(s) The function gets as a parameter a string. The function returns as a result the number
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a function: count_upper(s) The function gets as a parameter a string. The function returns as a result the number
question should be in the file. • The last empty string shouldn't be checked. It only marks end of input.
Write a function: count_upper(s) The function gets as a parameter a string. The function returns as a result the number of uppercase letters in the string. Part B: Write a function: count_lower(s) The function gets as a parameter a string. The function returns as a result the number of lowercase letters in the string. Part C: Write a function: is_balanced (s) The function gets a string s as parameter. The function returns True if the number of uppercase letters equals to number of lowercase letters. Such string will be called balanced. The function ignores everything except English characters. Use Top-Down design as we've seen in class. Part D: Write a program as follows: The program gets as input a sequence of strings, one after the other. Each string will be accepted by pressing <enter> after typing it. In the end of input, an empty string will be given. The program checks if there are balanced strings in the input. If yes, the program prints: "xxx is balanced." where xxx is the string. If no, the program prints: "xxx is unbalanced." where xxx is the string. Each printed message is in a separate line. See attached examples (q3inx/q3outx). Note: • All parts of the