Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions #936_ASCII_ART_GENERATOR/ascii_art_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ascii_art_generator.py
# Renders any text as large ASCII block letters
# Author: Your Name

LETTERS = {
'A': [" # ", " # # ", "#####", "# #", "# #"],
'B': ["#### ", "# #", "#### ", "# #", "#### "],
'C': [" ####", "# ", "# ", "# ", " ####"],
'D': ["#### ", "# #", "# #", "# #", "#### "],
'E': ["#####", "# ", "#### ", "# ", "#####"],
'F': ["#####", "# ", "#### ", "# ", "# "],
'G': [" ####", "# ", "# ###", "# #", " ####"],
'H': ["# #", "# #", "#####", "# #", "# #"],
'I': ["#####", " # ", " # ", " # ", "#####"],
'J': ["#####", " # ", " # ", "# # ", " ## "],
'K': ["# #", "# # ", "### ", "# # ", "# #"],
'L': ["# ", "# ", "# ", "# ", "#####"],
'M': ["# #", "## ##", "# # #", "# #", "# #"],
'N': ["# #", "## #", "# # #", "# ##", "# #"],
'O': [" ### ", "# #", "# #", "# #", " ### "],
'P': ["#### ", "# #", "#### ", "# ", "# "],
'Q': [" ### ", "# #", "# # #", "# # ", " ## #"],
'R': ["#### ", "# #", "#### ", "# # ", "# #"],
'S': [" ####", "# ", " ### ", " #", "#### "],
'T': ["#####", " # ", " # ", " # ", " # "],
'U': ["# #", "# #", "# #", "# #", " ### "],
'V': ["# #", "# #", "# #", " # # ", " # "],
'W': ["# #", "# #", "# # #", "## ##", "# #"],
'X': ["# #", " # # ", " # ", " # # ", "# #"],
'Y': ["# #", " # # ", " # ", " # ", " # "],
'Z': ["#####", " # ", " # ", " # ", "#####"],
' ': [" ", " ", " ", " ", " "],
}

def render_ascii_art(text: str) -> str:
"""Convert a string to large ASCII block letters."""
text = text.upper()

# Each letter has 5 rows
rows = ["", "", "", "", ""]

for char in text:
if char in LETTERS:
letter_rows = LETTERS[char]
else:
letter_rows = ["?????"] * 5 # Unsupported character

for i in range(5):
rows[i] += letter_rows[i] + " " # Add spacing between letters

return "\n".join(rows)

def main():
print("=" * 50)
print(" 🎨 ASCII Art Text Generator")
print(" Type your text below (letters only)")
print(" Type 'quit' to exit")
print("=" * 50)

while True:
user_input = input("\nEnter text: ").strip()

if user_input.lower() == 'quit':
print("Thanks for using ASCII Art Generator! πŸ‘‹")
break

if not user_input:
print("⚠️ Please enter some text.")
continue

print("\n" + render_ascii_art(user_input) + "\n")

if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"python-envs.defaultEnvManager": "ms-python.python:conda",
"python-envs.defaultPackageManager": "ms-python.python:conda",
"python-envs.pythonProjects": []
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🌟 Fork & Star ⭐ the Repository to Show Your Support!
# 🌟 Fork & Star ⭐ the Repository to Show Your Support!

Welcome to our project! We're excited to have you here. Below are some guidelines and information to help you contribute effectively.

Expand Down