Skip to content

Commit 74d09dd

Browse files
committed
Zadanie splitter!
1 parent 29f5283 commit 74d09dd

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

16_Dane_zdalne/Zadanie.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
import requests
3+
from pprint import pprint
4+
5+
inp = sys.argv[1]
6+
url = f"https://restcountries.com/v3.1/name/{inp}?fullText=true"
7+
response = requests.request(method="GET", url=url)
8+
9+
10+
print()
11+
print(25*"*")
12+
print()
13+
print(response.json()[0]['name'])
14+
print(25*"*")
15+
data = response.json()[0]
16+
pprint(data.keys())
17+
print(f'Ludnosc:\t{data["population"]}')
18+
print(f'Powierzchnia:\t{data["area"]}')
19+
print(f'Waluta:\t\t{list(data["currencies"].keys())[0]}')
20+
print(f'Stolica:\t{data["capital"]}')

17_Wstep_do_obiektowosci/fabryka.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,27 @@ def __init__(self, player):
3232
def mysound(self):
3333
return "Fiufiu"
3434

35+
36+
"""
37+
Fabryka - polimorficzne tworzenie obiektow klasy z cmd
38+
"""
3539
instrument = globals()[input("Podaj instrument:")]('Bob')
36-
instrument.play()
40+
instrument.play()
41+
42+
if __name__ == '__main__':
43+
44+
orkiestra = []
45+
46+
for wpis in sys.argv[1:]:
47+
48+
muzyk, instrument = tuple(wpis.strip().split('@'))
49+
50+
orkiestra.append(
51+
52+
globals()[instrument](muzyk)
53+
54+
)
55+
56+
for instrument in orkiestra:
57+
58+
instrument.play()

0 commit comments

Comments
 (0)