user13403211
user13403211

Reputation:

creating a jumbled up word game in python

I am at beginner level in python. And I am trying to do a game in python, call Jumble Up words game. I have "words.txt" which is include all words for game and "High_score.txt", to store the highest score that player get. I want to know how can i load those ".txt" files in which data structures. And how to generate 8 random letters from a-z for the players to guess. The game is like program will give the user 8 random letters and player can guess from 2-8 letters that match with the words in "words.txt". And stores the 30 highest scores in "High_score.txt" file.

Upvotes: 1

Views: 257

Answers (1)

mankowitz
mankowitz

Reputation: 2051

Read a file:

f = open("/path/to/file","r")
string = f.read()

Random letters:

import string
import random
mixedletters = ''.join(random.sample(s, len(s)))

Upvotes: 1

Related Questions