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))
7 Antworten
+ 3
Just for safety: color =input().title()
+ 2
I entered "Blue" and got 36. What do you want to get? Idk
+ 1
It does what it's supposed to do. What is the expected output?
+ 1
It didn't always return 16 for me
+ 1
Maybe when you put the I put in you spelt it wrong? Because the code works as it should when I tried it 🙂
+ 1
*when you put the input in
0
depending on the input (color) it should return the value of print... but it always returns 16 (else value)