fork download
  1. # cook your dish here
  2. #Coded by Zoheb
  3.  
  4. #Ice-cream vending machine
  5.  
  6. p = int(input())
  7. while p > 0:
  8. a = int(input())
  9. if a == 1:
  10. x = 7 #Cup
  11. elif a == 2:
  12. x = 10 #Cone
  13.  
  14. n = int(input())
  15.  
  16.  
  17. f = map(int,input().split()) #Choose flavour of the scoop
  18. f = list(f)
  19. for i in range(0,n):
  20. if f[i] == 1:
  21. x = x + 30 #Strawberry
  22. elif f[i] == 2:
  23. x = x + 20 #Vanila
  24. elif f[i] == 3:
  25. x = x + 30 #Mango
  26. elif f[i] == 4:
  27. x = x + 50 #Oreo
  28. elif f[i] == 5:
  29. x = x + 40 #Choclate
  30.  
  31. if n > 3: #Number of scoops
  32. print("Invalid Entry")
  33. p = p - 1
  34. continue
  35. print(x)
  36. p = p - 1
Success #stdin #stdout 0.02s 9244KB
stdin
2
1
3
2 2 4
2
4
1 2 3 4
stdout
97
Invalid Entry