How To Delete Text In Console While Using Typewriter Effect?

Question:
I am re-working on a rock paper scissors game I made a while back and have been asking a few questions but I was wondering, is there a way to make it delete text? I am trying to get it to go “Rock” (Delete) “Paper” (Delete) “Scissors” (Delete) “Shoot” (Delete) then say if you won or lost
Repl link:
https://replit.com/@Chandler0Bing/Rock-Paper-Scissors-Vs-A-Computer#main.py

while True:
  computer = random.randint(0,3)
  p1 = '\nROCK! PAPER SCISSORS SHOOT!\n'
  typewriter_print(p1)
  person = input('\tPlay:\t')
  if person.lower() == 'rock' or person.lower() == 'r' and computer == 1:
    print('\nComputer Choses PAPER!\nYOU LOSE!')

@curhahn The following code will clear the console:

import os
os.system('clear')

Or, you can use a escape key, like this:

print("Bac\bkspace!")

Which will print to the console like this: Bakspace. (the ‘c’ is removed)

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.