Last active
March 17, 2017 19:57
-
-
Save xie/b9c59298b206dcac938732ca70990142 to your computer and use it in GitHub Desktop.
This is the rundown for what I got.
This file contains hidden or 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
####Last Question#### | |
def counter(str1): | |
a = {} | |
templist = [] | |
templist = str1.split() | |
print(templist) | |
for i in templist: | |
print(i) | |
if i in a: | |
a[i] = a.get(i,0)+1 | |
else: | |
a[i] = a.get(i,0) + 1 | |
return a | |
print(counter(test)) | |
#### | |
####arereversed#### | |
list1 = [1,2,3,4,5] | |
list2 = [5,4,3,2,1] | |
def arereversed(list1,list2): | |
check = False | |
for i in range(len(list1)): | |
if (list1[i] != list2[-1-i]) or (list1[-1-i]!=list2[i]): | |
check = False | |
else: | |
check = True | |
return check | |
print(arereversed(list1,list2)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment