forked from ActoSoft/DjangoCourse-PythonExercisesPt.1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtic_tac_toe.py
More file actions
50 lines (35 loc) · 1.32 KB
/
tic_tac_toe.py
File metadata and controls
50 lines (35 loc) · 1.32 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
from random import randint
print('''BIENVENIDO AL JUEGO DE PIEDRA PAPEL O TIJERA''')
selection = 'Si'
while selection == 'Si':
usuario = input('Elije una opción Piedra, Papel o Tijera: ')
num_rand = randint(1,100)
if num_rand > 1 and num_rand < 33:
opcion_1 = 'Tijera'
print(f'La cpu ha elegido {opcion_1}')
if usuario == 'Tijera':
print('¡Es un empate!')
elif usuario == 'Piedra':
print('Felicitaciones, has ganado')
else:
print('Has perdido ;(, vuelve a intentarlo')
elif num_rand > 33 and num_rand < 66:
opcion_2 = 'Piedra'
print(f'La cpu ha elegido {opcion_2}')
if usuario == 'Tijera':
print('Has perdido ;(, vuelve a intentarlo')
elif usuario == 'Papel':
print('Felicitaciones, has ganado')
else:
print('¡Es un empate!')
else:
opcion_3 = 'Papel'
print(f'La cpu ha elegido {opcion_3}')
if usuario == 'Tijera':
print('Felicitaciones, has ganado')
elif usuario == 'Piedra':
print('Has perdido ;(, vuelve a intentarlo')
else:
print('¡Es un empate!')
selection = input('¿Quieres volver a jugar?\n [Si/No] ')
print('Hasta la vista baby!')