- 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
6 Antworten
+ 2
Ooh, okay!
Thanks a lot @Matt, you helped me today
+ 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
+ 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.
+ 1
Thanks a lot @Matt, but pls what is the duty of the function call 'set'
0
In which language? Generally, declare three variables: f, t, and i. Then assign user inputs to those variables. Then write a for loop.
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.