For the given problem, prompts the user to enter a number and then while loop is used to check whether a number is positive or not. Under the while loop body statement is printed and then input is stored in the user value. Then print the statement as ‘Done’.
Further Explanation:
Code: Following is the python code to that executes the loop body as long as the user enters a non-negative number.
#Prompt and read the input from the user
user_num = int(input('Enter a number:'))
#Loop is used to repeat the values of number
while (user_num>=0):
# If user enters a positive number then display the body statement.
print('Body')
user_num = int(input())
# Display the output.
print('Done.')
Learn more:
1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011
2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832
3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623
Answer details:
Grade: College Engineering
Subject: Computer Science and Engineering
Chapter: Python Programming
Keyword:
python, input, output, programming, statements, if-else, loops, print, body, done, positive, negative, number, display, non negative, prompt, problem, test code, usernum, test, activity