Python Data Types
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:
- Primitive Data Types
- Type Checking and Type Conversion
- Mathematical Operations
At the end of the day you will build a Tip Calculator.
Primitive Data Types
Python has 4 primitive data types
- Integers
- Floats
- Strings
- 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:
- Parentheses
- Exponents
- Multiplication
- Division
- Addition
- 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!!