Created
November 23, 2024 21:05
-
-
Save MaamounBenhafsa/45f77884c246d94e8a1eeaf447fe3cd7 to your computer and use it in GitHub Desktop.
Love Python Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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