made this python code when i was bored

import os
import sys
import time
from colorama import Fore, init

init(autoreset=True)

def exit():
try:
os.system("cls")
print(f"{Fore.GREEN}Exiting..{Fore.RESET}")
print("")
time.sleep(3)
sys.exit()
except:
os.system("cls")
print(f"{Fore.GREEN}Error Exiting, Please exit manually.{Fore.RESET}")
print("")
input("")

def logo():
print(f"{Fore.GREEN} /--------\\ ")
print(f"{Fore.GREEN} |Welcome!| ")
print(f"{Fore.GREEN} \\--------/ ")

def main():
try:
print("")
logo()
print("")
print(f"{Fore.GREEN}1) Exit")
print("")
x = input(f"{Fore.GREEN}Option: {Fore.RESET}")
except:
os.system("cls")
print(f"{Fore.GREEN}Error Starting Menu, Please report this bug. (creator's Discord Username: kotlinn){Fore.RESET}")
print("")
input("")


if x == "1":
exit()

if __name__ == '__main__':
main()
import os
import sys
import time
from colorama import Fore, init

init(autoreset=True)

def exit():
try:
os.system("cls")
print(f"{Fore.GREEN}Exiting..{Fore.RESET}")
print("")
time.sleep(3)
sys.exit()
except:
os.system("cls")
print(f"{Fore.GREEN}Error Exiting, Please exit manually.{Fore.RESET}")
print("")
input("")

def logo():
print(f"{Fore.GREEN} /--------\\ ")
print(f"{Fore.GREEN} |Welcome!| ")
print(f"{Fore.GREEN} \\--------/ ")

def main():
try:
print("")
logo()
print("")
print(f"{Fore.GREEN}1) Exit")
print("")
x = input(f"{Fore.GREEN}Option: {Fore.RESET}")
except:
os.system("cls")
print(f"{Fore.GREEN}Error Starting Menu, Please report this bug. (creator's Discord Username: kotlinn){Fore.RESET}")
print("")
input("")


if x == "1":
exit()

if __name__ == '__main__':
main()
3 Replies
<Tim>
<Tim>3mo ago
If you use ```py your code here... ``` you have a nice code block with syntax highlighting ^^
troy
troyOP3mo ago
thanks!
Dumb Bird
Dumb Bird3mo ago
Cool! One thing to note though Where exit is already a built-in function it can cause a lot of issues down the line I suggest renaming the function, or if you want to replace the behavior of the default exit function then you should do it in a different all be it much more hacky way

Did you find this page helpful?