Below I'll list out all of the notes, exercises, and projects so they are easier to access for you throughout this course.
You'll be able to access all of the future projects and exercises from this main dashboard
Before you start this project make sure you've mastered the following pure python concepts...π
It's okay if you don't know the web development concepts... We'll learn those together.
Web Development | Pure Python |
---|---|
Routing | Dictionaries |
GET Requests | Named Arguments |
Database | Incrementing / Decrementing |
Functions |
π¨βπ» Project | π Live Demo | π Solution |
---|
Before you start this project make sure you've mastered the following pure python concepts...π
It's okay if you don't know the web development concepts... We'll learn those together.
Web Development | Pure Python |
---|---|
Routing | String Formatting |
GET Requests | Functions |
POST Requests | Random / Import Modules |
Databases |
π¨βπ» Project | π Live Demo | π Solution |
---|
Before you start this project make sure you've mastered the following pure python concepts...π
It's okay if you don't know the web development concepts... We'll learn those together.
Web Development | Pure Python |
---|---|
GET Requests | Dictionaries |
Macros | Named Arguments |
Markup Filters | Functions |
Lists of Dictionaries |
π¨βπ» Project | π Live Demo | π Solution |
---|
Before you start this project make sure you've mastered the following pure python concepts...π
It's okay if you don't know the web development concepts... We'll learn those together.
Web Development | Pure Python |
---|---|
Routing | Functions |
GET Requests | Conditionals (if elif) |
POST Requests | Random |
String Formatting | |
Databases | |
Routing |
π¨βπ» Project | π Live Demo | π Solution |
---|
Before you start this project make sure you've mastered the following pure python concepts...π
It's okay if you don't know the web development concepts... We'll learn those together.
Web Development | Pure Python |
---|---|
Routing | Dictionaries |
GET Requests | Named Arguments |
Database | Incrementing / Decrementing |
Functions |
π¨βπ» Project | π Live Demo | π Solution |
---|
Basic method to assign values to a variable ππ»
name = 'Rafeh Qazi'
age = 25
>>> print(name)
>>> print(age)
Rafeh Qazi
25
More ways to assign values to variables ππ»
width, height = 400, 500
>>> print(width)
>>> print (height)
400
500
You have to assign the value of your input directly to a variable.
your_name = input('Please enter your name:')
print('Hi ' + your_name)
>>> Please enter your name:
>>> Rafeh
Hi Rafeh
Strings can be etither words or sentences (and even numbers somtimes)
name = 'Rafeh'
country = 'USA'
city = 'Los Angeles'
There are two number data types ππ»
𧱠Integers
age = 28
weight = 146
ποΈ Float
temperature = 65.3
longBeachToLAX = 20.7
Indicates whether somethin is true or false.
isMyNameQazi = true
doIHaveAPlaystation = false
Similar to array in JavaScript, but Python uses the word 'Lists'.
fruits = ['π', 'π', 'π', 'π', 'π']
Math Operators are used to do mathematical calculations within your application.
Adding two or more numbers.
print(5 + 5)
>>> 10
num1 = 6
num2 = 7
print(num1 + num2)
>>> 13
Subtracting two or more numbers.
print(6 - 2)
>>> 4
num1 = 8
num2 = 3
print(num1 - num2)
>>> 5
Multiplying two or more numbers.
print(6 * 2)
>>> 12
num1 = 8
num2 = 3
print(num1 * num2)
>>> 24
Dividing two or more numbers.
print(6 / 2)
>>> 3
num1 = 24
num2 = 6
print(num1 / num2)
>>> 4
Rounds the result down to the nearest whole number
print(5 // 2)
>>> 3
Multiplies the first number with an exponent equal to the second number.
print(6 ** 2)
# similar to 6*6
>>> 36
num1 = 2
num2 = 6
print(num1 ** num2)
# similar to 2*2*2*2*2*2
>>> 64
Gives the remainder from the division.
print(5/2)
>>> 1
print(14/3)
>>> 2
Comparison Operators are used to compare variables, etc. within your application.
Compare if two values are equal and return a boolean.
qaziAge = 28
davidAge = 23
print(qaziAge == davidAge)
>>> False
internetSpeedInLA = 100
internetSpeedinDubai = 100
print(internetSpeedInLA == internetSpeedinDubai)
>>> True
qaziAge = 28
davidAge = 23
print(davidAge < qaziAge)
>>> True
longBeachWeather = 66
sanFranciscoWeather = 57
print(longBeachWeather < sanFranciscoWeather)
>>> False
qaziAge = 28
davidAge = 23
print(davidAge > qaziAge)
>>> False
longBeachWeather = 66
sanFranciscoWeather = 57
print(longBeachWeather > sanFranciscoWeather)
>>> True
print(5 <= 5)
>>> True
print(4 <= 5)
>>> True
print(6 <= 5)
>>> False
print(6 >= 6)
>>> True
print(7 >= 6)
>>> True
print(5 >= 6)
>>> False
def introducer():
person = {
'name': 'Qazi',
'shirt': 'Black',
'laptop': 'Apple',
'phone_number': '224-123-3456',
'assets': 100,
'debt': 50,
'favoriteFruits': ['π', 'π', 'π'],
'netWorth': lambda: person['assets'] - person['debt']
}
person['shirt'] = 'Orange'
person['assets'] = 1000
print(f"π Hi my name is {person['name']},
\nπ I am wearing a {person['shirt']} shirt, \nπ¨βπ» and the laptop I use to code is an {person['laptop']}, \nπ°and my net worth is ${person['netWorth']()} USD, \nπ₯My favorite fruits are {person['favoriteFruits']}")
>>> introducer()
`π Hi my name is Qazi,
π I am wearing a Orange shirt,
π¨βπ» and the laptop I use to code is an Apple,
π°and my net worth is $950 USD,
π₯My favorite fruits are ['π', 'π', 'π']`
def weather_to_emoji(weather: str) -> None:
if weather == 'rain':
print('β')
elif weather == 'cloudy':
print('π©οΈ')
elif weather == 'thunderstorm':
print('βοΈ')
else:
print('π')
>>> weather_to_emoji('rain')
'β'
def double(numbers: list) -> list:
result = []
for number in numbers:
result.append(number * 2)
return result
>>> double([1, 2, 3, 4, 5])
[2, 4, 6, 8, 10]
def find_max(numbers):
current_max = numbers[0]
for number in numbers:
if number > current_max:
current_max = number
return current_max
>>> find_max([1, 2, 3, 10, 17, 4, 5, 6])
17
def word_frequency(phrase):
result = {}
words = phrase.split()
for word in words:
if word not in result:
result[word] = 1
else:
result[word] += 1
return result
>>> word_frequency('I love Batman because I am Batman')
{'I': 2, 'love': 1, 'Batman': 2, 'because': 1, 'am': 1}
>>> sum([1, 2, 3])
6
>>> len([1, 2, 3])
3
>>> max([1, 2, 3])
3
>>> max([1, 2, 3, 10, 5, 7])
10
>>> min([1, 50, -7, 337])
-7
def say_my_name():
print('Rafeh Qazi')
print('John')
print('Kara')
print('Sam')
say_my_name()
>>> Rafeh Qazi
>>> John
>>> Kara
>>> Sam
def say_my_name(name):
print(name)
say_my_name('Rafeh')
>>> Rafeh
def greeting(name, greet='aloha'):
# Function greeting() takes in 2 arguments, 'name' & 'greet' and it greets the user.
>>> greeting('aloha', 'Qazi')
"π aloha Qazi!"
print(f"π {greet} {name}!")
# Positional arguments ππ»
# greeting('Qazi', 'hello')
# Named arguments ππ»
# greeting(greet='Hi', name='Qazi')