JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Programming Merit Badge
Programming Merit Badge
Project 1: Python
Project 2: PHP
Project 3: HTML/CSS/Javascript
More
Share
Explore
Project 1: Python
Intro
Python
is a programming language that lets you work more quickly and integrate your systems more effectively.
Welcome to Python.org
The official home of the Python Programming Language
www.python.org
Setup
Click on:
Python Tryit Editor v1.0
Copy/paste this text into the left side of the screen and click “Run”:
# set a temperature value
degrees_fahrenheit_str
=
"72"
# convert text entry to number value that can be used in equations
degrees_fahrenheit_num
=
int
(
degrees_fahrenheit_str
)
# convert temperature from F to Celsius
degrees_celsius_num
=
(
degrees_fahrenheit_num
-
32
)
*
5
/
9
print
(
"Temperature in Fahrenheit is : "
+
str
(
degrees_fahrenheit_num
)
)
print
(
"Temperature in Celsius is : "
+
str
(
degrees_celsius_num
)
)
# check for temperature below freezing..
if
degrees_celsius_num
<
0
:
print
(
"Pack long underwear!"
)
# check for it being a hot day
if
degrees_fahrenheit_num
>
100
:
print
(
"Remember to hydrate!"
)
Your Turn
Make the following changes:
Change the messages to have different advice for extreme temperatures.
Change the initial temperatures (hot or cold) to something different.
Set someone’s name in a variable and add this to the output messages.
More Info
To learn more about Python visit:
BeginnersGuide - Python Wiki
Intro
Setup
Your Turn
More Info
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.