Skip to content

Commit 5f0bf19

Browse files
committed
doc: add comments
Exercises on modules with comments.
1 parent c8db648 commit 5f0bf19

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

ex019.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,19 @@
88
list = [name_one, name_two, name_three, name_four]
99
chosen = random.choice(list)
1010
print(f'The student chosen to erase the board is {chosen}.')
11+
12+
13+
#19: Um professor quer sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que ajude ele, lendo o
14+
#nome dos alunos e escrevendo na tela o nome do escolhido.
15+
'''import random
16+
primeiro = str(input('Qual o nome do primeiro aluno:'))
17+
segundo = str(input('Qual o nome do segundo aluno:'))
18+
terceiro = str(input('Qual o nome do terceiro aluno:'))
19+
quarto = str(input('Qual o nome do quarto aluno:'))
20+
lista = [primeiro, segundo, terceiro, quarto]
21+
print(f'O aluno escolhido foi: {random.choice(lista)}')'''
22+
23+
#PT- Foi preciso importar o ramdom para misturar os dados da lista (e criar a lista) depois pedir ao programa para escolher
24+
#um dos dados informados da lista pelo comando choise.
25+
#EN-It was necessary to import the ramdom to mix the data from the list (and create the list) and then ask the program to
26+
# choose one of the data provided in the list by the choise command.

ex020.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
#20- The same teacher from challenge 19 wants to draw the order in which the students' work will be presented. Make a program that
22
# read the names of the four students and show the order drawn.
3-
import random
3+
'''import random
44
first_name = str(input('First students name:'.strip()))
55
second_name = str(input('Second students name:'.strip()))
66
third_name = str(input('Third students name:'.strip()))
77
fourth_name = str(input('Fourth students name:'.strip()))
88
list = [first_name, second_name, third_name, fourth_name]
99
random.shuffle(list)
1010
print('The order of presentation of students will be:')
11-
print(list)
11+
print(list)'''
12+
13+
14+
#20: O mesmo professor do desafio 19 quer sortear a ordem de apresentação de trabalhos dos alunos. Faça um programa
15+
#que leia o nome dos quatro alunos e mostre a ordem sorteada.
16+
import random
17+
primeiro = str(input('Digite o nome do primeiro aluno:'))
18+
segundo = str(input('Digite o nome do segundo aluno:'))
19+
terceiro = str(input('Digite o nome do terceiro aluno:'))
20+
quarto = str(input('Digite o nome do quarto aluno:'))
21+
lista = [primeiro, segundo, terceiro, quarto]
22+
random.shuffle(lista)
23+
print(f'A ordem de apresentação dos trabalhos será: {lista}')

ex021.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@
55
pygame.mixer.music.load('nana.mp3')
66
pygame.mixer.music.play()
77
pygame.quit()
8+
9+
10+
#21: Faça um programa em Python que abra e reproduza o áudio de um arquivo MP3.
11+
import pygame
12+
pygame.init()
13+
pygame.mixer.init()
14+
pygame.mixer.music.load('nana.mp3')
15+
pygame.mixer.music.play()
16+
pygame.quit()
17+
18+
#PT- Treinando o uso de modulos, no caso math.
19+
#EN- Training the use of modules, in this case math

0 commit comments

Comments
 (0)