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

IPL Match Details



Write a program that reads all the match outcomes and summarizes the information of all the matches.


Points are given to the terms based on the outcome of the match.


A win earns a team 3 points.A draw earns 1.A loss earns 0.


The following information is expected:


MP:Matches Played


W:Matches Won


D:Matches Drawn(Tied)


L:Matches Lost


P:Points



The team information should be displayed in descending order of points.



Sample input 1


6


CSK;RR;loss


RR;DD;draw


MI;KKR;win


KKR;RR;loss


CSK;DD;draw


MI;DD; draw



Sample output 1


Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7


Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4


Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3


Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1


Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0

IPL Match Details



Write a program that reads all the match outcomes and summarizes the information of all the matches.


Points are given to the terms based on the outcome of the match.


A win earns a team 3 points.A draw earns 1.A loss earns 0.


The following information is expected:


MP:Matches Played


W:Matches Won


D:Matches Drawn(Tied)


L:Matches Lost


P:Points



The team information should be displayed in descending order of points.



Sample input 1


6


CSK;RR;loss


RR;DD;draw


MI;KKR;win


KKR;RR;loss


CSK;DD;draw


MI;DD; draw



Sample output 1


Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7


Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4


Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3


Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1


Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0

pythagoras triplets


a pythagoras triplet is a set of three integers a,b,and c such that a2 + b2 = c2 in the given limit L ,find the number of pythagoras triplets R that can be formed (such that a<b<c)



for L = 20 pythagoras triplets satisfying the condition a<b<c


(3,4,5),(6,8,10),(5,12,13),(9,12,15),(8,15,17),(12,16,20).



hence output is 6




1) input is 5



output is 1



2) input is 20



output is 6



Don't you find it amazing to discover words and sentences that have the same first and last letter? We just don't usually notice them, so we can try it out by coding out this problem instead! Print out "Yes" if the first and last characters of the given string are the same, and "No" otherwise. It doesn't matter if they're in lowercase or uppercase, as long as it's the same letter, it fits the description.

So, what are you waiting for? Code now!


Input

A line containing a string.

Pop·it·up

Output

A line containing a string.

Yes





composite numbers in the range


you are given two integers m and n .write a program to print all the composite numbers between m and n, (including m and n)


1)inputs are 2 and 9


in the given example the composite numbers present in range of 2 and 9 are 4,6,8,9

the output is

4

6

8

9



2)inputs are 1 and 4

the output is

4

In a wedding that you are attending, there are some chairs that have digits inscribed at their



backs. The chairs are lined in a row such that they form a string of the digits. Find the



minimum number of sets M that can be formed from these digits such that:



1. The number of digits in each set is one gf more than one.



2. Each set is formed using consecutive digits and no digit can be used more than once.



3. In each set, the number formed using the digits is less than or equal to Y. using three inputs

given an integer N the task to find the minimum absoulte difference between N and a closest N number power of 2


Ascend!

by CodeChum Admin

Hey I’ve got this cool idea for an app! It’s kind of simple but just hear me out. All the user has to do is enter a bunch of integers. Then the application prints the largest sum of a strictly ascending sequence of the array. A strictly ascending sequence is a sequence where the current number is always lesser than the next number. 


For example, the user enters 2 4 5 1 7 3, the output should be 11 (2 + 4 + 5).


Then that’s it! I think this is going to be a hit! Don’t you think? Well I do. If you help me then we’re going to be rich!


Note: For this problem, a sequence must contain at least 2 numbers. If there is no sequence found, then the largest sum is 0.

Input


1. The size of the array


Constraints

The value is within the range: 0 <= size <= 2147483647

2. Elements of the array


Constraints

Each element <= 2147483647 and >= 0

Output


5. Big-Sightedness

by CodeChum Admin

I got my grandmother a new phone because I thought that we could talk more everyday by texting. Well, let’s just say that my grandma’s eyes aren’t the best anymore so she can’t really see what I text her and because of that she wants to ditch texting and stick with carrier pigeons. You know how embarrassing it is for a kid like me to be seen using carrier pigeons?!?! Well, anyway, I was hoping that you could make a program that takes my text and make it bigger, a LOT bigger. How about you test it out by only using the letters A, B, and C first.


Input


1. My text


Description

This is a string with characters A, B, and C.

Constraints

It is guaranteed that all letters are in uppercase.

Output


The first line will contain a message prompt to input my text.

The succeeding lines will contain the enlarged text.


Write a  PYTHON function to get the input from the user to go with words given on the fly (input through keyboard) or read it from a file.  At least it should contain a single word otherwise throw an error to the user rather than showing a PYTHON error.


Shuffle letters of words evenly and oddly except the first and last character when we run it again and again. You need to store the modified one so everytime you run it changes.  Keep the odd one in one color and even in another color and keep black for the first and last character

Adcricnog to reacersh at an Engslih Urvtisniey, it deosn't mttear in waht oedrr the ltreets in a wrod are, the olny itopmanrt tih

LATEST TUTORIALS
APPROVED BY CLIENTS