mercredi 29 juillet 2020

This is a question where I'm supposed to get a door mat design as shown in the body. I'm not able to get "-" for every line

So I'm actually supposed to get a design as following:

------------.|.------------
---------.|..|..|.---------
------.|..|..|..|..|.------
---.|..|..|..|..|..|..|.---
----------WELCOME----------
---.|..|..|..|..|..|..|.---
------.|..|..|..|..|.------
---------.|..|..|.---------
------------.|.------------

which it's an N*M mat size. where N is an odd number and M is 3*N. for which I wrote this:

N,M=map(int,input().split())
for i in range(1,N,2):
     pattern=".|."*i
     var=pattern.center((m-len(pattern))/2,"-")
     print(var)

and when I execute this I don't get "-" for every line. I want to know where did I go wrong. I know that there's much more to do apart from this but can anyone please help me with this.

Aucun commentaire:

Enregistrer un commentaire