Python Data Types

Full Cup of Coding
2 min readFeb 1, 2021

--

Today is Day 2 of the Angela Yu course 100 Days of Code — The Complete Python Pro Bootcamp for 2021.

Day 2 — Understanding Data Types

On Day 2 Angela reviews the following:

  1. Primitive Data Types
  2. Type Checking and Type Conversion
  3. Mathematical Operations

At the end of the day you will build a Tip Calculator.

Primitive Data Types

Python has 4 primitive data types

  1. Integers
  2. Floats
  3. Strings
  4. Boolean

Type Checking and Type Conversion

To check the type of a variable use type():

To convert the data to a type do the following (converting a float to an int):

Mathematical Operations

Python follows the Pemdas Rule:

  1. Parentheses
  2. Exponents
  3. Multiplication
  4. Division
  5. Addition
  6. Subtraction

Tip Calculator

The project for today was to create a tip calculator.

The Tip Calculator asks what was the total bill, the percentage you would like to tip and how many people will split the bill. The console will then return how much each person should pay.

You can click here to get all of the solutions on Github.

Have a great day and see you tomorrow!!

Photo by Florian Olivo on Unsplash

--

--

No responses yet