can this be done in python 35 import random def welcome prin
can this be done in python 3.5
import random
def welcome():
print(\'-----------------------------\')
print( \'| Welcome to Cows and Bulls |\')
print( \'-----------------------------\')
print()
def main():
welcome()
# Write the rest of code here.
main()
Solution
import random
def welcome():
print(\'-----------------------------\')
print( \'| Welcome to Cows and Bulls |\')
print( \'-----------------------------\')
#function that generate unique 3 digit random number
def generate_num():
gen_num = []
i = 0
while i <=2
rand_value = random.randrange(0,9)
if gen_num.count(rand_value) == 0:
gen_num.append(rand_value)
i = i + 1
return gen_num
#function to check user input and random number
def check(input, number):
i = 0
bulls = 0
cows = 0
while i <=2
if number[i] == int(input[i]):
bulls = bulls + 1
elif int(input[i]) in number:
cows = cows + 1
i=i+1
print(str(cows) + \"cows ,\" + str(bulls) + \"bulls\")
if bulls == 3:
return True
else:
return False
#main function
def main()
welcome()
number = generate_num()
input = \"\"
guesses = 0
while input != number
input = raw_input(\"Guess: \")
guesses = guesses + 1
if check(input, number) is True:
print (\"you got it!\")
print (\"\ It took you\" + str(guesses) + \"guesses to guess the secret number\" + str(number))
main()

