Question
Python There are a total of 10 items missing that need to be identified for this python code to work. 7 are highlighted (numbered in
Python
There are a total of 10 items missing that need to be identified for this python code to work. 7 are highlighted (numbered in paranthess) 3 are not! Can you find them?
#! /usr/bin/python
#-*-coding: utf-8 -*-
# converts temperature to Fahrenheit or Celsius
def main():
# (1)
def print_options():
print("Options:")
print" 'p' print options"
print(" 'c' convert from Celsius")
print(" 'f' convert from Fahrenheit")
print(" 'q' quit the program")
# (2)
def toFahrenheit((3)):
Temp = 9.0 / 5.0 * c_temp + 32
return Temp
# (4)
def toCelsius(f_temp):
temp2 = (f_temp - 32.0) * 5.0 / 9.0
return temp_ (5)
# (6)
choice = "p"
while choice != "q":
if choice == "c":
c_temp = int(input("Celsius temperature: "))
print("Fahrenheit:", toF (c_temp))
choice = input("option: ")
elif choice == "(7)_":
f_temp = float(input("Fahrenheit temperature: "))
print("Celsius:", toC (f_temp))
choice = input("option: ")
elif choice == "p":
print_options()
choice = input("option: ")
main()
OUTPUT:
Options:
'p' print options
'c' convert from celsius
'f' convert from fahrenheit
'q' quit the program
option: c
Celsius temperature: 30
Fahrenheit: 86.0
option: f
Fahrenheit temperature: 60
Celsius: 15.5555555556
option: q
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started