I give up🫠 the code works but apparently there's a hidden error (safety Deposit boxes challenge in community) can anyone help | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

I give up🫠 the code works but apparently there's a hidden error (safety Deposit boxes challenge in community) can anyone help

#Declare item being searched and assign time to 0 boxes = input() specific_items = input() time_needed = 0 indexOfItem = boxes.rindex(specific_items); #copies substring plus +1 newBox = boxes[0:indexOfItem+len(specific_items )+1] # if(newBox.count(",") != 0): newTime = newBox.count(",")*5 else : newTime = newBox*5 print(newTime)

17th Jul 2023, 7:30 PM
Indiphile Menziwa
Indiphile Menziwa - avatar
3 Antworten
+ 2
** don't put any argument to input(). Just use boxes = input() specific_item = input()
18th Jul 2023, 3:48 AM
Jayakrishna 🇮🇳
+ 1
Ok. Your else part has no use actually.. And if specific_item is the last word in boxes then it prints 5 less value...
19th Jul 2023, 6:22 PM
Jayakrishna 🇮🇳
0
oh sorry That was for the example on my code there's no argument plus it works just that it has a hidden error...
18th Jul 2023, 1:20 PM
Indiphile Menziwa
Indiphile Menziwa - avatar