Skip to content

Commit 1bc8e8d

Browse files
committed
backup my exercises of learning python
0 parents  commit 1bc8e8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+58266
-0
lines changed

6-5.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
rivers = {
3+
'Yangzijiang': 'china',
4+
'nile': 'egypt',
5+
'amazon': 'southamerica',
6+
}
7+
for river in rivers.keys():
8+
print("The " + river.title() +
9+
" runs through " +
10+
rivers[river].title()+
11+
".")
12+

6-6.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
favorite_languages = {
2+
'jen': 'python',
3+
'sarah': 'c',
4+
'edward': 'ruby',
5+
'phil': 'python',
6+
'jack': 'c',
7+
}
8+
9+
investigated_people = ['jen', 'jack']
10+
11+
for name in favorite_languages.keys():
12+
print("Hi " + name.title())
13+
if name in investigated_people:
14+
print("Thanks for your investigation!\n")
15+
else:
16+
print("Would you take part in our investigation?\n")
17+

7-5.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
message = "Please enter your age under here: "
3+
age = int(input(message))
4+
5+
if age < 3:
6+
print("Your tickets is free")
7+
elif 3 <= age <= 12:
8+
print("You tickets need 10 dollars")
9+
elif age > 12:
10+
print("You tickest need 15 dollars")
11+

9-1.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Restaurant():
2+
""" creat a class of Restaurant"""
3+
4+
def __init__(self, restaurant_name, cuisine_type):
5+
self.restaurant_name = restaurant_name
6+
self.cuisine_type = cuisine_type
7+
8+
def describe_restaurant(self):
9+
print("This restaurant is called "
10+
+ self.restaurant_name.upper()
11+
+ ".")
12+
print("The type of this restaurant is "
13+
+ self.cuisine_type.title()
14+
+ ".")
15+
16+
def open_restaurant(self):
17+
print("Our restaurant is openning.")
18+
19+
KFC = Restaurant('kfc', 'fast food')
20+
KFC.describe_restaurant()
21+
KFC.open_restaurant()
22+

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is backup of my exercises from the book "Python Crash Course".
2+
3+
As a record of learning python.

__pycache__/car.cpython-36.pyc

2.98 KB
Binary file not shown.
1.8 KB
Binary file not shown.
130 Bytes
Binary file not shown.
388 Bytes
Binary file not shown.

__pycache__/pizza.cpython-36.pyc

423 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)