There are N intermediate stations between two places A and B. Find the number of ways in which a train can be made to stop at S number of these intermediate stations so that no two stopping stations are consecutive. Write a python module Station.py for above and import the module in RollNo_W12B_3.py. In RollNo_W12B_3.py, define a function Get_Stations(N, S) which takes value of N & S and return integer result as shown in example by calling the appropriate function implemented in Station.py module. Also handle the possible exceptions and display the exception message in form of string.
Example-1
Example-2
Example-3
Input:
12
4
Output:
126
Input:
16
5
Output:
792
Input:
2
4
Output:
Earthquake python program. shreya is learing about earthquakes and stumbles accroess an interesting fact: the magnitude of on earthquake is a logarithmic scale of the energy realeased by the earthquake. it is known that each time the magnitude increases by 1, the amount of energy ets multiplied by 32. your tas is to help shreya by determining, how many times is the amount of energy of a magnitude a earthquake compared to that of a magnitude B earthquake?
I/p : a=6 & b=4, 6 is 2 greater than 4, so a magnitude 6 earthquake has 32*32=1024 times as much energy as a magnitude 4 earthquake has. so, the output is 1024
Input : 6 4
O/p: 1024
I/p: 5 5
O/p: 1
Kalinjar Fort is a popular tourist place in Bundelkhand, Utter Pradesh. Everyday peoples registered to visit Fort as token provided based on first come basis. Everyday limited numbers of peoples are allowed to visit. The management selects a number N1 randomly every day and generates another number N2 as count of the total number of set bits (i.e., total no. of 1s) in binary representation of all numbers from 1 to N1. For example, N1=3 then N2=4 [1(01) +2(10) +3(11)]. So, write a python module CountBit.py to find N2 using N1. You need to import this module in RollNo_W12B_2.py. In RollNo_W12B_2.py, define a function Get_Token(n) which takes a number and return value as shown in example by calling the appropriate function implemented in CountBit.py module.
Example-1
Example-2
Example-3
Input:
3
Output:
4
Input:
7
Output:
12Input:
8
Output:
13
Given a string of numbers S, the task is to find the maximum value from the string S, you can add a ‘+’ or ‘*’ sign between any two numbers.
For example, S=891. As 8*9*1 = 72 and 8*9+1 = 73. So, 73 is maximum.
Write a python module MaxValue.py for solve the above task. You need to import this module in RollNo_W12B_1.py. In RollNo_W12B_1.py, define a function Find_Max(n) which takes a string and return maximum value or error message as shown in example by calling the appropriate function implemented in MaxValue.py module. Also handle the possible exceptions and display the exception message in form of string.
Example-1
Example-2
Example-3
Example-4
Input:
01231
Output:
10
Input:
891
Output:
73
Input:
0000
Output:
Input:
45f
Output:
Invalid Number
Write a program whose inputs are three integers, and whose output is the smallest of the three values.
Create a simple Python Program about concert ticketing system that allows users who are 18 years old to buy tickets. The ticket prices are as follows.
VIP- 4,500
Patron- 3500
Box regular- 2500
1.9.
1.9.1 In a main class, instantiate one object of Type Retail. [2] 1.9.2 Instantiate two objects of each Item [Drink, Detergent, Diary] you can use your own instance variables. [2] 1.9.3 Using the Retail shop method, add these items in the Item stock. [2] 1.9.4 Display the available stock.
1.7 All Items have item name, item size, item price, expiryDate (use LocalDate class for this) . Item fall into the following categories: Drink, Diary, and Detergent.
Drink items have an additional variable a string that shows what type of drink : “fizzy drink” and “fruit drink”.
Dairy has storage Temperature, this is a recommended storage temperature.
Detergent have a string indicating “liquid” or “powder” or “bar”. [5] 1.8 Item has function to view number of days left before expiry. viewExpiry( )
returns an int number of days left before expiry. [2] If this number is less than or equal to 1, print in capital letters that ITEM EXPIRED
A retail shop have functionality to sell. The sell function must take item name, and size as a parameter. Removes the item from the stock and put that Item in the sold list. The sell function also displays the sold item details, name, size, and days before expiry date. [2] If item is not available in the stock a message must be displayed on the screen “no stock”;
1.6 An Items class need to be created in order to implement a complete Retail Shop. All items MUST/ FORCED to have the getPrice() function returns price of an item , setPrice(double price), returns nothing, but set a price of an Item.
1.1 A Retail has name, a List containing Items available in the stock and another List containing sold items. [2] 1.2 A Retail have functionality to view available stock, that prints Class name of item, name of Item, size of item and total number of items that have same name, and size. [5] EXAMPLE
ClassName Item name Size Drink coke 1 Drink coke 2
Total
10; // this show that in the list there are 10 coke that are size of 1
5; // this show that in the list there are 5 coke that are size 2 Sizes in drinks means litres.
Hint: Items are the same if their class name, item name and size are the same.
1.3. A retail Shop has a functionality to add item into the stock list. The add item takes a parameter the Item to be added on stock. [2] 1.4 A retail shop also has a functionality to calculate total sales that returns double sum of money made from all sold items. [2]