#!/usr/bin/env python #commented out lines or portion of lines begin with a pound sign print("Enter a temperature in Celsius: ") #print to the screen for the user to enter a temperature myInput = input() #wait for the user to enter something, assign it to the variable my Input myInput = int(myInput) #convert the users input which is a string type variable into an integer Celsius = float(myInput) #convert the previous integer into a float type variable (decimal) named Celsius Fahrenheit = 9.0 * Celsius / 5.0 + 32 #calculate the temperature in Fahrenheit print "Temperature:", Celsius, "Celsius = ", Fahrenheit, " F" #print Temperature in Celsius and Fahrenheit
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question