In this lab, you complete a partially written Python program for an airline that offers a 25% discount to passengers who are 6 years old or younger and the same discount to passengers who are 65 years old or older. The program should request a passenger’s name and age, and then print whether the passenger is eligible or not eligible for a discount.

Respuesta :

Following are the python program to calculate discount by input age value:

Program Explanation:

  • Defining two-variable "passengerName and ageString" that uses an input method to inputs string value init.
  • In the next step, another variable "passengerAge" is declared that uses an int method to convert "ageString" value into an integer.
  • After converting the string into integer a conditional statement is used that check age value is between 6 to 65, and use print method to print message.  

Program:

passengerName=input("Enter passenger's name: ")#Defining a variable passengerAge that inputs sting value

ageString=input("Enter passenger's age: ")#Defining a variable ageString that inputs string value

passengerAge=int(ageString)#defining a variable passengerAge that converts string into integer value

if passengerAge<=6 or passengerAge >=65:#use if that checks passenger age in between 6 to 65  

   print("passenger is eligible for a discount of 25%")#print message

else:#else block

   print("passenger is not eligible for a discount of 25%")#print message

Output:

Please find the attached file.

Learn more:

brainly.com/question/6503092

Ver imagen codiepienagoya
ACCESS MORE
EDU ACCESS
Universidad de Mexico