# Lesson 1: Introduction and Variables
This lesson learns are based on Python book page 24-27
# Introduction
# What is Python?
Why should we have to learn it?
How will Python be important in the future?
# Tools
https://trinket.io/ (opens new window)
# Lesson Learns
# Assign a value (Variable)
age = 12 # we assigned the value to "age" variable
1
output
age = 12
print(age)
1
2
2
output
12
1
# Naming Dos and Don'ts
- Start with a letter
- Symbols and spaces are not allowed (-, /, #, @)
- The underscore can be used (For example, first_name, last_name)
# Integers and Floats
# Assignment
interger1 = 5
float1 = 0.5
1
2
2
# Calculation
x = 50
y = x * 5
print(y)
1
2
3
2
3
output
250
1
Try to change a value!
x = 100
x = x + 5
print(x)
1
2
3
2
3
output
105
1
# Strings
# Assignment
my_name = "Ally Alien"
print(my_name)
1
2
2
output
Ally Alien
1
# Combination
first_name = "Ally"
last_name = "Alien"
full_name = first_name + last_name
print(full_name)
1
2
3
4
2
3
4
output
AllyAlien
1
first_name = "Ally"
last_name = "Alien"
print(first_name + last_name)
1
2
3
2
3
output
AllyAlien
1
# length of a string
my_name = "Ally Alien"
print(len(my_name))
1
2
2
output
10
1
# Comment
# print("Hello 1")
# print("Hello 2")
print("Hello 3") # print("Hello 6")
# print("Hello 4")
1
2
3
4
2
3
4
output
Hello 3
1
# Exercises
PythonExercise.pdf Page 14-17