Skip to content

Instantly share code, notes, and snippets.

@MaamounBenhafsa
Created November 23, 2024 21:05
Show Gist options
  • Save MaamounBenhafsa/45f77884c246d94e8a1eeaf447fe3cd7 to your computer and use it in GitHub Desktop.
Save MaamounBenhafsa/45f77884c246d94e8a1eeaf447fe3cd7 to your computer and use it in GitHub Desktop.
Love Python Script
import time
import os
def print_heart():
"""Displays a heart with a love message."""
heart = '''
***** *****
** ** ** **
** ** **
** **
** **
** **
** **
** **
**
'''
print(heart)
def print_message():
"""Displays a love message."""
message = "\nπŸ’– I love you to the moon and back! πŸ’–"
for char in message:
print(char, end='', flush=True)
time.sleep(0.1)
print("\n\n")
def clear_console():
"""Clears the console screen."""
os.system('cls' if os.name == 'nt' else 'clear')
def animated_heart():
"""Displays an animated heart."""
frames = [
" πŸ’– ",
" πŸ’– πŸ’– ",
" πŸ’– πŸ’– ",
" πŸ’– πŸ’– ",
" πŸ’– πŸ’– ",
" πŸ’– πŸ’– ",
" πŸ’– ",
]
for _ in range(3):
for frame in frames:
clear_console()
print(frame.center(40))
time.sleep(0.3)
clear_console()
print_heart()
print_message()
# Run the love trick
animated_heart()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment