Why is the 'else' statement getting printed even if a correct choice is picked?
print"Do you need Ice-Cream?"
print"Pick a flavor"
ch=raw_input() # ch is a string
print"You are done picking up a flavor, pay now"
print"Good, you can go!"
You have two conditions not one.
The first condition checks
'y' the user gets to input an integer 1-8 and the appropriate string will be printed to the console. Processing then moves to the second condition (#2).
ans is not
'y' then the user dose not give any input and processing moves to the second condition (#2).
The second condition checks
'n' then "Good, you can go!" is printed to the console and processing continues skipping the
ans is not
'n' (which would be the case that user entered
'y') then the
else block is executed printing "wrong choice" to the console.
What is happening is you have your logic setup that any input other than
'n' will print "wrong choice" eventually. You want a single decision from the users initial input. Currently your logic makes two.
if elif else construct.