I want to use a while loop to count up numbers.
The output would be something like this:
Start: 1
End: 10
Count by: 3
1 4 7 10
Here's my code right now:
start = int(raw_input("Start at: "))
end = int(raw_input("End at: "))
count = int(raw_input("Count by: "))
while :
print i,
I'm not sure what to put in for the while loop.
------------------------------------------------------------------
For another test, I want to try to reverse the strings printed.
The output would be this:
Input a string: Hello!
Reverse: !olleH
I have 2 different codes for this.
First code:
s = raw_input("Enter a string: ")
rev = ""
for i in range(len(s)):
#i only want to modify the "s[ ]" part, don't want to change any other part of the code
rev = rev + s[i-1]
print "The reverse is: " + rev
Second code:
s = raw_input("Enter a string: ")
rev = ""
#for this code, I only want to modify the "range( )" part of the code, i don't want to change any other part of the code
for i in range():
rev = rev + s[i]
print "The reverse is: " + rev
any help is appreciated, if you can, please don't reply with any really complicated codes.
explainations would be helpful too so i can learn more.
thanks!