Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

listing ticket prices in front of provided options in python

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading