Day 1 Session
Day 1 Session
z
Python Basics
z
What is and Why Python?
It is used for:
• web development (server-side)
• software development
• mathematics
• system scripting
- You can get the data type of a variable with the type() function.
z
Python Variables
A variable can have a short name (like x and y) or a more descriptive
name (age, carname, total_volume). Rules for Python variables:
# Integer
age = 35
# Floats
speed1 = 4.5
speed2 = 4.0
speed3 = 4.
# Boolean
am_i_short = True
am_i_tall = False
You can get the data type of any object by using the type() function
z
Assign multiple values
Python allows you to assign values to multiple variables in one line:
And you can assign the same value to multiple variables in one line:
x = y = z = "Orange"
print(x)
print(y)
print(z)
z
Arithmetic Operators
z
Assignment Operators
z
Comparison Operators
z
Logical Operators
Python allows for user input. That means we are able to ask the user for input.
#The input() always return a STRING Value even when the
user inputs numbers