Python Assignment-2
Python Assignment-2
Apart from the cost per plate of food, customers are also charged for
home delivery based on the distance in kms from the restaurant to the
delivery point. The delivery charges are as mentioned below:
Given the type of food, quantity (no. of plates) and the distance in kms
from the restaurant to the delivery point, write a python program to
calculate the final bill amount to be paid by a customer.
The below information must be used to check the validity of the data
provided by the customer:
Type of food must be ‘V’ for vegetarian and ‘N’ for non-vegetarian.
Distance in kms must be greater than 0.
Quantity ordered should be minimum 1.
If any of the input is invalid, the bill amount should be considered as -1.
The program should return the list of ticket numbers of last five
passengers.
Note: If passenger count is less than 5, return the list of all generated
ticket numbers.
airline = AI
source = Bangalore
destination = London
no_of_passengers = 10 ['AI:Ban:Lon:106', 'AI:Ban:Lon:107',
'AI:Ban:Lon:108', 'AI:Ban:Lon:109',
'AI:Ban:Lon:110']
airline = BA
source = Australia
destination = France
no_of_passengers = 2 ['BA:Aus:Fra:101', 'BA:Aus:Fra:102']
Write a function to find the medical speciality visited by the maximum number of
patients and return the name of the speciality.
Also write the pytest test cases to test the program.
Note:
Assume that there is always only one medical speciality which is visited by
maximum number of patients.
Perform case sensitive string comparison wherever necessary.
Write a python function which performs the run length encoding for a given
String and returns the run length encoded String.
AAAABBBBCCCCCCCC 4A4B8C
AABCCA 2A1B2C1A