Why don't work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why don't work?

data = [ [23, 11, 5, 14], [8, 32, 20, 5] ] color = input() total = 23+11+5+14+8+32+20+5 if color=="Blue": print(int(((data[0][1]+data[1][1])*100)/total)) elif color=="Brown": print(int(((data[0][0]+data[1][0])*100)/total)) elif color=="Green": print(int(((data[0][2]+data[1][2])*100)/total)) else: print(int(((data[0][3]+data[1][3])*100)/total))

27th Jul 2022, 7:10 PM
Hugo Matrangulo
Hugo Matrangulo - avatar
7 Answers
+ 3
Just for safety: color =input().title()
27th Jul 2022, 8:04 PM
Oma Falk
Oma Falk - avatar
+ 2
I entered "Blue" and got 36. What do you want to get? Idk
27th Jul 2022, 7:27 PM
Slick
Slick - avatar
+ 1
It does what it's supposed to do. What is the expected output?
27th Jul 2022, 7:13 PM
Slick
Slick - avatar
+ 1
It didn't always return 16 for me
29th Jul 2022, 1:14 PM
Gabby
+ 1
Maybe when you put the I put in you spelt it wrong? Because the code works as it should when I tried it 🙂
29th Jul 2022, 1:14 PM
Gabby
+ 1
*when you put the input in
29th Jul 2022, 1:15 PM
Gabby
0
depending on the input (color) it should return the value of print... but it always returns 16 (else value)
27th Jul 2022, 7:18 PM
Hugo Matrangulo
Hugo Matrangulo - avatar