Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@mahyess
mahyess / cows_and_bulls.py
Created October 21, 2019 08:31
A number guessing game.
'''Randomly generate a 4-digit number. Ask the user to guess a 4-digit number.
For every digit that the user guesses correctly in the correct place, they have a “cow”.
For every digit the user guesses correctly in the wrong place is a “bull.”
Every time the user makes a guess, tell them how many “cows” and “bulls” they have.
Once the user guesses the correct number, the game is over.'''
import random
#Computer chooses random number, and we turn that number into a string, which we will need later.
def guess():