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

Largest Number in the List:

You are given space-separated integers as input. Write a program to print the maximum number among the given numbers.

Input:

The first line of input contains space-separated integers.

Explanation:

In the example, the integers given are

1, 0, 3, 2, 9, 8. The maximum number present among them is 9. So, the output should be 9.

Sample Input 1:

1 0 3 2 9 8

Sample Output 1:

9

Sample Input 2:

-1 -3 -4 0

Sample Output 2:





W pattern with *


This Program name is W pattern with *. Write a Python program to W pattern with *, it has two test cases


The below link contains W pattern with * question, explanation and test cases


https://drive.google.com/file/d/1gcmmsSrPkGTY3aHoyGuw-x3qFFFnLTeb/view?usp=sharing


We need exact output when the code was run

Armstrong numbers between two intervals


This Program name is Armstrong numbers between two intervals. Write a Python program to Armstrong numbers between two intervals, it has two test cases


The below link contains Armstrong numbers between two intervals question, explanation and test cases


https://drive.google.com/file/d/1nMwnGgwxLey1JhQEaQ_x-goS5_1DyVdL/view?usp=sharing


We need exact output when the code was run

Pyramid


This Program name is Pyramid. Write a Python program to Pyramid, it has two test cases


The below link contains Pyramid question, explanation and test cases


https://drive.google.com/file/d/1KwCeEpWf99Y31ax5lohTDxrL4226ZzIJ/view?usp=sharing


We need exact output when the code was run

Digit 9


This Program name is Digit 9. Write a Python program to Digit 9, it has two test cases


The below link contains Digit 9 question, explanation and test cases


https://drive.google.com/file/d/1lqixEtNT6DnFGtmFoJLzQrmvYowmxNqi/view?usp=sharing


We need exact output when the code was run

X = int(input())
N = int(input())
M = 1 + 2*(N-1)
list1 = []
i = 1
j = 0
k = 0
while i <= M:
 list1.append(X**i)
 i = i + 2


for s in list1:
 if (list1.index(s))%2 == 0:
  j = j + s
 else:
  k = k - s
print(j+k)


In this python program it has three test cases, in this three test cases two test cases are getting expected output and third test case are not getting expected output. Please give me expexted output for three test cases. Thank you !

Question url :-

https://drive.google.com/file/d/15oYX0I0vkskebiNz7Wg80SdkZ-MzHTrg/view?usp=sharing

Test case 1

Input

2

5

Output

410

Test case 2

Input

3

2

Output

-24

Test case 3

Input

1

5

Output

1


write a program to print the index of the last occurence of the given number N in the list



given an array of n integers find and print all the unique triplets


Consider the following function fpp.

def foo(m):
    if m == 0:
      return(0)
    else:
      return(m+foo(m-1))

Which of the following is correct?

 The function always terminates with f(n) = factorial of n

 The function always terminates with f(n) = n(n+1)/2

 The function terminates for non­negative n with f(n) = factorial of n

 The function terminates for non­negative n with f(n) = n(n+1)/2



Add two polynomials

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


The first line contains a single integer M.

Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A.

After that next line contains a single integer N.

Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.


Input 1

4

0 5

1 0

2 10

3 6

3

0 1

1 2

2 4

output 1

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


input 2

4

0 5

1 0

2 10

3 6

4

0 -5

1 0

2 -10

3 -6

output2



LATEST TUTORIALS
APPROVED BY CLIENTS