- 1

Write a program to have the user input three (3) numbers: (f)rom, (t)o, and (i)ncrement. Count from f to t in increments of i

28th Jun 2017, 1:01 AM
Daberechukwu M. Nwafor
Daberechukwu M. Nwafor - avatar
6 odpowiedzi
+ 2
Ooh, okay! Thanks a lot @Matt, you helped me today
30th Jun 2017, 10:55 AM
Daberechukwu M. Nwafor
Daberechukwu M. Nwafor - avatar
+ 1
In python, should it be this way f = input( 'Enter value:') t = input(' Enter value:') i = input('Enter increment :') for count in range (f, t, i) : print ( count ) Pls do correct me as to where it is needed, I am still a novice Thanks
28th Jun 2017, 6:22 AM
Daberechukwu M. Nwafor
Daberechukwu M. Nwafor - avatar
+ 1
def dabby_prob (f:int, t:int, i:int) ->set """Input values starting, ending, increment """ for x in range (f, t, i): print(x) This will work in your own idle. Now this can be made much better but that my friend is up to you. What I did was turn it into a function so it can be called anytime in your program.
30th Jun 2017, 9:52 AM
Matt
Matt - avatar
+ 1
Thanks a lot @Matt, but pls what is the duty of the function call 'set'
30th Jun 2017, 10:38 AM
Daberechukwu M. Nwafor
Daberechukwu M. Nwafor - avatar
0
In which language? Generally, declare three variables: f, t, and i. Then assign user inputs to those variables. Then write a for loop.
28th Jun 2017, 2:02 AM
Joseph P French
Joseph P French - avatar
0
->set is just annotations along with the """ This is so when someone else wants to use this function they can type: help (dabby_prob) to see what this function does. to use this, program this into your idle then hit f5 to bring up the restarted shell. Then type: dabby_prob (2, 10, 2) or use any start, end and increment values.
30th Jun 2017, 10:45 AM
Matt
Matt - avatar