Answer to Question #280151 in Python for Sai Kalyan

Question #280151

the first output pattern of the code is

1:

[3spaces] ***

[2spaces] **

[1space] *


and

2: if input is [20 or 34 or any double digit like 87] then it should be 8+7 = 15 and 1+5 = 6 this type number reduction


1
Expert's answer
2021-12-16T04:46:31-0500
n = 3
x = 2 
found = True 
while found: 
    print('#', '#', sep=' '*n) 
    for k in range(3, 1,-1): 
        if (x + 1) % k == 0: 
            found = False 
            break 
    n -= 1 
    f *= x


Number 2:

x = input("Enter a number:  ")
res = 0
for i in x:
    res += int(i)
print(res)

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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS