[Tutor] raw_input into range() function

Guba listsdl04 at yahoo.de
Wed Apr 18 12:35:53 CEST 2007


I am trying to do the exercises in Michael Dawson's "Absolute Beginner"
book. In chapter four ("for Loops, Strings, and Tuples") one of the
challenges is: "Write a program that counts for the user. Let the user
enter the starting number, the ending number, and the amount by which to

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.

Your help is highly appreciated!


# Counting Program
# 2007-04-18

# Welcoming the player
print "Hello, let me do some counting for you!"

# 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

raw_input("\n\nHit Enter to exit.")

Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

More information about the Tutor mailing list