-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject3.py
More file actions
70 lines (58 loc) · 2.22 KB
/
Copy pathproject3.py
File metadata and controls
70 lines (58 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###########################
## PART 10: Simple Game ###
### --- CODEBREAKER --- ###
## --Nope--Close--Match-- ##
###########################
# It's time to actually make a simple command line game so put together everything
# you've learned so far about Python. The game goes like this:
# 1. The computer will think of 3 digit number that has no repeating digits.
# 2. You will then guess a 3 digit number
# 3. The computer will then give back clues, the possible clues are:
#
# Close: You've guessed a correct number but in the wrong position
# Match: You've guessed a correct number in the correct position
# Nope: You haven't guess any of the numbers correctly
#
# 4. Based on these clues you will guess again until you break the code with a
# perfect match!
# There are a few things you will have to discover for yourself for this game!
# Here are some useful hints:
# Try to figure out what this code is doing and how it might be useful to you
print("The computer will think of 3 digit number that has no repeating digits")
print("You will then guess a 3 digit number")
print("The computer will then give back clues, the possible clues are:")
num = 1,2,3,4,5,6,7,8,9,0
import random
n = random.randint(1,10)
print([:3])
# guess = input("What is your guess? ")
# def guessed(num):
# def Match(digits):
# if guess == digits[:3] :
# print(Match)
# def Close(digits):
# if guess == (guess -1) or (guess +1) :
# print(Close)
# def Wrong(digits):
# if guess != digits[:3] :
# print(Wrong)
# return(guessed)
# print(guessed)
# import random
# n = random.randint(1, 99)
# guess = int(raw_input("Enter an integer from 1 to 99: "))
# while n != "guess":
# print
# if guess < n:
# print('guess is low')
# guess = int(raw_input("Enter an integer from 1 to 99: "))
# elif guess > n:
# print('guess is high')
# guess = int(raw_input("Enter an integer from 1 to 99: "))
# else:
# print ('you guessed it!')
# break
# print
# Another hint:
# Think about how you will compare the input to the random number, what format
# should they be in? Maybe some sort of sequence? Watch the Lecture video for more hints!