Computer Science, asked by pankajkumar7812, 11 months ago

Write a python program for an infinite while loop to get input from the user and print it and breaks upon 0 value pressed by the user.


# The required output is:
please input your choices
1
please input your choices
2
please input your choices
3
please input your choices
100
please input your choices
55
please input your choices
0
0 is pressed the program is now terminating​

Answers

Answered by Anonymous
9

while True:

val = Input("please input your choices")

if val == "0":

break

else:

val = Input("please input your choices")

Answered by Anonymous
1

A python program of the given question is as follows:

i = int(input("please input your choices"))// initialised variable " i "

while i > 0:                                                         // created an infinte loop

 i= int(input("please input your choices"))

if i == 0:

 print("0 is pressed the program is now terminating​")// termination of program

  • This program takes input from the user and prints the output for infinite times and then terminates when 0 is pressed.
Similar questions