Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 90 - 2615_KEC
P. 90

    Program13.py
                       File  Edit  Format    Run   Options   Window    Help

                       # Ticket Vending Machine
                       # Price of ticket is Rs. 200 is age is between 10 to 20.
                       # Price of ticket is Rs. 350 is age is between 20 to 60.
                       # Price of ticket is Rs. 300 is age is greater than 60.
                       age = int(input("Enter your age: "))

                       if (age>10 and age<20):
                           print("The price of the ticket is Rs. 200.")
                       elif (age>20 and age<60):
                           print("The price of the ticket is Rs. 350.")
                       elif (age>60):
                           print("Ihe price of the ticket is Rs. 300.")
                       else:
                           print("No need of ticket.")

                          Output

                       Enter your age: 25
                       The price of the ticket is Rs. 350.

                      Program 14: To create a number pattern using for loop

                          Program14.py
                       File  Edit  Format    Run   Options   Window    Help

                       #Program to create number pattern using for loop

                       for i in range(1,5):
                           print('3' * i)

                          Output

                       3
                       33
                       333
                       3333

                       88   Premium Edition-VIII

| 85 86 87 88 89 90 91 92 93 94 95 |