I need help with a small game

from random import randint

guessesTaken = 0
randomNumber =

for x in range(4):
tempNumber = randint(1, 9)
randomNumber.append(tempNumber)

def gus():
global Guess
Guess =
Guess.append(int(input("Guess Number: ")))
Guess.append(int(input("Guess Number: ")))
Guess.append(int(input("Guess Number: ")))
Guess.append(int(input("Guess Number: ")))
print(Guess)
guessesTaken =+ 1
randow()

print (randomNumber)

def randow():
check =
if randomNumber[0] == Guess[0]:
print(“Y”)
check.append(‘Y’)
else:
print(‘N’)
if randomNumber[1] == Guess[1]:
print(“Y”)
check.append(‘Y’)
else:
print(‘N’)
if randomNumber[2] == Guess[2]:
print(“Y”)
check.append(‘Y’)
else:
print(‘N’)
if randomNumber[3] == Guess[3]:
print(“Y”)
check.append(‘Y’)
else:
print(‘N’)

if check == False:
if check[0] == ‘Y’:
if check[1] == ‘Y’:
if check[2] == ‘Y’:
if check[3] == ‘Y’:
print(‘You are a mastermind’)
print(guessesTaken)

else:
gus()

gus()

this is giving me trouble because i cant print ‘You are a mastermind’ and how many guesses were taken

Something that can help you is moving your code to a Markdown code block. See this example:

```
{all your code here, formatted}
```

Also, take care of the indentation!

You wrote:

if check == False:
  if check[0] == 'Y':
    if check[1] == 'Y':
      if check[2] == 'Y':
        if check[3] == 'Y':
          print('You are a mastermind')
          print(guessesTaken)

Then:

[…]
this is giving me trouble because i cant print ‘You are a mastermind’
and how many guesses were taken

Doesn’t if check == False imply that the other things can never be
true? i.e. you’re only looking for lots of Ys when you know there are
not any.

1: Drop the if check == False, see what happens.

2: Better to write: if not check for that test (but as I remark, I
think that test is breaking things for you).

3: You should really pass a lot of this stuff around as function
parameters instead of globals. Tackle that later.

Cheers,
Cameron Simpson cs@cskk.id.au

it’s all indented, it posted it all on one side for some reason.

i am a bit confused because im still new to python. can you give me an example or give me sites where i can figure this out on my own.

That’s where a code block will help you (see my comment above).