Here is a nested loop example that graphically depicts an integer's magnitude by using asterisks, creating what is commonly called a histogram: Run the program below and observe the output. Modify the program to print one asterisk per 5 units. So if the user enters 40, print 8 asterisks.num = 0while num >= 0: num = int(input('Enter an integer (negative to quit):\n')) if num >= 0: print('Depicted graphically:') for i in range(num): print('*', end=' ') print('\n')print('Goodbye.')

Respuesta :

Answer:

Please find the code in the attached file.

Output:

Please find the attached file.

Explanation:

In this code a "num" variable is declared that use while loop that check num value greater than equal to 0.

Inside the loop we input the "num" value from the user-end and use if the value is positive it will define a for loop that calculates the quotient value as integer part, and use the asterisks to print the value.

If input value is negative it print a message that is "Goodbye".

Please find the code link:   https://onlinegdb.com/7MN5dYPch2

Ver imagen codiepienagoya
Ver imagen codiepienagoya
ACCESS MORE