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

4.1 Write a program for each of the following:


(a) Listing all students whose CUM is K or higher. (Test the program using K = 3.00.)


(b) Listing all students in year L. (Test the program using L= 2, or sophomore.


Add two Polynomials



Given two Polynomials A and B,write a program that adds the given two Polynomials A and B.



Sample input 1


4


0 5


1 0


2 10


3 6



Sample Output 1





Sample Input 2


4


0 5


1 0


2 10


3 6


3


0 1


1 2


2 4



Sample output 2


6x^3 + 14x^2 + 2x + 6

Polynomial



Given polynomial,write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1+....+C1x+C0 format.



Input



The first line contains a single Integer N.


Next N lines contain two integers Pi,Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.



Sample Input 1


5


0 2


1 3


2 1


4 7



Sample output 1


7x^4 + 6x^3 + x^2 + 3x + 2



Sample input 2


4


0 5


1 0


2 10


3 6



Sample output 2


6x^3 + 10x^2 + 5

Write a program which takes 5 inputs from user for different subject’s marks, total it and generate mark sheet using grades ? 


string = input("Enter any string: ")


if string == 'x':


exit();


else:


newstr = string;



vowels = ('a', 'e', 'i', 'o', 'u');


for x in string.lower():


if x in vowels:


newstr = newstr.replace(x,"");



print(newstr)



Every thing is correct,


Except,


In this we have remove uppercase letters also


So please make code for me

Multiplying two numbers is a piece of cake, but how about multiplying three of them, either being a negative of positive number? With programming and proper code, these tasks are easy to handle.







You're a programmer, right? Then code this one for me!





Input





A line containing three numbers (positive or negative, may have decimal places) separated by a space.





1.6·-2·-1




Output





A line containing a decimal/float with one decimal place.





3.2

for sample input2 i get 5 8 5 instead of 5 8 8


What is the output of the Python method call below?

"bib".find('b', 1, 2)


Hollow Right Triangle




Given an integer number N as input. Write a program to print the hollow right-angled triangular pattern of N lines as shown below.




Note:




There is a space after each asterisk ) character. *




Input




The first line of input is an integer




N




Explanation




In the given example the hollow right angled triangle of side 4 Therefore, the output should be




*




* *




*

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


LATEST TUTORIALS
APPROVED BY CLIENTS