Professional Documents
Culture Documents
1 Python Basics
1 Python Basics
Basics
Why python ? – handles large datasets, mathematical functions, creates powerful visualization
Expressions – (2-1)/3
Statement – print(2-1)
Function – print()
Operators –
** expo
PEMDAS
Parentheses,
Exponent
Mul or Div
Add or sub
Assigning Variables –
Reserved words –
atlanta=123
print(atlanta)
Data types-
Integer 5
Float 5.67
List
Cities = []
Cities.append(“Anaheim”)
Cities.append(371)
Print(cities)
OR
Comments - # Comment
Index – 0 to n-1
Values – n
Zero indexing
Return_third = cities[2]
Print(return_third)
Slicing Lists
For slicing values between the starting index and ending index
two_four = cities[2:4] # returns only second and third indexed value or 3rd and 4th element of the list