Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
906fbcf
initialized project and exercise 01
plucodev Sep 18, 2019
f3e1eda
initialized exercise 02
plucodev Sep 18, 2019
aa0b223
initialized exercise 03
plucodev Sep 18, 2019
cba4e25
initialized exercise 04
plucodev Sep 18, 2019
4ca3ef5
initialized exercise 05
plucodev Sep 18, 2019
666c6ce
initialized exercise 06
plucodev Sep 18, 2019
cccf689
initialized exercise 07
plucodev Sep 18, 2019
4806ba1
initialized exercise 08
plucodev Sep 18, 2019
dde938a
initialized exercise 09
plucodev Sep 18, 2019
76b27dc
initialized exercise 10
plucodev Sep 18, 2019
d772cfe
initialized exercise 11
plucodev Sep 18, 2019
7d3f565
initialized exercise 12
plucodev Sep 18, 2019
8764cbb
initialized exercise 13
plucodev Sep 18, 2019
271cca9
initialized exercise 14
plucodev Sep 18, 2019
8856354
initialized exercise 15
plucodev Sep 18, 2019
1eb01f5
initialized exercise 16
plucodev Sep 18, 2019
7244acd
initialized exercise 17
plucodev Sep 18, 2019
70bada7
initialized exercise 18
plucodev Sep 18, 2019
1502e98
initialized exercise 19
plucodev Sep 18, 2019
cd664d4
initialized exercise 20
plucodev Sep 18, 2019
e843f35
initialized exercise 21
plucodev Sep 18, 2019
ab4ddd5
initialized exercise 22
plucodev Sep 18, 2019
a059306
initialized exercise 23
plucodev Sep 18, 2019
63dc9ae
initialized exercise 24
plucodev Sep 18, 2019
3c319f3
initialized exercise 25
plucodev Sep 18, 2019
04db4e3
updated README 01 for Python
plucodev Sep 18, 2019
7830642
updated README 02 for Python
plucodev Sep 18, 2019
96c1a7f
fixed issues
plucodev Sep 18, 2019
199048f
completed 01
plucodev Sep 18, 2019
2331eb7
completed 01
plucodev Sep 18, 2019
b7b45a8
completed 02
plucodev Sep 18, 2019
863093f
completed 03-04-07 and fixed issues
plucodev Sep 18, 2019
494baf0
fixed issues 07
plucodev Sep 18, 2019
67d5020
completed 08
plucodev Sep 19, 2019
6780d10
fixed issues 08
plucodev Sep 19, 2019
f663440
updated 00
plucodev Sep 20, 2019
9935509
updated 05
plucodev Sep 24, 2019
6521ffa
updated 09
plucodev Sep 24, 2019
40c3e55
updated 10
plucodev Sep 24, 2019
6eec555
updated 11
plucodev Sep 24, 2019
c5b19f3
updated 12
plucodev Sep 24, 2019
14e0788
updated 13
plucodev Sep 25, 2019
ecaaa72
updated 13 and 14
plucodev Sep 25, 2019
6f79798
updated 17
plucodev Sep 25, 2019
ddbbdc8
updated 15
plucodev Sep 26, 2019
544913e
updated 16
plucodev Sep 26, 2019
17448f5
updated 13
plucodev Sep 26, 2019
5d7c381
updated 14
plucodev Sep 26, 2019
c88878a
updated 18
plucodev Sep 26, 2019
790bff9
updated 20
plucodev Sep 26, 2019
7a74ef8
updated 21
plucodev Sep 26, 2019
640bd6f
updated 12
plucodev Sep 26, 2019
4698f63
updated 21
plucodev Sep 26, 2019
5fe14a6
updated 22
plucodev Sep 26, 2019
c7fe498
updated 23
plucodev Sep 26, 2019
0feaf3f
updated 24
plucodev Sep 27, 2019
e4d881c
updated 25
plucodev Sep 27, 2019
69336d0
updated 25
plucodev Sep 27, 2019
79757da
updated 24
plucodev Sep 27, 2019
59eba4b
updated 23
plucodev Sep 27, 2019
8d2d02b
updated 21
plucodev Sep 27, 2019
ee9965f
updated 20
plucodev Sep 27, 2019
3f42207
updated 22
plucodev Sep 30, 2019
6946622
fixed issues 01-02-03-13
plucodev Oct 2, 2019
62db4c9
fixed issues 04
plucodev Oct 2, 2019
8cafcd7
fixed issues 05
plucodev Oct 2, 2019
7da8203
fixed issues 07
plucodev Oct 2, 2019
71d4172
fixed issues 08
plucodev Oct 2, 2019
a9520e7
fixed issues 09
plucodev Oct 2, 2019
5255d84
fixed issues 10
plucodev Oct 2, 2019
211f128
fixed issues 11
plucodev Oct 2, 2019
2e0bc06
fixed issues 12
plucodev Oct 2, 2019
e0d5a2a
fixed issues 12
plucodev Oct 2, 2019
1742933
fixed issues 13
plucodev Oct 2, 2019
ee37430
fixed issues 14-15-16
plucodev Oct 2, 2019
38d4e0e
fixed issues 17-18-19
plucodev Oct 4, 2019
0fb467b
fixed issues 21
plucodev Oct 4, 2019
f51d6be
fixed issues 22
plucodev Oct 4, 2019
f980101
fixed issues 23
plucodev Oct 4, 2019
e29047e
fixed issues 24 - 25
plucodev Oct 5, 2019
537d4e7
fixed issues 01 - 02
plucodev Oct 5, 2019
9dc7c9b
fixed issues 03
plucodev Oct 7, 2019
c9b5dc2
fixed issues 04
plucodev Oct 7, 2019
1fa2128
fixed issues 05
plucodev Oct 7, 2019
187af9f
deleted constant exercise
plucodev Oct 7, 2019
8500ea0
fixed genaral issues
plucodev Oct 7, 2019
98144e7
fixed issues 07-08-09-17-18
plucodev Oct 7, 2019
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
initialized exercise 20
  • Loading branch information
plucodev committed Sep 18, 2019
commit cd664d4539f2db40683d9ba72cc93c9416eab043
25 changes: 25 additions & 0 deletions exercises/20-Random-Colors-Loop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# `20` Random Colors (Loop)

We have created a function that returns a color based on a number between 1 and 4 (for any different number, it will return the color black).

## 📝 Instructions:

Let's say that we are teachers in a 10 student classroom and we want to randomly assign ONE color, between red, yellow, blue and green, to EACH student.

(only ONE color PER student)

1. Change the function "**getAllStudentColors**" so it returns an array of 10 colors, with each item in the array representing the color assigned to each student.

## 💡 Hint:

- You have 10 students, you need to loop 10 times.
- Each time you loop, generate a random number between 1-4 using the **Math.random()** function we saw on the last exercise.
- Use the "**getColor**" function on this exercise to get the color name from the number you get.
- Print the color on the console.

## IMPORTANT MESSAGE:

If you feel you are not understanding looping, its a good idea to complete the Arrays Exercises classroom and then come back here:
```sh
https://repl.it/classroom/invite/BB4WDpk
```
Empty file.
21 changes: 21 additions & 0 deletions exercises/20-Random-Colors-Loop/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import io
import sys
sys.stdout = buffer = io.StringIO()

from app import my_function
import pytest

@pytest.mark.it('Your code needs to print hello on the console')
def test_for_file_output(capsys):
captured = buffer.getvalue()
assert captured == "hello\n" #add \n because the console jumps the line on every print

@pytest.mark.it('Your function needs to print "Hello Inside Function" on the console')
def test_for_function_output(capsys):
my_function()
captured = capsys.readouterr()
assert captured.out == "Hello Inside Function\n"

@pytest.mark.it('Your function needs to return True')
def test_for_function_return(capsys):
assert my_function() == True