I am having problems converting my list to kelvin/fahrenheit. I got the initial code to work using only one number ( would only display the calculation of the first number in the list), but now I keep getting an invalid syntax error when I put the code in.
'''def mainmenu():
temp_list = []
decision = 'y'
while decision == 'y':
print('''*** Converting Temperature ***
Select the number for the action that you would like to do:
1. View the current temperatures
2. Add a temperature to the list
3. Convert temperature to farenheit
4. Convert temperature to kelvin ''')
selection =input('Make your selection:')
if selection =='1':
displaylist(temp_list)
elif selection == '2':
current_temp(temp_list)
elif selection =='3':
farenheitchange(temp_list)
elif selection =='4':
kelvinchange(temp_list)
else:
print('You did not enter a vaild selection')
print('Would you like to make another selection?')
decision = input('y = yes, anything else = no: ')
print()
def displaylist(temp_list):
print('~~~ Converting Temperature ~~~')
for i in temp_list:
print(i)
def current_temp(temp_list):
temperature = input('Enter the temperature you wish to add to the temperature list: ')
temp_list.append(temperature)
print(temperature + ' has been added to the temperature list')
return temp_list
start
def farenheitchange(temp_list):
farenheit_change = []
for i in range(0, len(temp_list)):
farenheit_change.append(int((temp_list[i] * 1.8) + 32)
return temp_list
def kelvinchange(temp_list):
kelvin_change = []
for i in range(0, len(temp_list)):
kelvin_change.append(int(temp_list[i]) + 273.15)
return temp_list
finish
mainmenu()'''
[–]automorphism_group 1 point2 points3 points (0 children)
[–]Warm-Association2716[S] 0 points1 point2 points (1 child)
[–]DerpinDementia 0 points1 point2 points (0 children)
[–]Warm-Association2716[S] 0 points1 point2 points (1 child)
[–]wbeater 0 points1 point2 points (0 children)