K0RB1 commited on
Commit
674e800
·
verified ·
1 Parent(s): 167b41c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import streamlit as st
3
+
4
+
5
+ st.title("Welcome To Person Guessing Game!!")
6
+ st.header("Guess Well Play Well")
7
+
8
+
9
+ st.write("Here Is Your Choices: Gian, Kirby, Francys, JK, Cielo, Arki, Basti, Mico, and Jhay.")
10
+ st.write("I will describe a person, and you need to guess who it is by thier characteristics.")
11
+ def guess():
12
+
13
+ people = {
14
+ "Gian": ["Smart", "small", "hyper"],
15
+ "Kirby": ["small", "loyal", "Loves badminton"],
16
+ "Francys": ["serious", "smart", "quiet"],
17
+ "JK": ["tall", "foot fetish", "talkative"],
18
+ "Cielo": ["quiet", "Loves to watch peppapig", "Enjoys editing"],
19
+ "Arki": ["talkative", "Loves blue by yung kai", "enjoys coding"],
20
+ "Basti": ["Music lover", "tall", "Enjoys jamming with friends"],
21
+ "Mico": ["smart", "Good at editing", "Enjoys coding"],
22
+ "Jhay": ["kind", "Always making others laugh", "Loves to make friends laugh"]
23
+ }
24
+
25
+
26
+
27
+ names = list(people.keys())
28
+ characteristics = list(people.values())
29
+
30
+
31
+ index = random.randint(0, len(names) - 1)
32
+ chosen_name = names[index]
33
+ description = characteristics[index]
34
+
35
+ attempts = 0
36
+ max_attempts = 5
37
+
38
+ st.write("\nHere's the description for the person:")
39
+ st.write(f"{description}")
40
+
41
+ while attempts < max_attempts:
42
+ guess = st.text_input("WHO DO YOU THINK IT IS?? ").strip()
43
+ attempts += 1
44
+
45
+
46
+ if guess.lower() == chosen_name.lower():
47
+ st.write(f"CONGRATULATIONS! YOU GUESSED IT CORRECTLY. IT'S {chosen_name}.")
48
+ break
49
+ else:
50
+ if attempts > max_attempts:
51
+ st.write("That's not correct. Try again!")
52
+ else:
53
+ st.write(f"SORRY, YOUR'E RUN OUT OF ATTEMPS. THE CORRECT ANSWER WAS {chosen_name}.")
54
+
55
+ st.write(f"THANKS FOR PlAYING!!")
56
+
57
+
58
+ guess()