Apr-08-2022, 05:47 AM
Here's the snippet;
I tried many ways, but to no avail.
The main goal:
Get value of adults,
Multiply it with the price in the list,
Output ticket cost.
Thanks for helping, Kind soul.
oneday = [20.00, 12.00, 16.00, 60.00, 15.00] twoday = [30.00, 18.00, 24.00, 90.00, 22.50] vdays = 1 ttype = 0 global ticket_cost ticket_cost = 0 def func_adult_tic(): adult = int(input('Enter No. of adult tickets needed : ')) if vdays == 1: ticket_cost += (adult * float(oneday[ttype])) else: ticket_cost += (adult * float(twoday[ttype])) func_adult_tic() print(ticket_cost)Why doesnt the value of
ticket_cost
change?I tried many ways, but to no avail.
The main goal:
Get value of adults,
Multiply it with the price in the list,
Output ticket cost.
Thanks for helping, Kind soul.