generate functionWed, 15 Mar 2023

You receive a word as input and your task in the while loop is to bypass all its letters and print them in the phrase format: "Current letter: <letter>". As soon as you meet the lowercase English letters "e" or "a" you need to print the phrase "Aha! Found”, stop typing letters and forcibly exit the loop. If the word does not contain the letters "e" or "a", you must print the phrase "Printed out all the letters"

word = input() i = 0 while i < len(word): if word[i] in 'ae': print("Aha!") break print("Current letter: ", word[i]) i += 1 else: print("Printed out all the letters")

Questions about programming?Chat with your personal AI assistant