36.6k views
2 votes
Write a code for function main, that does the following: creates a variable and assign it the value True. uses a while loop which runs as long as the variable of the previous step is True, inside the while loop, get three integer numbers n1, n2 and n3 from the user and

User ReSPAWNed
by
5.8k points

1 Answer

2 votes

Answer:

def main():

is_true = True

while is_true == False:

try:

num1 = int(input("Enter first number: ")

num2 = int(input("Enter second number: ")

num3 = int(input("Enter third number: ")

except ValueError:

print("Input must be an integer number")

is_true = bool(input("do you want to end loop? True/False: "))

main()

Step-by-step explanation:

The python main function above continuously creates three integer numbers in a while loop statement until a false input is received from the user.

User Jiby Jose
by
6.1k points