Answer to Question #224587 in Python for Hari nadh babu

Question #224587

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

1
Expert's answer
2021-08-10T04:28:24-0400
n = int(input())
line_1 = n * '* '
line_2 = '* ' + (n-2)*'  ' + '*'
line_3 = '  '*(n-1) + '*'
print(line_1)
for i in range(n-2):
    print(line_2)
    
print(line_1)
for i in range(n-2):
    print(line_3)
    
print(line_1)

Input 1:
5
Output 1:
* * * * * 
*       *
*       *
*       *
* * * * * 
        *
        *
        *
* * * * * 
Input 2:
4
Output 2:
* * * * 
*     *
*     *
* * * * 
      *
      *
* * * * 
Input 3:
10
Output 3:
* * * * * * * * * * 
*                 *
*                 *
*                 *
*                 *
*                 *
*                 *
*                 *
*                 *
* * * * * * * * * * 
                  *
                  *
                  *
                  *
                  *
                  *
                  *
                  *
* * * * * * * * * * 

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!

Comments

Raj
23.06.22, 16:01

Amazing!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS