Question: Consider the following Python code snippet: school = 'Notre Dame University of Louaizen' numVowels = 0 numCons = 0 for char in school: if char
Consider the following Python code snippet: school = 'Notre Dame University of Louaizen' numVowels = 0 numCons = 0 for char in school: if char == 'a' or char == 'e' or char == 'i' or char == 'o' or char == 'u' or char == 'A' or char == 'E' or char == 'U' or char == 'I'I or char - O': numVowels += 1 elif char == 'o' or char == 'N': print (char) else: numCons -- 1 print('numVowels is: ' + str (numVowels)) print('numCons is: ' + str (numCons)) Answer the following questions: 1) How many times does each of the characters "o" and "N" print out? 2) What will the value of the variable numVowels be? 3) What will be the value of the variable numcons be? 4) Are there any logical errors in this code? If yes, identify and correct them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
