Skip to content

Commit 45ce80f

Browse files
Commit
1 parent 4b73ec2 commit 45ce80f

File tree

7 files changed

+81
-32
lines changed

7 files changed

+81
-32
lines changed

.idea/workspace.xml

+33-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Section_03/assignment_05.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"""
1515

1616
# Your Code Below:
17-
17+
def key_list_items(**kwargs):
18+
return kwargs['people'][-2]
1819

1920

2021

@@ -61,6 +62,6 @@
6162
# keys = kwargs[key]
6263
# return keys[-2]
6364
#
64-
# result = key_list_items("people", things=['book', 'tv', 'shoes'], people=['pete', 'mike', 'jan', 'tom'],
65-
# ages=[20, 30, 40])
66-
# print(result)
65+
result = key_list_items("people", things=['book', 'tv', 'shoes'], people=['pete', 'mike', 'jan', 'tom'],
66+
ages=[20, 30, 40])
67+
print(result)

Section_04/assignment_01.py

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
"""
1414

1515
# Your Code Below:
16+
def twelver(a,b):
17+
if ( a==12 or b==12 ) or (a+b==12):
18+
return True
19+
return False
20+
21+
print(twelver(3, 12))
22+
23+
print(twelver(4, 9))
24+
25+
print(twelver(9, 3))
1626

1727

1828

Section_04/assignment_02.py

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
"""
1919

2020
# Your Code Below:
21+
def pay_extra(working,hour):
22+
if working==True and (hour>=20 or hour<=8):
23+
return True
24+
return False
25+
26+
print(pay_extra(True, 11))
27+
28+
print(pay_extra(False, 5))
29+
30+
print(pay_extra(True, 6))
2131

2232

2333

Section_04/assignment_03.py

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"""
1313

1414
# Your Code Below:
15+
def sequence(*args):
16+
pass
17+
print(sequence([1, 1, 2, 3, 1]))
1518

1619

1720

Section_04/assignment_04.py

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
"""
1111

1212
# Your Code Below:
13+
def grow_string(string):
14+
result_string=''
15+
for i in range(len(string)):
16+
result_string+=string[:i+1]
17+
return result_string
18+
19+
print(grow_string('Code'))
20+
21+
print(grow_string('abc'))
22+
23+
print(grow_string('ab'))
1324

1425

1526

Section_04/assignment_05.py

+9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@
1414
"""
1515

1616
# Your Code Below:
17+
def first3(lst):
18+
first_four=lst[:4]
19+
return 6 in first_four
1720

1821

22+
print(first3([1, 2, 6, 3, 4]))
23+
24+
print(first3([1, 2, 3, 4, 6]))
25+
26+
print(first3([1, 2, 3, 4, 5]))
27+
1928

2029

2130

0 commit comments

Comments
 (0)