Average of the given numbers
The value of a%b is 3 and the value of b%a is 1 as the smallest of the two is 1 so the out putbe 1
Sample output
3
7
Sampleinput
1
Write a program to print the following output.
Input
The first line contains a string.
The second line contains some space-separated strings.
Output
The output should be a single integer.
Explanation
scramble word = "tacren"
guessed words = ["trance", "recant"]
Since "trance" and "recant" both have length 6 then you score 54 pts each.
So the output is 108.
Sample Input1
rceast
cat create sat
Sample Output1
2
Sample Input2
tacren
trance recant
Sample Output2
108
Write a python program to print the following output.
Input
The first line of input contains a single line positive integer N.
The second line of input contains a space-separated integers denoting the cost of the item.
Output
The output is a single line integer.
Explanation
For example, Given N = 2 and cost = 10 200
Ram has to pay for both the items, he won't get anything for free.
So the output is 210.
Sample Input1
4
1 1 2 2
Sample Output1
4
Sample Input2
2
10 200
Sample Output2
210
Write code to load data from cars.csv into a dataframe and print its details. Details like: 'count', 'mean', 'std', 'min', '25%', '50%', '75%', 'max'.
You are given n inputs, write a program to print the first prime number in the given inputs.
In the given example of 5 integers.
5
1
10
4
3
2
Output should be
3
Write a program to print the following output.
Input
The first line contains a string.
The second line contains some space-separated strings.
Output
The output should be a single integer.
Explanation
scramble word = "tacren"
guessed words = ["trance", "recant"]
Since "trance" and "recant" both have length 6 then you score 54 pts each.
So the output is 108.
Sample Input1
tacren
trance recant
Sample Output1
108
Sample Input2
rceast
cat create sat
Sample Output2
2
Python Program
Write a program to print the following, Given a word W and pattern P, you need to check whether the pattern matches the given word.The word will only contain letters(can be Uppercase and Lowercase). The pattern can contain letters, ? and *.
? : Can be matched with any single letter.
* : Can be matched with any sequence of letters (including an empty sequence).
If the pattern matches with the given word, print True else False.
Sample Input1
3
Hello *l?
Hell He?ll
Hell ?*
Sample Output1
True
False
True
Sample Input1
3
Hello Hell*
Hell He*ll
Hell hell*
Sample Output1
True
True
False
Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False.
Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates.
Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following.
aaa has duplicates
abc has no duplicates
Print a line like one of the above for each of the strings in test_dups.
Date Format - 2
Given seconds as input, write a program to print in D days H hours M minutes S seconds.
Input
The input will be a single line containing an integer.
Output
The output should be a single line containing the D Days H Hours M Minutes S Seconds format. Print only the non-zero values.
Explanation
For example, if the given seconds are 200. As 200 seconds is equal to 3 minutes and 20 seconds, and days, hours are zero, so ignore the days and hours. So the output should be "3 Minutes 20 Seconds"
Sample Input 1
200
Sample Output 1
3 Minutes 20 Seconds
Sample Input 2
86400
Sample Output 2
1 Days