Created
November 6, 2016 22:56
-
-
Save noveoko/6326a88955ca370c6d83ad49bdda7fb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Solution to Problem 1: | |
k = [[a for a in range(0,100) if a % 2 == 0]] | |
#Solution to Problem 2: | |
def generate_list(): | |
k = [] | |
for a in range(0,101): | |
k.append(list(range(0,101))) | |
return k | |
k = generate_list() | |
for i, a in enumerate(k): | |
total = sum(a[0:i+1]) | |
a.append(total) | |
print(a[-1]) | |
print(len(k)) | |
#Solution to Problem 3: | |
d = {1: 'Poniedziałek', | |
2: 'Wtorek', | |
3: 'Środa', | |
4: 'Czwartek', | |
5: 'Piątek', | |
6: 'Sobota', | |
7: 'Niedziela', | |
} | |
print(d) | |
def flip_dict(dictToFlip): | |
my_dict2 = dict((y,x) for x,y in dictToFlip.items()) | |
keys = [k for k, v in d.items() if k % 2 == 0] | |
for a in keys: | |
del dictToFlip[a] | |
return my_dict2 | |
# Solution to problem 4: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment