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

A = int(input())
B = int(input())

for num in range(A, B + 1):
   # order of number
   order = len(str(num))
  
   # initialize sum
   sum = 0
   temp = num
   while temp > 0:
       digit = temp % 10
       sum += digit ** order
       temp //= 10
   if num == sum:
       print(num)

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


Hints:

  • Use the end operator to print all the Armstrong numbers in a single line.
  • If there is no Armstrong numbers between the given range A to B(including A and B) print -1


Sample Input 1

150

200

Sample Output 1

153

Sample Input 2

1

3

Sample Output 2

1 2 3



Product of the Given Numbers

Given an integer using WHILE LOOP


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



N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.Input

The first line of input is an integer


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

In the example, the given starting number is

10, and the number of rows in the pyramid is 5.So, the output should be


10

11 12

13 14 15

16 17 18 19

20 21 22 23 24


Diamond Crystal


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


The below link contains Diamond Crystal question, explanation and test cases


https://docs.google.com/document/d/1sVH8M0vCCSky84V1PkWD-eKm1v0dPRC5/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

Maximum


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


The below link contains Maximum question, explanation and test cases


https://docs.google.com/document/d/1z0yr9wfjkiTADlYer1IJgNn2w8x3_HJG/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

Hyphenate Letters


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


The below link contains Hyphenate Letters question, explanation and test cases


https://docs.google.com/document/d/1IrqSpmObeTn85U5gmkMV7IEwgDVYmfvg/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

Replacing Characters of Sentence

This Program name is Replacing Characters of Sentence. Write a Python program to Replacing Characters of Sentence, it has two test cases

The below link contains Replacing Characters of Sentence question, explanation and test cases

https://docs.google.com/document/d/11PZEZz6eaY7cjaPM8NVCvHn6d_6_vlOs/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true

We need exact output when the code was run

Roots of a quadratic equation


This Program name is Roots of a quadratic equation. Write a Python program to Roots of a quadratic equation, it has two test cases


The below link contains Roots of a quadratic equation question, explanation and test cases


https://docs.google.com/document/d/1Wz9yIZ4GQON9tJEmSTAbcMunwn95k5PB/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

Diamond


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


The below link contains Diamond question, explanation and test cases


https://docs.google.com/document/d/1LtfuUk5t1IPGh6yCOoJ2Tm3AZFZnVb1W/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

Sum of N terms in Harmonic series


This Program name is Sum of N terms in Harmonic series. Write a Python program to Sum of N terms in Harmonic series, it has two test cases


The below link contains Sum of N terms in Harmonic series question, explanation and test cases


https://docs.google.com/document/d/1kZEEzRlzAo_HT0I9HineNAMs_3PwlU2_/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


We need exact output when the code was run

LATEST TUTORIALS
APPROVED BY CLIENTS