Skip to content

Commit def2f9e

Browse files
authored
Add files via upload
1 parent 4f7e271 commit def2f9e

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
game_stock = {
2+
"Dragon Quest": 5,
3+
"Final Fantasy": 1,
4+
"Age of Empires": 5
5+
}
6+
7+
def get_highest_stock_game() -> dict[str, int]:
8+
stock_quantities = game_stock.values()
9+
high = 0
10+
for quantity in stock_quantities:
11+
if quantity > high:
12+
high = quantity
13+
game_results = {}
14+
15+
for game in game_stock:
16+
if game_stock[game] == high:
17+
game_results[game] = high
18+
return game_results
19+
20+
print(f"Games with the highest stock: {get_highest_stock_game()}")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
my_number = 32
2+
my_number = "32"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Game:
2+
def __init__(self, name, genre, price) -> None:
3+
self.name = name
4+
self.genre = genre
5+
self.price = price
6+
7+
def get_name(self) -> str:
8+
return self.name
9+
10+
def get_genre(self) -> str:
11+
return self.genre
12+
13+
def get_price(self) -> float:
14+
return self.price
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def get_number_of_titles(list) -> str:
2+
return len(list)
3+
4+
game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"]
5+
print(f"Number of titles: {get_number_of_titles(game_titles_list)}")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def find_keyword_in_titles(list, keyword) -> None:
2+
print(f"Titles that contain the keyword {keyword}")
3+
for game_title in list:
4+
if keyword in game_title:
5+
print(f"{game_title}")
6+
7+
game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"]
8+
find_keyword_in_titles(game_titles_list, "Final")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def get_game_recommendation(list) -> str:
2+
return random.choice(list)
3+
4+
game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"]
5+
print(f"Random recommendation: {get_game_recommendation(game_titles_list)}")

0 commit comments

Comments
 (0)