Question-101: If you run below code snippet and for each invocation, you are inserting ‘Hadoop’ as input, what would happen
counter=0
while True:
word = input("enter any English word you can think of ")
if word.startswith("h"):
counter=counter+1
print("!!!!!!!This is your " , counter, " chance!!!!!!!!!!")
if counter==3:
print("!!!!!!!This WAS YOUR LAST CHANCE, YOU NEED TO EXIT!!!!!!!!!!")
break
continue;
print("You are still in...")
- Program would exit after 3 times you enter word Hadoop.
- Get all Questions and Answer from here
- You need to have paid subscription to access all questions
- Thanks for considering Python Certification Material
Answer: D
Exp: Program would increment counter by 1 only if you enter a word starting with ‘h’ small case.
You can access to full explanation to question and answer from this page.