Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function listEvenNumbers2() using an infinite while loop. The function t

ID: 675162 • Letter: W

Question

Write a function listEvenNumbers2() using an infinite while loop. The function takes NO input arguments. This will be a variation of problem 1, using a loop-and-a-half pattern. The function returns the list of even numbers entered by the user. An odd number ends the interactive input. Test using the following numbers when prompted: 100, 0, 4, 13 Recap: The loop-and-a-half pattern uses an infinite loop and one-way if statement inside the body of the while loop. The function will prompt for a number inside the while loop, and if statement will test whether the user entered the flag value. in python 3.4

Explanation / Answer

def listEvenNumbers2():
a = []
while():
number = input()
if number % 2 != 0 :
break;
else:
a.append(number)
return a

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote