Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I make inputted letters as big letters using asterisk?

For example i inputted "ABC"

The output should be:

*** **  ***
* * * * *
*** **  *
* * * * *
* * **  ***

I only tried the letter A but it results an error.
Can someone help me do it in plain python without any modules

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

text = input("Enter my text: ").split()

A = [3, [1,0,1], 3, [1,0,1], [1,0,1]]

for i in range(text+1):
    if text[i] == 'A':
        print("*" * A[i])

>Solution :

That representation seems inconsistent, if you wanted to use a matrix to represent which elements are asterisks I’d suggest

A = [[1,1,1], [1,0,1], [1,1,1], [1,0,1], [1,0,1]]

Then you can loop over each row and print out either an asterisk or whitespace as appropriate

for row in A:
    print(''.join('*' if s == 1 else ' ' for s in row))

***
* *
***
* *
* *
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading