###Global variable declaration part##
i,k=0,0
##Main code part ##
i=0
while i<9:
if i<5:
k=0
while k<4-i:
print(' ', end='')
k+=1
k=0
while k<i*2+1:
print('\u2665', end='')
###Global variable declaration part##
i,k=0,0
##Main code part ##
for i in range(0,9):
if i<5:
for k in range(0,4-i):
print(' ',end='')
k+=1
for k in range(0,i*2+1):
print('\u2665',end='')
I changed it to this for part
Poor understanding of for does not result in the same execution value
I ask you what you overlooked
Hello.
In while
, k+=1
appears to have been used to increase or decrease repeatedly in the k iteration.
However, in for-range
, range
itself functions as an increase or decrease, so I don't think the corresponding part needs to be written again.
The Hashcode self-compiler has an error in the print
section, but it seems to be a problem.
© 2024 OneMinuteCode. All rights reserved.