python: tạo countdown từ 10->0

 import time

# For each number from 10 to 1 in descending order

for number in range(10, 0, -1):

    # Print the countdown message and flush the output

print("Countdown ... {0:2}".format(number))=>show tất cả số trên 1 màn hình



   hoặc print("Countdown ... {0:2}".format(number), end='\r', flush=True)=>show mỗi 1 giây 1 số



    # Introduce a delay of 1 second (adjust as needed)

    time.sleep(1)

show=input("MAY GOD'S LOVE BE WITH YOU - BLAST OFF!")=>chỗ này thêm vào nếu muốn chạy trên exe

# Print the blast-off message after the loop

print("\nMAY GOD'S LOVE BE WITH YOU - BLAST OFF!")


hoặc show hình từ ký tự

show=input("""

  .*.*.*....*.*.*  

*.*......*.*..*.*  

*.*............*.*  

  ...*.*....love....*.*..  

......*..*...........*.*  

..........*.* .* .*.*....  

..............*.*..............  

......*.*.*......*.*.*....  

.*.*......*.*..*.*....*.*  

*.*............*...........*  

  ...*.*....you....*.*..  

......*..*...........*.*  

..........*.* .* .*.*....  

..............*.*..............

""")


Nhận xét