1

Suppose if I want to display the message "Help me out!" for 15 minutes and after 15 minutes only the message "Help me out!" will no appear on interpreter console then which method is helpful in python?

print("Welcome")
string_variable="Help me out!"

print(string_variable)
yash bhangare
  • 319
  • 2
  • 9
  • Print it, make a time.sleep(15*60) and erase console – azro May 24 '20 at 09:10
  • 1
    Does this answer your question? [How to clear the interpreter console?](https://stackoverflow.com/questions/517970/how-to-clear-the-interpreter-console) – azro May 24 '20 at 09:10

2 Answers2

1

Do clear the interpreter terminal, import the os library and then do os.system('cls') (As described in this question). Note that this will clear the entire terminal window.

In order to do it after 15 minutes, use time.sleep(<amount of seconds>), so in your case time.sleep(900).

Zciurus
  • 786
  • 4
  • 23
1
import threading
import time
import os

def clearAfter15():
    clear = lambda: os.system('cls')
    clear()

string_variable="Help me out!"
t = threading.Timer(15*60, clearAfter15)
t.start()
print(string_variable)

That should hopefully do the trick, I cant help much more than that without more detail

Akib Rhast
  • 651
  • 4
  • 15