Files
CS50---Harvard/Python/integer1.py
T
2026-06-08 19:54:16 +00:00

16 lines
468 B
Python

import subprocess
# Save the raw text input first so we don't lose what was typed
user_input = input("Input your Command my master: ")
try:
n = int(user_input)
print("Integer")
except ValueError:
# Safely escape single quotes if the user typed any
safe_input = user_input.replace("'", "'\\''")
# Pass the user's exact text directly into cowsay
command = f"cowsay '{safe_input}' | lolcat -a -d 50"
subprocess.run(command, shell=True)