Skip to content

Commit 09fc067

Browse files
authored
Use os.system for clearing screen
This approach makes the code cross-platform by using cls for Windows and clear for Unix-based systems.
1 parent 65eaabf commit 09fc067

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: AI Calculator/main.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from chatterbot import ChatBot
2-
2+
import os
33
# naming the ChatBot calculator
44
# using mathematical evaluation logic
55
# the calculator AI will not learn with the user input
@@ -10,7 +10,7 @@
1010

1111

1212
# clear the screen and start the calculator
13-
print('\033c')
13+
os.system('cls' if os.name == 'nt' else 'clear')
1414
print("Hello, I am a calculator. How may I help you?")
1515
while (True):
1616
# take the input from the user

0 commit comments

Comments
 (0)