Coding w/ Python part 2
In the last article, we covered some of the basic tools of python and how to install it. We covered variables, strings, numbers, and phrases. On this page, we are covering input, building a basic calculator, float vs Integer, and a Mad Libs exercise.
Inputs:
Inputs are what you use to interface with the user. You can set up a text for them to answer.
input(“Enter your Name: “)
input(“Enter your age: “)
print( “Hello “ + name + “ you are “ + age”)
Basic Calculator:
x = input(“Enter a number: “)
y = input(“Enter another number: “)
result = float(x) + float(y)
The float command is similar to int(integer) but float takes into account decimals. Since this is a calculator its likely someone won’t just put in the whole number.
Mad Libs Challenge:
A mad lib is a story that you can put in nouns, verbs, and adjectives to make a funny story. You can do this in a coding language pretty easily.
color = input(“Enter a color “)
plural_noun = input(“ Enter a plural noun”)
celebrity = input(“Enter a celebrity”)
print(“Roses are “ + color)
print( plural_noun + “ are blue”)
print(“I love “ + celebrity)
You can create your own variables and create your own story. All the pieces are there.
References:
These coding pages are following along with the youtube video from the last article. From here on they will be tracking the progress through the video.




