avatarJake Cutter
# Summary

The article "Coding w/ Python part 2" builds upon foundational Python concepts by exploring user input, creating a basic calculator, understanding the difference between float and integer data types, and engaging in a Mad Libs coding exercise.

# Abstract

The second installment in a series on Python programming, this article delves into practical applications of Python basics. It begins by reiterating the essentials covered in the previous article, such as variables, strings, numbers, and phrases. The focus then shifts to user interaction through inputs, demonstrating how to capture and utilize user data within a Python script. The article progresses to construct a simple calculator that can handle both whole numbers and decimals, highlighting the distinction between float and integer variables. Finally, it introduces a creative coding challenge, Mad Libs, where users input various words to generate a humorous story, showcasing the versatility of Python for text-based manipulation and user engagement.

# Opinions

- The author emphasizes the importance of user inputs for creating interactive Python applications.
- By building a basic calculator, the article suggests that readers can quickly apply their Python knowledge to solve practical problems.
- The discussion on float versus integer data types is included to ensure readers understand how Python handles different numerical values, which is crucial for accurate calculations.
- The Mad Libs exercise is presented as both a fun and educational activity, reinforcing the idea that programming can be an engaging and creative process.
- The article aligns with a YouTube video series, indicating a multimedia approach to learning Python and possibly suggesting that readers can follow along with the video content for a more immersive learning experience.

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.

Photo by Clément H on Unsplash

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.

Python
Coding
Programming
Software Development
Computers
Recommended from ReadMedium