-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page217.py
More file actions
35 lines (22 loc) · 925 Bytes
/
python_exercise_page217.py
File metadata and controls
35 lines (22 loc) · 925 Bytes
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
# esercizio numero 11.1 pagina 217
"""A collection of functions for working with cities."""
def city_country(city, country):
"""Return a string like 'Santiago, Chile'."""
return f"{city.title()}, {country.title()}"
# esercizio numero 11.2
def city_country(city, country, population):
"""Return a string like 'Santiago, Chile - population 5000000'."""
output_string = f"{city.title()}, {country.title()}"
output_string += f" -population {population}"
return output_string
# esercizio numero 11.3
class Employee:
"""A class to represent an employee."""
def __init__(self, f_name, l_name, salary):
"""Initialize the employee."""
self.first = f_name.title()
self.last = l_name.title()
self.salary = salary
def give_raise(self, amount=5000):
"""Give the employee a raise."""
self.salary += amount