jeudi 12 novembre 2020

How do I do if word_pick not == random_choice?

import random
import time
import sys

from colored import fg

color1 = fg("red")
color2 = fg("blue")
color3 = fg("green")
color4 = fg("yellow")


for x in (color1 + "Hi,\nThis is a word guessing game, you will have to guess the answer from 100 words.\nYou will have 45 chances to guess the number. You initially start with 225 points. Every chance you enter the wrong answer, you lose 5 points. The quicker you guess, the higher your score(225 is the highest score you can have).\n\n"):
    sys.stdout.write(x)
    sys.stdout.flush()
    time.sleep(0.03)

words = ['time', 'year', 'people', 'way', 'day', 'man', 'thing', 'woman', 'life', 'child', 'world', 'school', 'state', 'family', 'student', 'group', 'country', 'problem', 'hand', 'part', 'place', 'case', 'week', 'company', 'system', 'program', 'question', 'work', 'government', 'number', 'night', 'point', 'home', 'water', 'room', 'mother', 'area', 'money', 'story', 'fact', 'month', 'lot', 'right', 'study', 'book', 'eye', 'job', 'word', 'business', 'issue', 'side', 'kind', 'head', 'house', 'service', 'friend', 'father', 'power', 'hour', 'game', 'line', 'end', 'member', 'law', 'car', 'city', 'community', 'name', 'president', 'team', 'minute', 'idea', 'kid', 'body', 'information', 'back', 'parent', 'face', 'others', 'level', 'office', 'door', 'health', 'person', 'art', 'war', 'history', 'party', 'result', 'change', 'morning', 'reason', 'research', 'girl', 'guy', 'moment', 'air', 'teacher', 'force', 'education']


for x in (color2+ f"These are the words in the list you can pick from:\n\n{color3}'time', 'year', 'people', 'way', 'day', 'man', 'thing', 'woman', 'life', 'child', 'world', 'school', 'state', 'family', 'student', 'group', 'country', 'problem', 'hand', 'part', 'place', 'case', 'week', 'company', 'system', 'program', 'question', 'work', 'government', 'number', 'night', 'point', 'home', 'water', 'room', 'mother', 'area', 'money', 'story', 'fact', 'month', 'lot', 'right', 'study', 'book', 'eye', 'job', 'word', 'business', 'issue', 'side', 'kind', 'head', 'house', 'service', 'friend', 'father', 'power', 'hour', 'game', 'line', 'end', 'member', 'law', 'car', 'city', 'community', 'name', 'president', 'team', 'minute', 'idea', 'kid', 'body', 'information', 'back', 'parent', 'face', 'others', 'level', 'office', 'door', 'health', 'person', 'art', 'war', 'history', 'party', 'result', 'change', 'morning', 'reason', 'research', 'girl', 'guy', 'moment', 'air', 'teacher', 'force', 'education' \n\n\n"):
    sys.stdout.write(x)
    sys.stdout.flush()
    time.sleep(0.01)

time.sleep(2)

word_pick = input(color4 + "Pick a random word from the above list: ")

random_choice = random.choice(words)

chances = 45
score = 225

if word_pick.upper() or word_pick.lower() or word_pick.title() not random_choice:
    print("Congrats, you have picked the right word.")

if word_pick.upper() or word_pick.lower() or word_pick.title() == random_choice:
    print("Congrats, you have picked the right word.")

I am talking about the first if statement, how do i do not == random_choice ??? So i wanna do if word_pick is not in random_choice, then minus the score by 5

PLZ HELPP




Aucun commentaire:

Enregistrer un commentaire