- #1
TromboneNerd
- 18
- 1
Im having trouble with a basic python assignment in one of my classes. Its supposed to ask the user for temperatures in Celsius and convert them to Fahrenheit, which it does fine. The problem is that its also supposed stop asking the user if he gives it 0, which means the end of the list of numbers. My program converts fine, but upon entering 0 it just gives me 32, which means something is wrong with my if statement and its just converting 0 like a normal number. Any help? here is my code.
count = 1
converted = False
while (converted == False):
count = 1
converted = False
while (converted == False):
Celsius = raw_input("Temperature number " + str(count) + " to be converted?: ")
print (Celsius)
count = count + 1
if (Celsius.rstrip() == 0):
converted = True
Celsius = int(Celsius.rstrip()) * 1.8 + 32converted = True
print (Celsius)
count = count + 1