Skip to content

Commit b365d66

Browse files
committed
allTheRest
1 parent 462be7d commit b365d66

17 files changed

+832
-85
lines changed

ArgsUndKwargs.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
def sum(a, b):
2+
return a+b
3+
"""
4+
def sum(a, b, c):
5+
return a+b+c """
6+
7+
print(sum(3,4))
8+
9+
def sum(*args):
10+
print(type(args))
11+
print(args)
12+
result=0
13+
for arg in args:
14+
result+=arg
15+
print(result)
16+
17+
sum(1,2,3)
18+
19+
def kwargs(**kwargs):
20+
print(type(kwargs))
21+
print(kwargs)
22+
23+
kwargs(A=100, B=50)
24+
25+
print()
26+
27+
def briefkopf(*args, **kwargs):
28+
print(args[0], args[1], '\n')
29+
print(f"{kwargs.get('Str')} {kwargs.get('Nr')}")
30+
print(f"{kwargs.get('PLZ')} {kwargs.get('Stadt')}")
31+
if "Option" in kwargs:
32+
print(f"{kwargs.get('Option')}")
33+
34+
briefkopf("Stefan", "Koschnik", Str="Bahnhofstr.", Nr="9", PLZ="12345", Stadt="Berlin")
35+
briefkopf("Stefan", "Koschnik", Str="Bahnhofstr.", Nr="9", PLZ="12345", Stadt="Berlin", Option="Beim Nachbarn abgeben")
36+

CD_Regal/CD_Regal.py

-75
This file was deleted.

CD_Regal/albumFROMartist.sql

-6
This file was deleted.

CD_Regal/artistFROMgenre.sql

-4
This file was deleted.

CD_Regal/cdregal.db

-40 KB
Binary file not shown.

Datentypen.py

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Integer und ein bisschen binär
2+
3+
int_a=10
4+
int_b=int_a
5+
print(int_a, int_b)
6+
int_a=11
7+
print(int_a, int_b)
8+
print(int_a & int_b)
9+
int_a=1
10+
int_b=2
11+
print(bin(int_a) +'\n'+bin(int_b))
12+
print(bin(int_a | int_b))
13+
print(bin((int_a | int_b) <<2))
14+
15+
# Float und Runden
16+
17+
float_a=1043.791854
18+
print(round(float_a, 3))
19+
20+
float_b=1.9999999999999999
21+
float_b=1.9999777777777777
22+
print(int(float_b))
23+
24+
from math import ceil
25+
from math import floor
26+
27+
print(floor(float_b))
28+
print(round(float_b,5))
29+
30+
# Listen
31+
# Listen Methoden: append, extend, copy, count, index, insert, pop, remove, reverse, sort
32+
# builtin: all()/any()
33+
34+
list_a=[1,2,3,4,5,6,7,8,9,10]
35+
print(list_a[0:5])
36+
print(list_a[0:int((len(list_a)/2))])
37+
list_a.reverse()
38+
print((list_a))
39+
print((list_a[::-1]))
40+
list_b=list_a
41+
list_b=[20,19,18]
42+
list_c=[17,16,15]
43+
list_b.append(list_a)
44+
print((list_b))
45+
list_b.extend(list_c)
46+
print((list_b))
47+
list_c.sort(reverse=1)
48+
print((list_c))
49+
list_d=list_c.copy()
50+
#list_d=list_c
51+
print(list_d)
52+
list_d[0]=100
53+
print(id(list_c), id(list_d))
54+
print(list_d.index(16))
55+
list_e=[1,2,3,1,5,2,4,1,0]
56+
print(list_e.count(1))
57+
list_f=list_a+list_e
58+
print(set(list_f))
59+
#all/any
60+
61+
62+
# String
63+
64+
str_a="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam"
65+
print(str_a.rfind("sit"))
66+
67+
print("dolor" in str_a)
68+
69+
# Dictionary
70+
71+
dict_a={"Red":"#ff0000", "Green":"#00ff00", "Blue":"#0000ff"}
72+
print(dict_a.keys(),
73+
dict_a.values(),
74+
dict_a.items(),
75+
dict_a.get("Red"))
76+
77+
78+
79+
80+
81+
82+
83+
84+

0 commit comments

Comments
 (0)