From 09fc06709c45732968ea28a479180b9483e58af0 Mon Sep 17 00:00:00 2001 From: Bryan <91551702+blondon1@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:42:56 -0400 Subject: [PATCH] Use os.system for clearing screen This approach makes the code cross-platform by using cls for Windows and clear for Unix-based systems. --- AI Calculator/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AI Calculator/main.py b/AI Calculator/main.py index 206ccbac54..caa1779510 100644 --- a/AI Calculator/main.py +++ b/AI Calculator/main.py @@ -1,5 +1,5 @@ from chatterbot import ChatBot - +import os # naming the ChatBot calculator # using mathematical evaluation logic # the calculator AI will not learn with the user input @@ -10,7 +10,7 @@ # clear the screen and start the calculator -print('\033c') +os.system('cls' if os.name == 'nt' else 'clear') print("Hello, I am a calculator. How may I help you?") while (True): # take the input from the user