Questions: 5 831

Answers by our Experts: 5 728

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 & Filtering

Numbered Triangle


You are given an integer N. Print Nrows starting from 1 in

the triangle order as shown in the explanation.


Input

The input contains an integer N

Output

The output should have N lines.

Each of the N lines should have space-separated integers as per the triangle order.


INPUT 1 :

5

OUTPUT 1:

1

2 6

3 7 10

4 8 11 13

5 9 12 14 15


INPUT 2 :

4

OUTPUT 2:

1

2 5

3 6 8

4 7 9 10





Trapezium Order


You are given an integer N Print N rows starting from 1 in

the trapezium order as shown in the output of the below examples.


Input

The input contains an integer N.

Output

The output should have N lines.

Each of the N lines should have space-separated stegers as per the trapezium order.


Sample Input 1

4

Sample Output 1

1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11



please see the output and correct the code :--

Input:---

4 4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Output :--

1 2 3 4 5 6 7 8 9 10 11 12 16 15 14 13

Input 2:---

3 4

1 2 3 4

10 11 12 5

9 8 7 6

Output 2:--

1 2 3 4 5 12 11 10 9 8 7 6


def read_matrix():

  line = input()

  words =line.split()

  n = int(words[0])

  m = int(words[1])

  mat = []

  for i in range(n):

      row = []

      line = input()

      words = line.split()

      for j in range(m):

          row.append(int(words[j]))

      mat.append(row)

  return mat

def print_zig_zag(mat):

   for i in mat:

       for j in i:

           print(j,end=" ")


print_zig_zag(read_matrix())




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
LATEST TUTORIALS
APPROVED BY CLIENTS