Skip to content

Commit 3ba548a

Browse files
committed
doc: add comments
Conditional exercises (if, elif, else). Guessing game v1.0.
1 parent 1ee3a83 commit 3ba548a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ex028.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#Guessing Game v.1.0
12
#28- Write a program that makes the computer "think" of an integer between 0 and 5 and ask the user to try
23
# find out which number was chosen by the computer. The program should write on the screen whether the user won or
34
# it lost.
@@ -11,3 +12,19 @@
1112
print('CONGRATULATIONS! You beat me.')
1213
else:
1314
print(f'I WON!!!!! I thought about the number {computer} and not in {player}!')
15+
16+
17+
#Jogo da Adivinhação v.1.0
18+
#28: Escreva um programa que faça o computador "pensar" em um número inteiro entre 0 e 5 e peça para o usuário tentar
19+
#descobrir qual foi o número escolhido pelo computador. O programa deverá escrever na tela se o usuário venceu ou perdeu
20+
from random import randint
21+
computador = randint(0,5)
22+
print('Estou pensanem em um número de 0 a 5, tente adivinhar qual é...')
23+
jogador = int(input('Qual número eu pensei?'))
24+
if jogador == computador:
25+
print('Parabéns você acertou!')
26+
else:
27+
print(f'Você perdeu. Eu pensei no {computador} e não no {jogador}.')
28+
29+
#PT- Exercícios com uso de condicional.
30+
#EN- Exercises using conditional.

0 commit comments

Comments
 (0)