For some reason I’m having trouble getting my program to run a while loop.
No error messages, just that it stops the program. I tried having it print “hi” as the first instruction, but it didn’t, so I know it’s not even running the loop. Here’s a bit of code (Note: The testing for correct values works fine, but the loop won’t use these correct values!)
print "current letter value:", letter_value
print "letter:", letter
print "number:", number
while letter!="$" and number<=5 and number>=1:
print "hi"
//all the stuff in here
I know it should be an infinite loop, but it won’t run at all!
Input:
letter is ‘A’
letter_value is 1
numberis 1
My loop ought to test to make sure that letter isn’t $ and that the number is <=5 and number >=1
you didn’t give the print out for letter and number, it could be that the “number” is actually a string?