Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StepaniaH committed Aug 4, 2024
0 parents commit 88a273f
Show file tree
Hide file tree
Showing 204 changed files with 269,469 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store/
.git/
bin/
etc/
lib/
include/
share/
pyvenv.cfg
__pycache__/
.pytest_cache/
1 change: 1 addition & 0 deletions 01-Getting-Started/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello Python world!")
2 changes: 2 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0201-Simple-Message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
message = "Hello Python World!"
print(message)
5 changes: 5 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0202-Simple-Messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message = "Hello Python World!"
print(message)

message = "Bye Python World!"
print(message)
6 changes: 6 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0203-Personal-Nessage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
firstName = "Jay"
lastName = "Chou"

name = f"{firstName} {lastName}"

print(f"Hello {name}, would you like to learn some Python today?")
8 changes: 8 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0204-Name-Cases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
firstName = "Jay"
lastName = "Chou"

name = f"{firstName} {lastName}"

print(f"Hello {name.title()}, would you like to learn some Python today?") # Normal case
print(f"Hello {name.lower()}, would you like to learn some Python today?") # Lower case
print(f"Hello {name.upper()}, would you like to learn some Python today?") # Upper case
7 changes: 7 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0205-Famous-Quote.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
firstName = "Jay"
lastName = "Chou"

name = f"{firstName} {lastName}"
quote = "Ayo, not bad!"

print(f'{name.title()} once said, "{quote}".')
8 changes: 8 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0206-Famous-Quote-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
firstName = "Jay"
lastName = "Chou"

famous_person = f"{firstName} {lastName}"
message = "Ayo, not bad!"


print(f'{famous_person.title()} once said, "{message}".')
7 changes: 7 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0207-Stripping-Names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
firstName = "Jay"
lastName = "Chou"

name = f"\t{firstName} \n{lastName} "

print(f"{name}")
print(f"{name.strip()}")
5 changes: 5 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0208-File-Extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filename = "python_notes.txt"

filename = filename.removesuffix(".txt")

print(f"{filename}")
4 changes: 4 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0209-Number-Eight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
print(1 + 7)
print(8 - 0)
print(1 * 8)
print(8 // 1)
5 changes: 5 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0210-Favorite-Number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
f_num = 2

message = f"{f_num} is my favorite num!"

print(message)
6 changes: 6 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0211-Adding-Comments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a single line comment

"""
This is a commit block.
You can add more than two lines.
"""
28 changes: 28 additions & 0 deletions 02-Variables-and-Simple-Data-Types/0212-Zen-of-Python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
>>> import this
"""

"""
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
"""
6 changes: 6 additions & 0 deletions 03-Introducing-Lists/0301-Names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

print(names[0].title())
print(names[1].title())
print(names[2].title())
print(names[3].title())
5 changes: 5 additions & 0 deletions 03-Introducing-Lists/0302-Greetings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

greeting_message = "Nice to meet you."

print(f"{names[0].title()}, {greeting_message.lower()}")
2 changes: 2 additions & 0 deletions 03-Introducing-Lists/0303-Your-Own-List.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
traffice_way = ['bicycle', 'bus', 'taxi', 'car']
print(f"I would like to buy my own {traffice_way[-1].lower()}.")
5 changes: 5 additions & 0 deletions 03-Introducing-Lists/0304-Guest-List.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")
print(f"Hey, {names[2].title()}, come to have dinner with me!")
11 changes: 11 additions & 0 deletions 03-Introducing-Lists/0305-Changing-Guest-List.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

regret = names.pop(1)

print(f"It is a pity that {regret.title()} can not make the appointment.")

new_name = names.insert(1, 'big b')

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")
print(f"Hey, {names[2].title()}, come to have dinner with me!")
26 changes: 26 additions & 0 deletions 03-Introducing-Lists/0306-More-Guests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

regret = names.pop(1)

print(f"It is a pity that {regret.title()} can not make the appointment.")

names.insert(1, 'big b')

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")
print(f"Hey, {names[2].title()}, come to have dinner with me!")

print("Congratulations! I found a bigger dinner table!")

names.insert(0, 'big a')
names.insert(3, 'big c')
names[-1] = 'big d'
names.append('lil d')

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")
print(f"Hey, {names[2].title()}, come to have dinner with me!")
print(f"Hey, {names[3].title()}, come to have dinner with me!")
print(f"Hey, {names[4].title()}, come to have dinner with me!")
print(f"Hey, {names[5].title()}, come to have dinner with me!")
print(f"Hey, {names[6].title()}, come to have dinner with me!")
34 changes: 34 additions & 0 deletions 03-Introducing-Lists/0307-Shrinking-Guest-List.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

regret = names.pop(1)

names.insert(1, 'big b')

print("Congratulations! I found a bigger dinner table!")

names.insert(0, 'big a')
names.insert(3, 'big c')
names[-1] = 'big d'
names.append('lil d')

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")
print(f"Hey, {names[2].title()}, come to have dinner with me!")
print(f"Hey, {names[3].title()}, come to have dinner with me!")
print(f"Hey, {names[4].title()}, come to have dinner with me!")
print(f"Hey, {names[5].title()}, come to have dinner with me!")
print(f"Hey, {names[6].title()}, come to have dinner with me!")

print("I can only invite two guests due to the suck AWS!")

print(f"Sorry, {names.pop().title()}!")
print(f"Sorry, {names.pop().title()}!")
print(f"Sorry, {names.pop().title()}!")
print(f"Sorry, {names.pop().title()}!")
print(f"Sorry, {names.pop().title()}!")

print(f"{names[0].title()}, you are still in my list.")
print(f"{names[1].title()}, you are still in my list.")

del names[0:]
print(names)
34 changes: 34 additions & 0 deletions 03-Introducing-Lists/0308-Seeing-the-World.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
tourist_destinations = ['US', 'JP', 'UK', 'DE', 'FR']
print(tourist_destinations)

print(sorted(tourist_destinations))

print(tourist_destinations)

print(sorted(tourist_destinations, reverse=True))

print(tourist_destinations)

tourist_destinations.reverse()
print(tourist_destinations)
"""
The output of the command `print(tourist.destinations.reverse())` is `None`, due to reverse() returns nothing.
If you want to write it in one line, you can use the reverse() method with a logical OR operator:
```
print(tourist.destinations.reverse() or tourist.destinations)
```
This method utilizes Python's short-circuit evaluation of the logical OR operator (or). Here's how it works:
a. reverse() is called first. This method reverses the list a in-place and returns None.
b. In Python, None is considered False in a boolean context.
c. The or operator evaluates its left operand (a.reverse()). Since it's None (which is False), it moves on to evaluate the right operand (a).
d. The right operand a is the reversed list, which is then returned and printed.
"""

tourist_destinations.reverse()
print(tourist_destinations)

tourist_destinations.sort()
print(tourist_destinations)

tourist_destinations.sort(reverse=True)
print(tourist_destinations)
6 changes: 6 additions & 0 deletions 03-Introducing-Lists/0309-Dinner-Guests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
names = ['lil a', 'lil b', 'lil c', 'lil d']

print(f"Hey, {names[0].title()}, come to have dinner with me!")
print(f"Hey, {names[1].title()}, come to have dinner with me!")

print(f"I invited {len(names)} friends for my dinner.")
9 changes: 9 additions & 0 deletions 03-Introducing-Lists/0310-Every-Function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tourist_destinations = ['US', 'JP', 'UK', 'DE', 'FR']

del tourist_destinations[0]

len(tourist_destinations)

sorted(tourist_destinations)

print(tourist_destinations)
4 changes: 4 additions & 0 deletions 03-Introducing-Lists/0311-Intentional-Error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tourist_destinations = ['US', 'JP', 'UK', 'DE', 'FR']

# print(tourist_destinations[5])
print(tourist_destinations[3])
11 changes: 11 additions & 0 deletions 04-Working-with-Lists/0401-Pizzas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pizzas = ['Neapolitan Pizza', 'New York-Style Pizza',
'Chicago-Style Deep-Dish Pizza', 'California-Style Pizza', 'Sicilian-Style Pizza']

for pizza in pizzas:
print(pizza)


for pizza in pizzas:
print(f"I like {pizza}.")

print("I really love pizza!")
6 changes: 6 additions & 0 deletions 04-Working-with-Lists/0402-Animals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mammals = ['lion', 'panda', 'koala']

for mammal in mammals:
print(f"A {mammal} would make a great pet.")

print("Any of these animals is a mammal.")
2 changes: 2 additions & 0 deletions 04-Working-with-Lists/0403-Counting-to-Twenty.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for value in range(1, 21):
print(value)
3 changes: 3 additions & 0 deletions 04-Working-with-Lists/0404-One-Million.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
million = list(range(1, 1_000_001))
for mil in million:
print(mil)
5 changes: 5 additions & 0 deletions 04-Working-with-Lists/0405-Summing-a-Million.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
million = list(range(1, 1_000_001))

print(min(million))
print(max(million))
print(sum(million))
4 changes: 4 additions & 0 deletions 04-Working-with-Lists/0406-Odd-Numbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
odd = list(range(1, 20, 2))

for oddodd in odd:
print(oddodd)
4 changes: 4 additions & 0 deletions 04-Working-with-Lists/0407-Threes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
threes = list(range(3, 31, 3))

for three in threes:
print(three)
6 changes: 6 additions & 0 deletions 04-Working-with-Lists/0408-Cubes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cubes = []
for i in range(1, 11):
cubes.append(i ** 3)

for cube in cubes:
print(cube)
1 change: 1 addition & 0 deletions 04-Working-with-Lists/0409-Cube-Comprehension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cubes = [cube ** 3 for cube in range(1, 11)]
14 changes: 14 additions & 0 deletions 04-Working-with-Lists/0410-Slices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pizzas = ['Neapolitan Pizza', 'New York-Style Pizza',
'Chicago-Style Deep-Dish Pizza', 'California-Style Pizza', 'Sicilian-Style Pizza']

print("The first three items in the list are:")
for i in pizzas[:3]:
print(i)

print("\nThree items from the middle of the list are:")
for i in pizzas[1:4]:
print(i)

print("\nThe last three items in the list are:")
for i in pizzas[-3:]:
print(i)
15 changes: 15 additions & 0 deletions 04-Working-with-Lists/0411-My-Pizzas-Your-Pizzas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pizzas = ['Neapolitan Pizza', 'New York-Style Pizza',
'Chicago-Style Deep-Dish Pizza', 'California-Style Pizza', 'Sicilian-Style Pizza']

friend_pizza = pizzas[:]

pizzas.append('Tokyo-Style Pizza')
friend_pizza.append('Cypriot-Style Pizza')

print("My favorite pizzas are:")
for my in pizzas:
print(my)

print("\nMy friend's favorite pizzas are:")
for friend in friend_pizza:
print(friend)
10 changes: 10 additions & 0 deletions 04-Working-with-Lists/0412-More-Loops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]

print("My favorite foods are:")
for my in my_foods:
print(my)

print("\nMy friend's favorite foods are:")
for friend in friend_foods:
print(friend)
13 changes: 13 additions & 0 deletions 04-Working-with-Lists/0413-Buffet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dishes = ("Fish and Chips", "Shepherd's Pie", "Caesar Salad",
"Spaghetti Bolognese", "Chicken Curry")

for dish in dishes:
print(dish)

# dishes[0] = "a"

dishes = ("Fish and Chips", "Beef Wellington",
"Caesar Salad", "Pad Thai", "Chicken Curry")
print("\n")
for dish in dishes:
print(dish)
2 changes: 2 additions & 0 deletions 04-Working-with-Lists/0414-PEP-8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Read "PEP 8 - Styles Guide for Python Code".
# https://peps.python.org/pep-0008/
Loading

0 comments on commit 88a273f

Please sign in to comment.