Hello I am a newbie to python and using python 3. I wish to learn patterns and printing e.g stars etc. I want to make maze pattern but i confused to make maze no 2-no4
No 1
@ @@@@@@@@@@@@@
@ @
@@@@@@@@@@@@@ @
@ @
@ @@@@@@@@@@@@@
@ @
@@@@@@@@@@@@@ @
@ @
@ @@@@@@@@@@@@@
@ @
@@@@@@@@@@@@@ @
@ @
@ @@@@@@@@@@@@@
@ @
@@@@@@@@@@@@@ @
No 2
@ @@@@@@@@@@@@@
@ @ @ @ @
@ @ @ @ @ @ @@@
@ @ @ @ @ @ @
@ @ @ @ @ @@@ @
@ @ @ @ @ @
@ @ @ @ @@@@@@@
@ @ @ @ @
@ @ @ @@@@@@@ @
@ @ @ @
@ @ @@@@@@@@@@@
@ @ @
@ @@@@@@@@@@@ @
@ @
@@@@@@@@@@@@@@@
No 3
@ @@@@@@@@@@@@@
@ @ @
@ @ @@@@@@@@@ @
@ @ @ @ @
@ @ @ @@@@@ @ @
@ @ @ @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @@@ @ @ @
@ @ @ @ @ @
@ @ @@@@@@@ @ @
@ @ @ @
@ @@@@@@@@@@@ @
@ @
@@@@@@@@@@@@@@@
No 4
@ @@@@@@@@@@@@@
@ @ @
@ @ @@@@@@@@@ @
@ @ @ @ @
@ @ @ @@@@@ @ @
@ @ @ @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @ @ @ @
@ @ @@@@@ @ @ @
@ @ @ @ @
@ @@@@@@@@@ @ @
@ @ @
@@@@@@@@@@@@@ @
This is my code maze no1:
def SimpleMaze(S):
bool=1
for i in range(S):
if (i+1)%2==0:
print('@'+' '*(S-2)+'@')
else:
if bool==1:
print('@'+' '+'@'*(S-2))
else:
print('@'*(S-2)+' '+'@')
bool=not bool
S= input("Nilai S:")
SimpleMaze(int(S))
Aucun commentaire:
Enregistrer un commentaire