-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday_9.py
More file actions
186 lines (133 loc) · 4.63 KB
/
day_9.py
File metadata and controls
186 lines (133 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# DICTIONARIES, NESTING AND THE SECRET AUCTION
# from replit import clear
# programming_dictionary = {"Bug": "An error in a program that prevents the program from running as expected.",
# "Function": "A piece of code that you can easily call over and over again.",
# "Loop": "The action of doing something over and over again.",
# }
# # # Retriving items from dictionary
# # print(programming_dictionary["Bug"])
# # # Adding new items to dictionary
# # programming_dictionary["Loop"] = "The action of doing something over and over again."
# # # Create an empty dictionary
# # empty_dictionary = {}
# # # Wipe an existing dictionary
# # programming_dictionary = {}
# # print(programming_dictionary)
# # Edit an item in a dictionary
# programming_dictionary["Bug"] = "A moth in your computer."
# print(programming_dictionary)
# # Loop through a dictionary
# for key in programming_dictionary:
# print(key)
# print(programming_dictionary[key])
# Zadanie1
# student_scores = {
# "Harry": 81,
# "Ron": 78,
# "Hermione": 99,
# "Draco": 74,
# "Neville": 62,
# }
# student_grades = {}
# #TODO-2: Write your code below to add the grades to student_grades.👇
# for student in student_scores:
# grade = student_scores[student]
# if grade > 90:
# student_grades[student] = "Outstanding"
# elif grade > 80:
# student_grades[student] = "Exceeds Expectations"
# elif grade > 70:
# student_grades[student] = "Acceptable"
# else:
# student_grades[student] = "Fail"
# # 🚨 Don't change the code below 👇
# print(student_grades)
# nesting a list into the dictionary
# travel_log = {
# "France": {"cities_visited": ["Paris", "Lille", "Dijon"], "total_visits": 12},
# "Germany": {"cities_visited": ["Berlin", "Hamburg", "Stuttgart"], "total_visits": 5}
# }
# nesting Dictionary in a list
# travel_log = [
# {
# "country": "France",
# "cities_visited": ["Paris", "Lille", "Dijon"],
# "total_visits": 12
# },
# {
# "country": "Germany",
# "cities_visited": ["Berlin", "Hamburg", "Stuttgart"],
# "total_visits": 5
# }
# ]
# zadanie 2
# travel_log = [
# {
# "country": "France",
# "visits": 12,
# "cities": ["Paris", "Lille", "Dijon"]
# },
# {
# "country": "Germany",
# "visits": 5,
# "cities": ["Berlin", "Hamburg", "Stuttgart"]
# },
# ]
# #🚨 Do NOT change the code above
# #TODO: Write the function that will allow new countries
# #to be added to the travel_log. 👇
# def add_new_country(country_visited, times_visited, cities_visited):
# # to było moje rozwiązanie:
# # new_country = {"country": country, "visits": visits, "cities": cities}
# # travel_log.append(new_country)
# # rozwiązanie z kursu:
# new_country = {}
# new_country["country"] = country_visited
# new_country["visits"] = times_visited
# new_country["cities"] = cities_visited
# travel_log.append(new_country)
# #🚨 Do not change the code below
# add_new_country("Russia", 2, ["Moscow", "Saint Petersburg"])
# print(travel_log)
# #########################################################################################################################################################################
# zadanie 3
from os import system, name
def clear():
if name == "nt":
_ = system("cls")
logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
|_______| '-' `'---------'` '-'
)"""""""(
/_________\\
.-------------.
/_______________\\
'''
print(logo)
bidding_game = {}
more = True
max = 0
while more:
bidder_name = input("What is your name?: ")
how_much = int(input("What is your bid?: $"))
bidding_game[bidder_name] = how_much
other_bidders = input("Are there any other bidders? Type 'yes or 'no'. ")
if other_bidders == "yes":
more = True
clear()
else:
clear()
more = False
for person in bidding_game:
bid = bidding_game[person]
if bid >= max:
max = bid
for key, value in bidding_game.items():
if value == max:
print(f"{key} is the winner with {value} price!")
print(id(max))