+ 3

Izzy the iguana

My code fails at the case 4 and 5... I need help ✋🏻 https://sololearn.com/compiler-playground/c3Kavs5Nl45o/?ref=app

24th Apr 2024, 4:36 PM
Solo Soul
Solo Soul - avatar
7 Antworten
+ 6
Solo Soul , just a hint about the code line: str=input() the variable name `str`, that is used to store the input text from the user, is also a builtin class in python, that will be redefined / reassigned by the code . in the current case it does not matter. but if string methods would be used in the code, we can get an unexpected behavior and the program will crash. so take care about the variable names that are used.
24th Apr 2024, 6:35 PM
Lothar
Lothar - avatar
+ 1
Bro it still fails the same test cases 4,5 😕
24th Apr 2024, 4:58 PM
Solo Soul
Solo Soul - avatar
+ 1
Solo Soul , I was going to help, but those 1-space indentations are too hard on the eyes. Be kind to your readers and use four spaces.
25th Apr 2024, 3:09 AM
Rain
Rain - avatar
+ 1
It works with this code
29th Apr 2024, 4:20 AM
Solo Soul
Solo Soul - avatar
0
It comes from the loop it's on each character of the string 'str' instead of the separate words. you need to replace str with word
24th Apr 2024, 4:45 PM
piano T
0
you only need to replace the str loop with world and the other str linked to a condition must be replaced by the loop variable you must not use in 'in' the condition it has to be like this ‘ if “Mango” == i : ’ for example
24th Apr 2024, 5:18 PM
piano T