VisuAlg Web

Limpando e Pausando

Python não tem limpatela nativo. Para limpar console, usamos chamadas do sistema operacional; para pausas, input() ou time.sleep() .

Python não tem limpatela nativo. Para limpar console, usamos chamadas do sistema operacional; para pausas, input() ou time.sleep().

Exemplo de códigoPython


print("Enter your name: ", end="")
name = input()

print("Great. Press Enter to clear the draft...")
input("Press Enter to continue...")  # Waits for Enter without overwriting the name variable

import os
os.system("cls" if os.name=="nt" else "clear")
print("Welcome to the cleared system, ", name)
Exemplo de códigoPython


import time
time.sleep(1000/1000)  # Enables an automatic 1-second delay between prints
for i in range(3, 1-1, -1):
print(i, "...")

import time
time.sleep(0/1000)  # REQUIRED: disable the timer by passing zero
print("BOOM!")