Having problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Having problem

Tell me the problem in it https://code.sololearn.com/cyrv2e3ha7DF/?ref=app

8th Jun 2020, 7:46 PM
Aditya Salabh
Aditya Salabh - avatar
13 Answers
+ 3
I m not sure if it is correct or not. But taking input =banana Output =Aditya https://code.sololearn.com/cMj4eQ7OrwqL/?ref=app
8th Jun 2020, 8:48 PM
SOUMYA
SOUMYA - avatar
+ 4
That's is just link to your post ,instead insert your code using insert code option for description,
8th Jun 2020, 7:54 PM
Abhay
Abhay - avatar
+ 3
Thanku ✌️
9th Jun 2020, 9:37 AM
Aditya Salabh
Aditya Salabh - avatar
+ 3
Aditya Salabh. 𝕊𝕆𝕌𝕄𝕐𝔸 𝕊𝔸ℍ𝕌 Hello the problem is the wrong indentation done in the for block: #Your code for i in range(len(string)): if string[i] not in v: s1= s1 +len(string)-i else: s2=s2 +len(string)-i if s1>s2: print("winner is"+n) elif s2>s1: print ("winner is "+b) else: print ("draw") You see from the if everything is badly indented. You change that to: for i in range(len(string)): if string[i] not in v: s1= s1 +len(string)-i else: s2=s2 +len(string)-i if s1>s2: print("winner is"+n) elif s2>s1: print ("winner is "+b) else: print ("draw") To this corrected code here you see that. The problem of indentation is solved and your code will run successfully 😃😃
9th Jun 2020, 10:54 PM
Josaphat NGOGA UWIZEYE
Josaphat NGOGA UWIZEYE - avatar
+ 2
Hello Aditya Salabh Please share the link only in the description. In the title or tag it is not clickable.
8th Jun 2020, 7:58 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
What u changed in it....?????
9th Jun 2020, 4:47 AM
Aditya Salabh
Aditya Salabh - avatar
+ 2
There was intention issue in your code. That only I have corrected.
9th Jun 2020, 9:22 AM
SOUMYA
SOUMYA - avatar
+ 2
Check the code that I have commented earlier.In that I have mentioned the reason why it gave error.
9th Jun 2020, 9:30 AM
SOUMYA
SOUMYA - avatar
8th Jun 2020, 7:58 PM
Aditya Salabh
Aditya Salabh - avatar
+ 1
Not getting how to define can anyone make it correct
8th Jun 2020, 8:30 PM
Aditya Salabh
Aditya Salabh - avatar
+ 1
Input :banana OUTPUT: Aditya
8th Jun 2020, 8:36 PM
Aditya Salabh
Aditya Salabh - avatar
+ 1
Indententation is important Try to use TAB def game_nin(string): s1=0 s2=0 v=str("aeiou") n=str("aditya") print(n) b=str("sweta") print(b) for i in range(len(string)): if string[i] not in v: s1= s1 +len(string)-i else: s2=s2 +len(string)-i if s1>s2: print("winner is"+n) elif s2>s1: print ("winner is "+b) else: print ("draw") # n=str(input("enter the name:")) # a=str(input("enter the string:")) string=str(input()) game_nin(string)
10th Jun 2020, 5:58 PM
Faisal Shaikh
0
✌️✌️👍
10th Jun 2020, 4:01 AM
Aditya Salabh
Aditya Salabh - avatar