저는 파이썬 용어로 파이썬에서 플래시 카드 게임을 만들려고합니다. 내가 원했던 사양 중 일부는 다음과 같습니다.Flashcard Game : 점수를 유지하는 방법
1) 프로그램은 점수에 파일을 저장해야합니다. 2) 점수는 각 단어 및/또는 키를 추적하고 추측 된 횟수를 추적해야합니다 정확하고 잘못된 각 추측 후 사용자에게해야 프로그램이 얼마나 많은 시간을 사용자가 정확하게 해당 키를 추측했다 3) 잘못
는 파이썬에 아주 새로운 해요이를 만드는 방법에 대한 간단한 설명을 부탁드립니다 가능하다면 일하십시오.
여기에 내가 가진 무엇 :
from random import choice
import sys
print("Welcome! Please type 'Start' to begin or 'Quit' to leave")
user_answer = raw_input()
if (user_answer == "quit"):
quit()
file = []
words = {
"break": "Stops repeat of a block or loop",
"else": "comes after 'if' to offer an alternative option",
"if": "informs computer on how to react depending on key response from user",
"index": "Return the index in the list of the first item whose value is x",
"dict": "Associates one thing to another no matter what it is",
"import": "To call a command",
"def": "to define a word",
"print": "to send a message to the screen for the user to see",
"for": "One way to start a loop",
"while": "Another way to start a loop",
"elif": "When an 'If'/'Else' situation calls for more than one 'Else'",
"from": "directs the computer to a location from which to import a command"
}
score = file[]
key = choice(words.keys())
remaining_questions = 3
while remaining_questions > 0:
print("Which command can accomplish: " + words[key] + "...?")
user_guess = raw_input()
print(str(user_guess == key))
remaining_questions = remaining_questions - 1
이 프로그램을 작성하기 전에 정의를 올바르게 가져야합니다. "def : 단어를 정의하는"? "가져 오기 : 명령을 호출하려면"? 이렇게하면 많은 도움이되며 코딩을 시작할 기초를 마련합니다. – Hyperboreus
저장된 파일을 사람이 읽을 수 있도록 하시겠습니까? –
각 게임의 시작 부분에 점수를 표시하여 사용자가 자신의 기록을 볼 수있게하고 싶습니다. 나는이 함수에 대해 csv를 사용하여 언급했지만 답변과 세 가지 접근법을 비교해보고있다. – cocog