nkd.2195
BAN USERdef compare(str1,str2):
a=len(str1)
b=len(str2)
temp=min(a,b)
for i in range(temp):
if(str1[i]<str2[i]):
return str2
if(str1[i]>str2[i]):
return str1
if(str1[i]==str2[i]):
continue
if(a<b):
return str1
else:
return str2
Here is my code which i think works fine. The problem is that i am not able to use it properly in this problem. The main (or rest of the implementation of my program) is below. Please check the code below and tell me where i am wrong.
array=[]
arr=[]
final=[None] * 5
array=input()
str3=''
arr=map(str,array)
length=len(arr)
print(array)
print(arr)
for i in range(0,length):
count=length-1
for j in range(0,length):
srt3 = str(compare(arr[i],arr[j]))
print(str3)
if(str3 == arr[i]):
count=count-1
print(count)
final[count]=arr[i]
print(final)
My compare function works fine . But i dont know what to do with the rest of the program. can u help?
- nkd.2195 November 22, 2015