簡體   English   中英

Python(如何使文本在 python shell 中顯示得更慢)

[英]Python (how do i make text appear slower in the python shell)

我正在嘗試編寫游戲代碼,但我一直在嘗試讓 python shell 中的打印速度變慢我感謝所有幫助這里是到目前為止的代碼

print ("welcome to the music guessing game")
print (" begin?")

print (" first of all lets go through the rules")

print (" You have three 3 lives to answer each song in this game")
print (" If you get it on the first turn you gain 3 points")
print (" if you get it on the second try you gain 1 point")
print ( " If you get it wrong again you lose one life and it proceeds to the next question")
print (" One major rule have fun while playing")


username=input (" what is your username")
print ("Is this your name ?",username)

password=input (" Enter your password please")
print (" password gained",password)

print ("Checking the data files")
print ("10%")
print ("20%")
print ("30%")
print ("40%")
print ("50%")
print ("60%")
print ("70%")
print ("80%")
print ("90%")
print  ("100%")
print (" check complete")

import random
def fifty_fifty():
        "return 0 or 1 or 2 or 3 or 4 or 5 or 5 with 50% chance each"
        return random.randrange

print (" High Scores!!!!!")

print ("[DEV]LB123 score 1200")
print (" PewDiePie score 420")
print (" Callmekevin score 68")
print ("[BOT] Tseries score 0")



option=input ("would you like to play")
print ("would you like to play "+ option +"?")

我從https://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html的輸入中獲得了這些信息

print (" okay then lets begin ")



print (" Round One " )


print (" Lets begin " )

print ("3")
print ("2")
print ("1")



print (" 'N_ Te_rs L_ft _o _r_'")

if input (" No Tears Left To Cry")
 print ("3 points")

elif input (" no answer")
print (" 1 life gone 2 remain") 

所以問題是,如何讓文本在 python shell 中顯示得更慢? 謝謝

您可以在代碼中添加睡眠

另外,歡迎來到! 以后,請正確格式化代碼,以使其正確顯示。 您可以在此元發布中看到各種方式

import time 
seconds_for_sleep = 4
name = str(input("Username"))
time.sleep(int(seconds_for_sleep))
print("See! This fuction waited", seconds_for_sleep," seconds!`enter code here`)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM