0

I have been making a 5 question "Quiz" on Python. It is pretty simple in code design since I do not have much experience. I want to hide the previous questions so that the code is easier on the eyes and user friendly. I work on IDLE by the way.

i="Incorrect, You lost points for this question."
i2="Incorrect, Try Again."
g="Good Job!"
x=100 #percentage
q1=input("What is 2+3? ")
while q1 != "5":
    x-=20
    print (i,"Your current score:",x,"%")
    q1=input("What is 2+3? ")
    while q1 != "5" and (x<100):
        print (i2)
        q1=input("What is 2+3? ")
else:
    print(g)
    print("Your current score:",x,"%")

Q2=input("What are the first 3 digits of Pi? ")...

This goes on 4 more times. I want all text that I displayed for q1 to disappear when the input value for Q2 appears.

1 Answers1

1

Import the module os

import os

os.system('cls')

os.system('cls') will clear the screen on windows otherwise replace 'cls' with 'clear' Just put tthat line whenever you want to clear everything on your code

Tirterra
  • 579
  • 2
  • 4
  • 14