2014-10-14 3 views
-2

기본적으로 내 프로그램에 높은 점수를 기록하고 싶습니다. 나는 코딩에 익숙하지 않아 약간의 도움이 필요하다. 나는 내가 원하는 것을 보여주기 위해이 기본 프로그램을 만들 것이다.파이썬에서 가장 빠른 시간을 녹음합니다.

import time 

name = input("Please enter your name: ") 
mylist=["Man utd are the best team","I am going to be a pro typer.","Coding is really fun when you can do it."] 
x=random.choice (mylist) 
print ("The sentence I would like you to type is: ") 
print (x) 

wait = input ("Please press enter to continue, The timer will start upon hitting enter!") 
start = time.time() 
sentence = input("Start typing: ") 
end = time.time() 
overall = end - start 

if sentence == (x): 
    print ("It took you this many seconds to complete the sentence: %s" % overall) 
    if overall <= 9: 
     print ("Nice job %s" % name) 
     print ("You have made it to level 2!") 

시간이 얼마나 걸릴 수 있습니까? 누군가가 새로운 점수를 받으면 어떻게해야합니까?

+0

기록 하시겠습니까? –

답변

0

프로그램 실행 전반에 걸쳐 데이터를 유지할 수있는 방법을 찾고 있습니다. 여러 가지 방법이 있지만 가장 간단한 방법은 just writing to a file입니다.

또한 데이터베이스를 사용하려면 Python의 경우 SQLite3을 조사하십시오.

관련 문제