+ 1
Works fine for the example, but test cases will probably have different number of prices. Change your code to a loop, so you don't have to use numbered variables
+ 1
Well that was not what I meant.
Your code is expecting exactly 4 prices, which isn't necessarily the case. Generally you don't want to use either numbered variables (price1, price2, ...) or hard coded indices in your code because it should work for arrays (and List etc.) of arbitrary length.
Have a look at this solution and try to understand the for loop:
https://code.sololearn.com/ca0A0A13A18A
I also included a more advanced solution to calculate the dollar prices in one line. It uses Linq and lambda expression, two great features of C# that lead to shorter and more expressive code
0
👍 Glad i could help
0
Python solution
res = input()
res = res .split()
res = [eval(i) for i in res ]
k=0
for i in res :
j = i *1.1
if j >20:
k += 1
if k == 0:
print("On to the terminal")
else:
print("Back to the store")



