A difficult homework with Python and I'm new -
the statement says:
write using instruction, while, function, mentre(name of function), calculate next values:
the sum of first n numbers integers: 1 + 2 + 3 + ... + n
the sum of first n odd numbers: 1+3+5+..+(2n−1)
the sum of numbers come in user until come in 999 (not included in sum 999).
the number of times number can divided 2 (with integer division) before reaching 1.
i seek while if , or reply error :(. await response , give thanks much taking time solve problem!
x = input("number: ") x = int(x) y = 0 z = 0 while y < x + 1: z = z + y y += 1 print (z)
this first one. can build here.
python
No comments:
Post a Comment