- Notifications
You must be signed in to change notification settings - Fork246
This is the python_exercises_list#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
92 commits Select commitHold shift + click to select a range
67ee21f
first
espvtesb82a5cd
first exercise
espvteseb604f6
04 and 05 exercise
espvtes2424cd9
readme 06-07
espvtescb54cba
readme 07
espvtes38957a5
readme
espvtes74cb069
07
espvtescd2c772
08 exercise
espvtes2745c9c
10 exercise
espvtesbc1957d
06 exercises
espvtesa7e833e
05 exercises
espvtesada3598
test of exercises
espvtes0ab6f48
01 exercises readme
espvtes974e4b5
05 readme and app.py
espvtes8ad5b11
08 exercise
espvtes86784c1
11 exercise
espvtes6a52d57
app.py 05
espvtes197c627
def function assign random number
espvtes298deb2
add random number to the list
espvtes37535f2
print the las random number
espvtesb307bf1
loop form 1 to 17
espvtesdf7c943
print the all values of the list looping
espvtesfe0b728
flip list
espvtese74ad3b
looping 2 by 2
espvtesdc10b07
lopping from half to end
espvtes6ef9122
change value, set value, reversed list
espvtesdabba92
finding position from the list
espvtes45edd22
readme counter letter
espvtese904e75
counter letter
espvtes2cdf18f
readme 15
espvtesa3b5437
flip list
espvtescfb3687
type of valie
espvtesd91cb00
readme 17
espvtes36c0b2b
sum the all values from the list
espvtesb805af3
readme of 19 exercise
espvtesab5a349
sum odd items from the list
espvtes33eb78d
conditional examples
espvtes28d5812
readme 22
espvtesc68311e
merge list function
espvtes9629d49
readme divide and conquer
espvtesf2b0534
25 divide and conquer
espvtesbbd4269
readme max integer from list
espvtes8bfa654
max integer from 26
espvtes1fd23ec
readme min value
espvtes6f026b2
minimum number
espvtes87d0a24
test 03, 04 and 05
espvtes6091bd1
test py
espvtes63544c0
test exercises
espvtes18c6581
readme 29
espvtes9ba7c0f
readme 30
espvtes3752098
exercises
espvtes3219a0d
for loop pytest
espvtesb18ae5a
change the numbers of exercises
espvtes026e2e3
test exercises
espvtes8b30200
readmes
espvtese830d89
10.1 exercises
espvtese1eb9cd
loop dict iteration
espvtesb584348
12.1 exercise
espvtes2925328
12.2 map function inside
espvtes8d3768f
readmes
espvtes29b696d
13
espvtesbf70290
13.2 readme
espvtesfb28fdf
13.3 filter list strings
espvtes46ac8dc
filter function 13.1
espvtes930b482
12.6 transformers
espvtesc6578e9
12.3 data type
espvtes241e1a5
12 map and list
espvtesdd96ef7
12.5 yes and no
espvtes855fc0d
13.2 exercises
espvtesef1b92f
readme
espvtes9f991e3
readme
espvtesa07a1a5
readme
espvtes811d6e9
functions random numbers
espvtesad60a2d
readme
espvtes3775b9a
readme
espvtes98c4102
matrix builder
espvtesb47aabe
readme
espvtese7f594c
test loop list
espvtes5e18f8c
pytest 02.4
espvtes63e7c30
pytest 2.4
espvtes69d0565
test flip list
espvtesf0f3887
mixed list
espvtes648c074
pytest mixed list
espvtes09c29c6
08.2 pytest
espvtesb3cfd13
pytest exercises
espvtesa8f3b5e
for loop exercises
espvtes1a2584f
12.2 readme
espvtes9583cf8
pytest exercises
espvtes9730b61
pytest exercises
espvtes606f85e
map list
espvtesf0081a4
pytest
espvtes8e95462
readme
espvtesFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletionsexercises/00-welcome/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Welcome to Python! | ||
Welcome to the Python repl.it at 4Geeks Academy!!! | ||
 | ||
20 changes: 20 additions & 0 deletionsexercises/01-hello-world/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# `01` Hello World | ||
In Python, we use `print` to make the computer write anything we want (the content of a variable, a given string, etc.) | ||
in something called `"the console".` | ||
Every language has a console, as it was the only way to interact with the users at the beginning | ||
(before the Windows or MacOS arrived). Today, printing in the console is used mostly as a | ||
monitoring tool, ideal to leave a trace of the content of variables during the program execution. | ||
This is an example of how to use it: | ||
```py | ||
print("How are you?") | ||
``` | ||
📝 Instructions: | ||
```md | ||
Use the `print()` function to print `"Hello World"` on the console. Feel free to try other things as well. | ||
``` | ||
5 changes: 5 additions & 0 deletionsexercises/01-hello-world/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#You have to print `hello` in the console, your code go here: | ||
print("Hello World") | ||
36 changes: 36 additions & 0 deletionsexercises/01-hello-world/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import io | ||
import sys | ||
import os | ||
sys.stdout = buffer = io.StringIO() | ||
# from app import my_function | ||
import pytest | ||
import app | ||
# @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 | ||
@pytest.mark.it("Output 'Hello World'") | ||
def test_output(): | ||
captured = buffer.getvalue() | ||
assert "Hello World\n" in captured | ||
# convert everything in the buffer to lower case, captured to lower case | ||
@pytest.mark.it("Use print function") | ||
def test_print(): | ||
f = open(os.path.dirname(os.path.abspath(__file__)) + '/app.py') | ||
content = f.read() | ||
assert content.find("print") > 0 |
1 change: 0 additions & 1 deletionexercises/01-welcome/README.md
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
31 changes: 31 additions & 0 deletionsexercises/01.1-Access-and-Retrieve/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# `01.1` Access and retirve | ||
# 📝Instructions from your teacher: | ||
Lists are part of every programming language. They are the way to go when you want to have a "list of elements." | ||
For example, we could have an array that is storing the days of the week: | ||
```js | ||
my_list = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; | ||
``` | ||
 | ||
Every list has the following parts: | ||
- `Items:` are the actual values inside on each position of the list. | ||
- `Length:` is the size of the list, the number of items. | ||
- `Index:` is the position of an element. | ||
```py | ||
To access any particular item within the array you need to know its index (position). | ||
The index is an integer value that represents the position in which the element is located. | ||
Protip: Every array starts from cero (0)! | ||
``` | ||
## 📝 Instructions | ||
1. Using the print() function, print the 3rd item from the list. | ||
2. Change the value in the position where 'Thursday' is located to None. | ||
3. Print the particular position of the step two. | ||
10 changes: 10 additions & 0 deletionsexercises/01.1-Access-and-Retrieve/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
my_list = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday'] | ||
#1. print the item here | ||
#2. change 'thursday'a value here to None | ||
#3. print the position of step 2 | ||
22 changes: 22 additions & 0 deletionsexercises/01.1-Access-and-Retrieve/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import io | ||
import sys | ||
sys.stdout = buffer = io.StringIO() | ||
from app import my_list | ||
import pytest | ||
@pytest.mark.it('Your console have to print the 3rd item from the `list`') | ||
def test_output_one(): | ||
print(my_list[2]) | ||
captured = buffer.getvalue() | ||
assert "tuesday\n" in captured | ||
@pytest.mark.it('Your code have to print the position of step 2') | ||
def test_output_two(): | ||
print(my_list[2]) | ||
captured = buffer.getvalue() | ||
assert "None\n" in captured | ||
@pytest.mark.it('Set index[4] to None') | ||
def test_position_two(): | ||
assert my_list[4] is None |
13 changes: 13 additions & 0 deletionsexercises/01.2-Retrieve-items/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# `01.2` Retrieve items | ||
The only way of accessing a particular element in an `list`(in python), is using an index. | ||
An `index` is an integer number that represents the `position` you want to access in the list. | ||
You need to `wrap` the index into `brackets` like this: | ||
```js | ||
my_value = list[index]; | ||
``` | ||
## 📝 Instructions | ||
1. Print on the console the 1st element of the list | ||
2. Print on the console the 4th element of the list |
5 changes: 5 additions & 0 deletionsexercises/01.2-Retrieve-items/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23] | ||
#output the 1st and 4th element from the list: | ||
20 changes: 20 additions & 0 deletionsexercises/01.2-Retrieve-items/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import io | ||
import sys | ||
sys.stdout = buffer = io.StringIO() | ||
from app import my_list | ||
import pytest | ||
@pytest.mark.it('You have to print the 1st element of the list') | ||
def test_output_one(): | ||
print(my_list[0]) | ||
captured = buffer.getvalue() | ||
assert "4\n" in captured | ||
@pytest.mark.it('You have to print the 4th element of the list') | ||
def test_output_fourd(): | ||
print(my_list[3]) | ||
captured = buffer.getvalue() | ||
assert "43\n" in captured | ||
21 changes: 21 additions & 0 deletionsexercises/01.3-Print-the-last-one/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# `01.3` Print the last one | ||
You will never know how many `items` my_stupid_list has because it is being `randomly` generated during runtime. | ||
You know that the property: | ||
```py | ||
len(name_list) function | ||
``` | ||
returns the `length of` name_list . | ||
## 📝 Instructions | ||
1. Create a variable named the_last_one, and assign it the LAST element of my_stupid_list. | ||
2. Then, print it on the console. | ||
💡Hint: | ||
```py | ||
-Remember import random function | ||
-Ask to Google How import random in python? | ||
``` |
14 changes: 14 additions & 0 deletionsexercises/01.3-Print-the-last-one/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#You have to import random function | ||
def generate_random_list(): | ||
aux_list = [] | ||
randonlength = random.randint(1, 100) | ||
for i in range(randonlength): | ||
aux_list.append(randonlength) | ||
i += i | ||
return aux_list | ||
my_stupid_list = generate_random_list() | ||
#Feel happy to write the code below, good luck: |
26 changes: 26 additions & 0 deletionsexercises/01.3-Print-the-last-one/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import io | ||
import sys | ||
import app | ||
import pytest | ||
import os | ||
from app import the_last_one | ||
sys.stdout = buffer = io.StringIO() | ||
# @pytest.mark.it("create and assign the value to the variable the_last_one") | ||
# def test_create_assign(): | ||
# assert app.the_last_one is not None | ||
# @pytest.mark.it("print in the console the_last_one") | ||
# def test_output(): | ||
# captured = buffer.getvalue() | ||
# assert str(app.the_last_one) in captured | ||
@pytest.mark.it("Import random function") | ||
def test_import_random(): | ||
f = open(os.path.dirname(os.path.abspath(__file__)) + '/app.py') | ||
content = f.read() | ||
assert content.find("import random") > 0 |
16 changes: 16 additions & 0 deletionsexercises/01.4-Add-item-to-list/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# `01.4` Add items to the list | ||
# 📝Instructions | ||
1. Add 10 random integers to the "arr" list. | ||
💡Tips: | ||
You have to `import random` function. | ||
Use the `random()` function to get random numbers. | ||
Search on Google how to use random function. | ||
Expected in the console something similar like this: | ||
```py | ||
[4, 5, 734, 43, 45, 36, 2, 88, 12, 87, 79, 96, 58, 46, 7] | ||
``` |
10 changes: 10 additions & 0 deletionsexercises/01.4-Add-item-to-list/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#Remember import random function here: | ||
import random | ||
my_list = [4,5,734,43,45] | ||
#The magic is here: | ||
print(my_list) |
24 changes: 24 additions & 0 deletionsexercises/01.4-Add-item-to-list/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import io | ||
import sys | ||
sys.stdout = buffer = io.StringIO() | ||
import pytest | ||
import app | ||
import os | ||
import random | ||
from app import my_list | ||
@pytest.mark.it("Add ten random numbers to the list") | ||
def test_add_numb(): | ||
assert app.my_list.append(random.randint(1, 100)) is not None | ||
@pytest.mark.it("Output of the list with 15 items numbers") | ||
def test_output(): | ||
captured = buffer.getvalue() | ||
assert str(app.my_list) in captured | ||
@pytest.mark.it("Import random function") | ||
def test_import_random(): | ||
f = open(os.path.dirname(os.path.abspath(__file__)) + '/app.py') | ||
content = f.read() | ||
assert content.find("import random") > 0 |
31 changes: 31 additions & 0 deletionsexercises/01.5-loop-seventeen/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# `01.5` Loop from 1 to 17 | ||
# 📝Instructions from your teacher: | ||
1. Count from 1 to 17 with a loop and print each number on the console. | ||
💡HINT: | ||
1. This how you loop | ||
`https://www.w3schools.com/python/python_for_loops.asp` | ||
Expected console result: | ||
```py | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11 | ||
12 | ||
13 | ||
14 | ||
15 | ||
16 | ||
17 | ||
``` |
1 change: 1 addition & 0 deletionsexercises/01.5-loop-seventeen/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Your code here, have fun: |
22 changes: 22 additions & 0 deletionsexercises/01.5-loop-seventeen/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import io | ||
import sys | ||
sys.stdout = buffer = io.StringIO() | ||
import os | ||
import pytest | ||
import app | ||
@pytest.mark.it("Output from 1 to 17") | ||
def test_output(): | ||
captured = buffer.getvalue() | ||
assert "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n" in captured | ||
@pytest.mark.it("Make sure that you use for loop!!!") | ||
def test_for_loop(): | ||
f = open(os.path.dirname(os.path.abspath(__file__))+'/app.py') | ||
content = f.read() | ||
assert content.find("for") > 0 |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.