- 1

Calculate in Python...

If I want to get a result that (in Python): example1: input: 2 8 output: 2 4 6 8 example2: input: 5 20 output: 5 10 15 20 (output is multiple of input1 to input2,and the last one can't exceed input2) This is a part of my homework :( Please help me! thanks very much!

2nd Apr 2018, 10:43 AM
賴幼華
賴幼華 - avatar
3 Respostas
+ 5
input1 = int(input('first number?\n')) input2 = int(input('second number?\n')) for i in range(input1,input2+1,input1): print(i) # range() function can take up to three arguments: # range(start_value,excluded_end_value,step_value)
2nd Apr 2018, 11:52 AM
visph
visph - avatar
- 1
Thanks a lot, I have finished my homework and got the point!
2nd Apr 2018, 5:36 PM
賴幼華
賴幼華 - avatar