Write a python program to calculate the fare and discount for the passengers travelling in a bus. When a Passenger enters the bus, the program, will determine the traveling kilometer knowing distance from passenger (as an approximate integer) the conductor mentions the fare to the passenger according to following criteria below using control structure in python code.The program will also calculate the passenger 20% discount for students ,PWD and senior citizen passenger.
5KM- 25.00
5-10KM – 30.00
10-30KM – 50.00
30-50KM -100.00
50-80KM – 150.00
80-100KM – 250.00
The Error of this code is expected an intended block
kindly check and show the correct code
class AddColumn:
def add_column(str1,list1):
dict1[str1].append(list1)
x=AddColumn()
x.add_column( "City name",["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])
x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])
x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])
x.add_column("Annual Rainfall"[600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])
print(dict1)
The error of this code is Expected an indented block.
kindly check and show the correct code
main_list = []
x = {}
field_names = [ "City name", "Area", "Population", "Annual Rainfall"]
list1 = [
["Adelaide", 1295, 1158259, 600.5],
["Brisbane", 5905, 1857594, 1146.4],
[ "Darwin", 112, 120900, 1714.7],
["Hobart", 135, 20556, 619.5],
["Sydney", 2058, 4336374, 1214.8],
["Melbourne", 1566, 3806092, 646.9],
["Perth", 5386, 1554769, 869.4]
]
for i in range(0, len(list1)):
for key in field_names:
for value in list1[i]:
x[key] = value
list1[i].remove(value)
break
main_list.append(x)
print(main_list)
We are starting a new children's entertainment software company
Our first application will be old Macdonald's farm
Initially children can put three types of animals
Modify the program by creating an array of n objects using
pointers. Show the details of n items by using pointers to object concept.
(Pointers to objects)
Define a class 'Item' that is used to store and display the information regarding the item
number and its price. Write a program to store and display the details of one
items by using both normal object and pointer to object separately. Display
appropriate message wherever necessary.
Write a program for:
Searching a word present in a sentence or not, if present print its location with a successful note.
The problem with this code is No module named 'prettytable'
can you show the correct code?
table = PrettyTable()
table.field_names = ["pokemon name", "type"]
table.add_row(["pikachu", "Electric"])
table.add_row(["sydney", "Dark"])
table.add_row(["charmander", "Fire"])
table.add_row(["squite", "Water"])
print(table)
Write a program to implement the Merge sort algorithm with the space optimization for
auxiliary space O(n/2).
Using while or do while. An ordinary colored printer can print 12 pages per minute. Make a program that will input number of pages, and compute the time to complete the print out. Consider the minutes and hour of your display. Your program will terminate if you input zero in the number of pages.
(minutes =no.pages /12) Ex: Input pages : 720
Minutes = 60 Hour= 1