View Single Post
Old Apr 30th, 2008, 4:29 PM   #7
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: multiple values for one char

peaceofpi posted a solution using just an if() statement that you could use. However the for statement is a simple concept and VERY helpful.

to begin with we state we want a for loop, for().
Then we set a variable up used for counting, int i = 0; note i is normally used just by default. then we specify the condition that must be met, i < 2; (i must be less than 2) if the condition is met then we continue to loop, and finally i++, is how we modify i. Each time the loop iterates through i++ is called. Explained here.

Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote