Skip to content

Commit a76a782

Browse files
committed
Zadanie splitter!
1 parent cda3d8c commit a76a782

File tree

17 files changed

+540
-9
lines changed

17 files changed

+540
-9
lines changed

02_Hello_World/HelloWorld.py

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
print('Hello World')
2+
3+
# eloelo

03_Zmienne_i_typy_danych/konwersje_i_typizacja.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
a = "3"
55

6-
a = a+3 # Bład !!!!
6+
a = a + 3 # Bład !!!!
77

88
a = int("3")
99

@@ -17,4 +17,4 @@
1717

1818
a
1919

20-
str(a)
20+
str(a)

04_Instrukcje_warunkowe/if.py

+20
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,23 @@
5151
print(f'{i} jest nieparzyste')
5252

5353

54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
a = int(input("podaj liczbe"))
67+
b = int(a/10) # b = a // 10
68+
c = a%10
69+
i = b+c
70+
if(i % 7 == 0 and a % 2 == 0):
71+
print("liczba jest dobra")
72+
else:
73+
print("liczba jest zla")

05_Petle/for.py

+17
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,20 @@
2121
break
2222
else:
2323
print("Koniec")
24+
25+
for number in range(10, 100):
26+
suma = 0
27+
for c in str(number):
28+
suma += int(c)
29+
if (suma % 7 == 0 and number % 2 == 0):
30+
print(number)
31+
32+
33+
34+
35+
number = input()
36+
suma = 0
37+
for c in str(number):
38+
print(f"to jest znak-> {c} \nto jest suma-> {suma}")
39+
suma += int(c) # suma = suma + c
40+
print(suma)

06_Lancuchy_znakow/arytmetyka.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
s * 3
1616

17-
"Python" > "Java"
17+
"Pythona" > "Pythonb"
1818
s == "Ala"
1919

2020
"10" < "2"

06_Lancuchy_znakow/formatowanie.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,28 @@
1818
print(f'{i:02}')
1919

2020
from math import pi
21+
2122
pi
2223

2324
f'{pi:.3}'
2425
f'{pi:.3f}'
25-
f'{pi-3:.3f}'
26+
f'{pi - 3:.3f}'
2627
f'{12:3d}'
2728
f'{12:03d}'
2829
f'{pi:<30.2f}'
2930
f'{pi:>30.2f}'
3031
f'{pi:->30.2f}'
3132
f'{pi:^30.2f}'
32-
f'{"-"*10}HELLO{"-"*10}'
33+
f'{"-" * 10}HELLO{"-" * 10}'
3334
f'{"HELLO":-^25s}'
3435

36+
h = int(input("podaj wysokosc choinki"))
37+
p = h
38+
for i in range(0, h):
39+
print(f'{(" " * h)}{"XD" * (2 * i + 1)}')
40+
h -= 1
41+
for i in range(0, 2):
42+
print(f'{(" " * p)}{"XD" * (2 * i + 1)}')
43+
p-=1
44+
if i == 2:
45+
break

07_Listy/sortowanie.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,17 @@
1313

1414
dluga_lista = [ str(i) for i in range(21)] + [ str(i) for i in range(-1, -21, -1)]
1515
str(dluga_lista)
16-
dluga_lista.sort(key=int)
16+
dluga_lista.sort(key=int)
17+
18+
19+
lista = []
20+
21+
while True:
22+
lst = input("wpisz cos albo enter")
23+
if (lst == ""):
24+
break
25+
lista.append(lst)
26+
27+
lista.sort(key=str)
28+
29+
print(lista)

09_Slowniki/slowniki.py

+100-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,108 @@
5050
print('tej liczby nie znam')
5151

5252
s2 = {'d': 4}
53-
s|s2
53+
s | s2
5454

55-
s|={'e':5}
55+
s |= {'e': 5}
5656
s
5757

5858
'a' in s
5959

60-
s = {1: "a", 2: 'b', "ala": [3, 4]}
60+
s = {1: "a", 2: 'b', "ala": [3, 4]}
61+
62+
lista = []
63+
s = {}
64+
counter = 0
65+
while True:
66+
lst = input("wpisz cos albo enter")
67+
if (lst == ""):
68+
break
69+
counter = s.get(lst, 0)
70+
counter += 1
71+
s[lst] = counter
72+
73+
liczba = input("podaj liczbe od 1-999")
74+
lenght = len(str(liczba))
75+
digits = {1: 'jeden',
76+
2: 'dwa',
77+
3: 'trzy',
78+
4: ['cztery', 'czter'],
79+
5: ['piec', 'piet'],
80+
6: 'szesc',
81+
7: 'siedem',
82+
8: 'osiem',
83+
9: ['dziewiec', 'dziewiet'],
84+
10: 'dziesiec'}
85+
86+
if lenght == 2:
87+
if (liczba[0] != 4 or liczba[0] != 9):
88+
print(f"{digits[int(liczba[1])]}nascie")
89+
else:
90+
print(f"{digits[int(liczba[1][1])]}nascie")
91+
92+
# -------------------------------------------------------------------------
93+
nazwy_jednosci = {0: "", 1: "jeden", 2: "dwa", 3: "trzy", 4: "cztery", 5: "pięć", 6: "sześć", 7: "siedem", 8: "osiem",
94+
95+
9: "dziewięć"}
96+
97+
dziesiatki = {10: "dziesiec", 20: "dwadziescia", 30: "trzydziesci", 40: "czterdziesci", 50: "piecdziesiat",
98+
99+
60: "szescdziesiat", 70: "siedemdziesiat", 80: "osiemdziesiat", 90: "dziewiecdziesiat"}
100+
101+
nastki = {11: "jedenascie", 12: "dwanascie", 13: "trzynascie", 14: "czternascie", 15: "pietnascie",
102+
103+
16: "szesnascie", 17: "siedemnascie", 18: "osiemnascie", 19: "dziewietnascie"}
104+
105+
setki = {0: "", 100: "sto", 200: "dwiescie", 300: "trzysta", 400: "czterysta", 500: "piecset", 600: "szescset",
106+
700: " siedemset", 800: "osiemset", 900: "dziewiecset"}
107+
108+
slownik = {}
109+
110+
n = int(input("Wpisz liczbe:"))
111+
napis = setki[n - n % 100]
112+
n %= 100
113+
114+
if n in range(11, 20):
115+
napis = nastki[n]
116+
else:
117+
napis += setki[n] + " " + dziesiatki[n - n % 10] + " " + nazwy_jednosci[n % 10]
118+
119+
print(napis)
120+
121+
# ********************************************************************************************
122+
nazwy_jednosci = {0: "", 1: "jeden", 2: "dwa", 3: "trzy", 4: "cztery", 5: "pięć", 6: "sześć", 7: "siedem", 8: "osiem",
123+
124+
9: "dziewięć"}
125+
126+
nastki = {0: "", 11: "jedenaście", 12: "dwanaście", 13: "trzynaście", 14: "czternaście", 15: "pietnascie",
127+
16: "szesnaście",
128+
129+
17: "siedemnascie", 18: "osiemnaście", 19: "dziewietnascie"}
130+
131+
dziesiatki = {0: "", 10: "dziesięć", 20: "dwadzieścia", 30: "trzydzieści",
132+
133+
40: "czterdzieści", 50: "pięćdziesiąt", 60: "sześćdziesiąt", 70: "siedemdziesiąt", 80: "osiemdziesiąt",
134+
135+
90: "dziewięćdziesiąt"}
136+
137+
setki = {0: "", 100: "sto", 200: "dwiescie", 300: "trzysta",
138+
139+
400: "czterysta", 500: "piecset", 600: "szescset", 700: "siedemset",
140+
141+
800: "osiemset", 900: "dziewiecset"}
142+
143+
n = int(input("wpisz liczbe:"))
144+
145+
napis = setki[n - n % 100]
146+
147+
n %= 100
148+
149+
if n in range(11, 20):
150+
151+
napis += nastki[n]
152+
153+
else:
154+
155+
napis += " " + dziesiatki[n - n % 10] + " " + nazwy_jednosci[n % 10]
156+
157+
print(napis)

09_Slowniki/zadanie2.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
nazwy_jednosci = {0: "", 1: "jeden", 2: "dwa", 3: "trzy", 4: "cztery", 5: "pięć", 6: "sześć", 7: "siedem", 8: "osiem",
2+
3+
9: "dziewięć"}
4+
5+
nastki = {0: "", 11: "jedenaście", 12: "dwanaście", 13: "trzynaście", 14: "czternaście", 15: "pietnascie",
6+
16: "szesnaście",
7+
8+
17: "siedemnascie", 18: "osiemnaście", 19: "dziewietnascie"}
9+
10+
dziesiatki = {0: "", 10: "dziesięć", 20: "dwadzieścia", 30: "trzydzieści",
11+
12+
40: "czterdzieści", 50: "pięćdziesiąt", 60: "sześćdziesiąt", 70: "siedemdziesiąt", 80: "osiemdziesiąt",
13+
14+
90: "dziewięćdziesiąt"}
15+
16+
setki = {0: "", 100: "sto", 200: "dwiescie", 300: "trzysta",
17+
18+
400: "czterysta", 500: "piecset", 600: "szescset", 700: "siedemset",
19+
20+
800: "osiemset", 900: "dziewiecset"}
21+
22+
n = int(input("wpisz liczbe:"))
23+
24+
napis = setki[n - n % 100]
25+
26+
n %= 100
27+
28+
if n in range(11, 20):
29+
30+
napis += nastki[n]
31+
32+
else:
33+
34+
napis += " " + dziesiatki[n - n % 10] + " " + nazwy_jednosci[n % 10]
35+
36+
print(napis)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[(x,str(x)) for x in range(10)]
2+
3+
4+
t = []
5+
for i in range(10):
6+
t.append([i , str(i)])
7+
print(t)
8+
9+
10+
11+
12+
13+
14+
15+
16+
s = {"Sedan": 1500, "SUV": 2000, "Pickup": 2500, "Minivan": 1600, "Van": 2400, "Semi": 13600, "Bicycle": 7, "Motorcycle": 110}
17+
18+
[(car, weight) for car, weight in s.items() if weight > 5000]
19+
20+
[x for x in s.keys() if s[x] > 5000]

0 commit comments

Comments
 (0)