Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON PROGRAM: using while loop Write a program that asks the user for a number n and prints the sum of the numbers 1 to

PYTHON PROGRAM: using while loop Write a program that asks the user for a number n and prints the sum of the numbers 1 to n. The program keeps asking for a number until the user enters 0.

ex:

enter an integer number (0 to end): 0 #stops here immediately
enter an integer number (0 to end): 1 1 = 1 #keeps asking for numer until user enters 0.
enter an integer number (0 to end): 5 1+2+3+4+5 = 15
enter an integer number (0 to end): 20 1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20 = 210
enter an integer number (0 to end): 0

# while n!=0 perhaps?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago