Questions d'entretien

Entretien pour Python Developer

-

WebKul

First Round: Write a pattern 1: Should accept only odd numbers numbers only except 2: Pattern should be fully Dynamic for n =1 @@@@@ * ** *** **** ***** ****** ***** **** *** ** * @@@@@ Second Round:n=6 * ** *** **** ****** ****** ***** **** *** ** *

Répondre

Réponses aux questions d'entretien

7 réponse(s)

1

num = int(input()) for i in range(num): print('@',end="") for i in range(num+2): for j in range(i): print("*",end="") print() for i in range(num,0,-1): for j in range(i): print("*",end="") print() for i in range(num): print('@',end="")

Shahab le

1

num = int(input()) for i in range(num): for j in range(num): print(" ",end=" ") for j in range(num-i): print(" ",end="") for j in range(i+1): print("*",end=" ") print() for i in range(num,0,-1): for j in range(num-i+1): print(" ",end="") for j in range(i): print("*",end=" ") print()

Shahab le

0

with less loops n=int(input()) print(n*"@") for i in range(1,n+2): for j in range(i): print("*",end="") print("") for i in range(n,0,-1): for j in range(i): print("*",end="") print("") print(n*"@")

Utilisateur anonyme le

0

n=int(input()) right=n-1 spaces=4*n-right-2 for i in range(1,n+1): print(spaces*' ',end='') print(i*"* ",end='') print(right*" ") spaces-=1 right-=1 spaces,right=0,0 for i in range(n,0,-1): print(spaces*' ',end='') print(i*"* ",end='') print(right*" ") spaces+=1 right+=1

Que : 2 le

0

n = 5 m=4 for i in range(n): print('@',end="") print() for i in range(n): print("*"*(i+1)) for i in range(m): print('*'*(m-i)) for i in range(n): print("@",end="")

Aamir le

0

#less loops and very easy def fun(number): at_rate="@"*number print(at_rate) for x in range(number,-(number+1),-1): for y in range(number,abs(x)-1,-1): print("*",end="") print(" ") print(at_rate) fun(6)

Ritesh Kumar le

0

def fun(number): for x in range(number): for y in range(x,number*2+3): print("",end=" ") for z in range(0,x+1): print("*",end=" ") print("") for x in range(number,0,-1): for y in range(number,x,-1): print("",end=" ") for z in range(number,number-x,-1): print("*",end=" ") print() fun(5)

Ritesh Kumar le

Ajouter des réponses ou des commentaires

Pour commenter ceci, connectez-vous ou inscrivez-vous.