Home > front end >  listing ticket prices in front of provided options in python
listing ticket prices in front of provided options in python

Time:12-06

im writing this code as practice for wildlife park to sell tickets. i need to place the prices of each available option in front of the option but cant figure out how to do it. this is the code:

tickettype = ['one adult', 'onechild', 'one senior', 'family ticket', 'group of six or more']
cost1day = [20,12,16,60, 15]

for A in tickettype:
    print(A)
for B in cost1day:
    print(B)

its output is like this

one adult
onechild
one senior
family ticket
group of six or more
20
12
16
60
15

whereas i need both list aligned in front of each other.

CodePudding user response:

Here's an option.

tickettype = ['one adult', 'onechild', 'one senior', 'family ticket', 'group of six or more']
cost1day = [20,12,16,60, 15]

for A,B in zip(tickettype,cost1day):
    print(A ":" str(b))
  • Related