@AidanMundle/

# Guess the secret letter

## No description

Files
• main.py
main.py
```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
```
```#The file name is guess the secret letter.
#Created by Aidan Mundle on December 11, 2017
#This program is a short game where the CPU chooses a random letter, and you have to try to guess it. You start with 50 points, and when you get to zero you lose. For each group of letters where the secret letter is not found, you lose 10 points. If it does have the letter, you lose 5 points. To prove you know the letter, write it 5 times in a row. Have fun!!

import random
import time

secretnumber= random.randint(1,26) #secret number turn into the secret letter

# I prefer working wiht lists, so ALPHA is a list not a string

alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"",r","s","t","u","v","w","x","y","z"]

x=str(alpha[secretnumber-1])   #This is the secret letter

points=50

# introductory scentence

print("You have", points,"points to start. If you run out of points, the game is over. Guess the secret letter by entering it 5 or more times" )

# Give them some time to read the scentence
time.sleep(3)

# main body of the program

while points>=0:
print("You have",points,"points, enter your string:", end="")
guess= str(input(""))
count= guess.count(x)
if count>=5:
print("You have guessed the letter!!!")
break
#This next elif has a nested if statement so that it does not say there is one secret letterS(gramatic error)
elif count>=1 and count<5:
if count==1:
print("The string has",count,"secret letter")
points= points-5
else:
print("The string has",count,"secret letters")
points= points-5
else:
print("The string has",count,"secret letters")
points= points-10

print("Do you want to play again? Press CTRL + Enter")

```
Fetching token