Question: Python problems aWrite a function printVowelInformation(inputString) that calculates and prints the number of occurrences of each vowel (consider the vowels to be only: a, e,
Python problems
aWrite a function printVowelInformation(inputString) that calculates and prints the number of occurrences of each vowel (consider the vowels to be only: a, e, i, o, and u ) in the string and also the total number of non-vowels. You may assume the input contains only lower-case letters. NOTE: You must use a loop to count the vowel occurrences. You many not use the Python's built-in count function.
>>> printVowelInformation("dog") might yield:
'dog' has 0 'a's, 0 'e's, 0 'i's, 1 'o's', 0 'u's, and 2 non-vowels.
bWrite function, maxChar(inputString) that takes as input a string of one or more lower-case letters and prints information about the lexicographically largest character in the string along with the index of the first occurrence of that character. Important: your function must contain a loop and you must determine the index of the character within the loop (i.e. you may not use Python's index or similar built-in function). For example,
>>> maxChar("abrcdefxyqurslajelskd") should yield:
The max char is 'y' and occurs at position 8.
cWrite a function, binaryRepString(number), that returns a string containing only '1's and '0's corresponding to the binary representation of the input number. Assume the input number is an integer equal to or greater than zero. For example, binaryRepString(0) should return '0', binaryRepString(2) should return '10', and binaryRepString(71) should return '1000111'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
