Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

What is the value of pairs after the following assignment?

pairs = [ (x,y) for x in range(5,1,-1) for y in range(4,1,-1) if (x+y)%3 == 0 ]
Dictionary company started an app which does not store the words initially,and once a word comes it stores and shows the repeated one.need to write a function which returns the words that are repeated.if no words are present return"na" ,if present,return repeated woŕds in alphabetical order
Reverse a string count the position of character same after reversed a string
Ex:abdrxxhga
Reversed string:aghxxrdba
Axxa are same position so count is 4
Count:4

Denominations - 3

Write a program to find the minimum number of notes required for the amount M. Available note denominations are 500, 50, 10, 1.

Input

The first line is a single integer M.

Output

Print M in denominaitons.

Explanation

Given

M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be

500: 3 50: 0 10: 4 1: 3

Sample Input 1

1543

Sample Output 1

500: 3 50: 0 10: 4 1: 3

Sample Input 2

1259

Sample Output 2

500: 2 50: 5 10: 0 1: 9




A chemical produces a certain energy at a constant, rate for every second showing the amount of energy generated for every second for a period of time s.
Ex.intial energy=2
Rate=4
Time(secs)=3

Denominations - 4

Write a program to find the minimum number of notes required for the amount M. Available note denominations are 2000, 500, 200, 50, 20, 5, 2, 1.Input

The first line is a single integer M.

Output

Print M in denominations.

Explanation

Given

M = 2257 Then 2257 can be written as

2000 * 1 + 500 * 0 + 200 * 1 + 50 * 1 + 20 * 0 + 5 * 1 + 2 * 1 + 1 * 0So the output should be

2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0.

Sample Input 1

2257

Sample Output 1

2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0

Sample Input 2

2345

Sample Output 2

2000:1 500:0 200:1 50:2 20:2 5:1 2:0 1:0




Total number of units of memory allocated/deallocated by the server?
Given a string needs to count the characters except number,small letters,ipper letters and spaces?
Eg i/p- ancSddhk#adjdl
O/p-3
I was given inputs as 10,9,8,7
I get maximum number as 9. How to solve this problem

Prefix Suffix

Write a program to check the overlapping of one string's suffix with the prefix of another string.

Input

The first line of the input will contain a string A.

The second line of the input will contain a string B.

Output

The output should contain overlapping word if present else print "No overlapping".

Explanation

For example, if the given two strings, A and B, are "ramisgood" "goodforall"

The output should be "good" as good overlaps as a suffix of the first string and prefix of next.

Sample Input 1

ramisgood

goodforall

Sample Output 1

good

Sample Input 2

finally

restforall

Sample Output 2

No overlapping




LATEST TUTORIALS
APPROVED BY CLIENTS