Загрузка...

game with thony*python

please subcribe for more fun content.
please do check out my channel here is the link
https://www.youtube.com/@ssoplt/shorts
#technology #robotics # programming methna thamyea code eka patangannae
import random
score = 0
playing = True
play_again = ""

def read_word_from_a_file(file_name):
file = open(file_name, "r")
words = []
for line in file:
word = line.strip()
words.append (word)
file.close()
return words

def scramble_word(word):
letter_list = []
for letter in word:
letter_list.append(letter)


random.shuffle(letter_list)
scrambled_word= ''
for letter in letter_list:
scrambled_word=scrambled_word+letter

return scrambled_word

def play_round(word):
returned_scrambled = scramble_word(word)
print(f"\nUnscramble this word: {returned_scrambled}")

for attempt in range(3):
guess = input(f"Attempt {attempt + 1}/3: ").lower()
if guess == word:
print(f"Correct! The word was {word}.")
return 3 - attempt

print(f"Sorry, you're out of attempts. The word was {word}.")
return 0
#.......................main code..........................................
print("Welcome to Obo's Word Unscrambler Challenge!\nUnscramble Earth words to help Obo learn and earn points.")
returned_words = read_word_from_a_file("Word Scramble Game.txt")

while playing:
word = random.choice(returned_words)
score += play_round(word)
play_again = input("Do you want to unscramble another word? (yes/no):").lower()
if play_again == "no":
playing = False
print(f"\nGame Over! Your final score is {score}. \nObo thanks you for your help in learning Earth words!")

Видео game with thony*python канала SETHUTECH
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять