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

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

Input

The first line of input is a positive integer.

Explanation

For example, if the given number is

5, the output should be

______
|    /
|   /
|  /
| /
|/

7,the out put should be

________
|      /
|     /
|    /
|   /
|  /
| /
|/




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.

In the given example the hollow right angled triangle of side

4. Therefore, the output should be   

      *
    * *
  *   *
* * * *

5.Therefore, the output should be

        *
      * *
    *   *
  *     *
* * * * *

Sum of K powers

Write a program to print the sum of the

Kth power of the first N natural numbers.Input

The first line of input is an integer

N. The second line of input is an integer K.Explanation

In the given example, the sum of first

5 natural numbers power of 3.The sum should be 13 + 23 + 33 + 43 + 53

Therefore, the output should be

225.


Product of the Given Numbers

Given an integer

N, write a program which reads N inputs and prints the product of the given input integers.Input

The first line of input is a positive integer,

N. The next N lines each contain an integer.Output

The output should be the product of the given input integers.

Explanation

In the given example,

N = 3 and the input integers are 2, 3, and 7.So, the output should be 2 x 3 x 7 = 42


Product of Numbers from M to N

Given two integers

M, N. Write a program to print the product of numbers in the range M and N (inclusive of M and N).Input

The first line of input is an integer

M. The second line of input is an integer N.Explanation

In the given example, the product of numbers between the range

2 and 5 is 2 * 3 * 4 * 5. Therefore, the output should be 120.


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


Uncommon Number

Given a number

N, find whether the number is common or uncommon. A number is considered uncommon if it is not divisible by any of the single-digit primes.Input

The first line of input is an integer

N.Output

The output should be a single line containing

True if it satisfies the given conditions, False in all other cases.Explanation

In the given example,

N = 5633 the number is not divisible by 2, 3, 5, 7. So, the number is an uncommon number.Therefore, the output should be

True.


Hollow Right Triangle - 2

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

5. Therefore, the output should be

*

* *

* *

* *

* * * * *


Sample Input 1

4

Sample Output 1

*

* *

* *

* * * *

Sample Input 2

5

Sample Output 2

*

* *

* *

* *

* * * * *




Eligibility Criteria - 4


This Program name is Eligibility Criteria - 4. Write a Python program to Eligibility Criteria - 4, it has two test cases


The below link contains Eligibility Criteria - 4 question, explanation and test cases


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


We need exact output when the code was run

Eligibility Criteria - 3


This Program name is Eligibility Criteria - 3. Write a Python program to Eligibility Criteria - 2, it has two test cases


The below link contains Eligibility Criteria - 3 question, explanation and test cases


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


We need exact output when the code was run

LATEST TUTORIALS
APPROVED BY CLIENTS