Yash has a sequence of 26 distinct integers P = (P₁, P2, ..., P26)
consisting of integers from 1 to 26. He constructs a string
S following the below rule:
• For every i where (1 <=i<= 26), the i-th character of
S is the lowercase English letter at comes P₁-th in
alphabetical order.
Your task is to output the resultant string S
Proper Fractions
Given 2 fractional values A/C. B/D where A, B are numerators and C. D are denominators. You are asked to add two fractional values. If the sum gives proper fraction as output print the proper fraction. If it is improper, convert it into a mixed fraction and print it. If it is a whole number, print it.
Input
The first line of input contains two space-separated strings A/C &B/D
Output
The output should be a string of format p/q if the result is a proper fraction
a b/c if the result is a improper or med fraction
a if the result is a whole number
Discount Sale
It is a Summer Discount sale in Mumbai and all the local shops have put up various offers. Arjun selected N items to buy. While standing in the billing queue, he noticed the offer "Buy two! Get two FREE!!". This means that for every two items he buys, they give him two items for free. However, items can be of varying prices, they always charge for the two most costly items and give the other two as free. For example, if the items cost 1, 1, 2, 2, then you have to pay four rupees and take all four items.
Arjun is confused with grouping his items to reduce the total price ho has to pay. Your task is to find the minimum price Arjun has to pay to buy all the N items.
def calculate_vat(amount):
amount * 1.2
total = calculate_vat(100)
print(total)
When your boss runs the program they get the following output:
None
Your boss expects the program to output the value 120 . What is wrong? How do you fix it?
given a list of M numbers and a positive integer N, print the sum of numbers whose position in the list is divisible by N. consider that the positions of numbers range from 1 to N.
Explanation : Given N = 1, M= 7 and the numbers_list = [4, 8, 6, 6, 7, 9,3]
as every position is divisible by 1, 4+8+6+6+7+9+3=43
so, output is 43
Input : 1 7
4 8 6 6 7 9 3
Output : 43
Input : 4 13
7 3 10 4 5 8 4 9 6 9 10 1 4
Output : 14
Nicholas is trying to invent a light bulb. he has to discover the right gaseous mixture that can be used to fill the bulb so that the bulb works underwater. He has prepared N gaseous mixture numbered from 0 to n-1 to check . Nicholas does not know which this gases will work, but to use a modulo-based search algorithm to keep checking different gas mixtures. So 1st chooses an integer K and select all indices i in increasing order such that i mod k= 0 (i%K==0) and tests the gases on such indices, then all indices in increasing order such that i mod k=1 and test the gases on such indices and so on.
Input:Test cases
test case contains N, P and K
output:no.of days taken
N=10 P=6 K=5
On the day1,Nicholas Will test gas numbered 0 as 0 mod 5=0,
On the day2, Nicholas Will test gas numbered 5 as 5 mod 5=0,
On the day3, Nicholas Will test gas numbered 1 as 1 mod 5=1,
On the day4, Nicholas Will test gas numbered 6 as 6 mod 5=1,
Nicolas test the gas number 6 on day 4 so the output is 4
Input:
2
10 6 5
5 2 3
Output:
4
5
snake format
Create any program using python programming language. Use at least 10 Python built-in functions. Submit the program file of your program ( .py) for those who uses desktop or laptop in code and screenshot of the code and output for those who uses phones to code.
-write a program using for loop - show numbers from(1,150)increased by 3 only print odd numbers
Implement the following problem statement in python along with test cases. Let’s say you have a Customer class and you want to test calculate bill method of customer class. Bill calculation will depend on list of items customer purchased