[Tutor] raw_input into range() function
kent37 at tds.net
Wed Apr 18 13:00:57 CEST 2007
> The code I have come up with so far is further below; basically my
> problem is that I don't know how to feed the range() function with the
> user-input numbers it expects.
> # Telling the player what to do & assigning that info to variables.
> start_num = int(raw_input("Please give me a starting number. "))
> end_num = int(raw_input("Please give me an ending number. "))
> interval = int(raw_input("By which amount am I to count? "))
> start_num == 0
> end_num == 1
> interval == 2
> print "Counting:"
> for i in range(0, 1, 2):
> print i
Just use the variable names instead of the numbers:
for i in range(start_num, end_num, interval):
More information about the Tutor