File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change
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" ]} ' )
Original file line number Diff line number Diff line change @@ -32,5 +32,27 @@ def __init__(self, player):
32
32
def mysound (self ):
33
33
return "Fiufiu"
34
34
35
+
36
+ """
37
+ Fabryka - polimorficzne tworzenie obiektow klasy z cmd
38
+ """
35
39
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 ()
You can’t perform that action at this time.
0 commit comments