Sum of few numbers by using for and range

Chris Angelico rosuav at gmail.com
Sun Feb 17 11:30:01 EST 2019


On Mon, Feb 18, 2019 at 3:26 AM ^Bart <gabriele1NOSPAM at hotmail.com> wrote:
>
> Hello!
>
> I need to do what I wrote in the subject but... I don't understand how
> could I fix my code... :\
>
> number1 = int( input("Insert the first number:"))
> number2 = int( input("Insert the second number:"))
> number3 = int( input("Insert the third number:"))
>
> print("Total amount is:")
>
> for x in range(number1,number3):
>      y = x+x
>      print(y)
>

When you want homework help, it is extremely useful to post the entire
challenge you were given, not just a one-line summary. What are you
actually expected to do? What are the restrictions?

I suspect, from your last few posts, that you should not be taking
particular challenges, but should instead go back to the basics of how
Python works. Reread the earliest material in your course and make
sure you truly understand what is going on. Try to piece together what
a section of code is doing, step by step. Write down on a piece of
paper what the variables are at each point in the program. Then, AFTER
doing the work manually, run the code and see if you were right.

ChrisA



More information about the Python-list mailing list