Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
alesanchezr merged 92 commits into4GeeksAcademy:masterfromespvtes:master
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
92 commits
Select commitHold shift + click to select a range
67ee21f
first
espvtesAug 22, 2019
b82a5cd
first exercise
espvtesAug 23, 2019
eb604f6
04 and 05 exercise
espvtesAug 23, 2019
2424cd9
readme 06-07
espvtesAug 23, 2019
cb54cba
readme 07
espvtesAug 23, 2019
38957a5
readme
espvtesAug 23, 2019
74cb069
07
espvtesAug 25, 2019
cd2c772
08 exercise
espvtesAug 25, 2019
2745c9c
10 exercise
espvtesAug 25, 2019
bc1957d
06 exercises
espvtesAug 25, 2019
a7e833e
05 exercises
espvtesAug 25, 2019
ada3598
test of exercises
espvtesAug 27, 2019
0ab6f48
01 exercises readme
espvtesAug 27, 2019
974e4b5
05 readme and app.py
espvtesAug 28, 2019
8ad5b11
08 exercise
espvtesAug 28, 2019
86784c1
11 exercise
espvtesAug 28, 2019
6a52d57
app.py 05
espvtesSep 2, 2019
197c627
def function assign random number
espvtesSep 2, 2019
298deb2
add random number to the list
espvtesSep 2, 2019
37535f2
print the las random number
espvtesSep 2, 2019
b307bf1
loop form 1 to 17
espvtesSep 2, 2019
df7c943
print the all values of the list looping
espvtesSep 2, 2019
fe0b728
flip list
espvtesSep 2, 2019
e74ad3b
looping 2 by 2
espvtesSep 2, 2019
dc10b07
lopping from half to end
espvtesSep 2, 2019
6ef9122
change value, set value, reversed list
espvtesSep 2, 2019
dabba92
finding position from the list
espvtesSep 2, 2019
45edd22
readme counter letter
espvtesSep 2, 2019
e904e75
counter letter
espvtesSep 2, 2019
2cdf18f
readme 15
espvtesSep 2, 2019
a3b5437
flip list
espvtesSep 3, 2019
cfb3687
type of valie
espvtesSep 3, 2019
d91cb00
readme 17
espvtesSep 3, 2019
36c0b2b
sum the all values from the list
espvtesSep 4, 2019
b805af3
readme of 19 exercise
espvtesSep 4, 2019
ab5a349
sum odd items from the list
espvtesSep 4, 2019
33eb78d
conditional examples
espvtesSep 4, 2019
28d5812
readme 22
espvtesSep 4, 2019
c68311e
merge list function
espvtesSep 4, 2019
9629d49
readme divide and conquer
espvtesSep 4, 2019
f2b0534
25 divide and conquer
espvtesSep 4, 2019
bbd4269
readme max integer from list
espvtesSep 4, 2019
8bfa654
max integer from 26
espvtesSep 4, 2019
1fd23ec
readme min value
espvtesSep 4, 2019
6f026b2
minimum number
espvtesSep 4, 2019
87d0a24
test 03, 04 and 05
espvtesSep 5, 2019
6091bd1
test py
espvtesSep 5, 2019
63544c0
test exercises
espvtesSep 5, 2019
18c6581
readme 29
espvtesSep 6, 2019
9ba7c0f
readme 30
espvtesSep 6, 2019
3752098
exercises
espvtesSep 6, 2019
3219a0d
for loop pytest
espvtesSep 6, 2019
b18ae5a
change the numbers of exercises
espvtesSep 7, 2019
026e2e3
test exercises
espvtesSep 7, 2019
8b30200
readmes
espvtesSep 9, 2019
e830d89
10.1 exercises
espvtesSep 9, 2019
e1eb9cd
loop dict iteration
espvtesSep 9, 2019
b584348
12.1 exercise
espvtesSep 10, 2019
2925328
12.2 map function inside
espvtesSep 10, 2019
8d3768f
readmes
espvtesSep 10, 2019
29b696d
13
espvtesSep 10, 2019
bf70290
13.2 readme
espvtesSep 10, 2019
fb28fdf
13.3 filter list strings
espvtesSep 10, 2019
46ac8dc
filter function 13.1
espvtesSep 10, 2019
930b482
12.6 transformers
espvtesSep 11, 2019
c6578e9
12.3 data type
espvtesSep 11, 2019
241e1a5
12 map and list
espvtesSep 11, 2019
dd96ef7
12.5 yes and no
espvtesSep 11, 2019
855fc0d
13.2 exercises
espvtesSep 11, 2019
ef1b92f
readme
espvtesSep 11, 2019
9f991e3
readme
espvtesSep 11, 2019
a07a1a5
readme
espvtesSep 11, 2019
811d6e9
functions random numbers
espvtesSep 11, 2019
ad60a2d
readme
espvtesSep 11, 2019
3775b9a
readme
espvtesSep 12, 2019
98c4102
matrix builder
espvtesSep 12, 2019
b47aabe
readme
espvtesSep 12, 2019
e7f594c
test loop list
espvtesSep 12, 2019
5e18f8c
pytest 02.4
espvtesSep 13, 2019
63e7c30
pytest 2.4
espvtesSep 13, 2019
69d0565
test flip list
espvtesSep 13, 2019
f0f3887
mixed list
espvtesSep 13, 2019
648c074
pytest mixed list
espvtesSep 13, 2019
09c29c6
08.2 pytest
espvtesSep 14, 2019
b3cfd13
pytest exercises
espvtesSep 14, 2019
a8f3b5e
for loop exercises
espvtesSep 14, 2019
1a2584f
12.2 readme
espvtesSep 14, 2019
9583cf8
pytest exercises
espvtesSep 14, 2019
9730b61
pytest exercises
espvtesSep 14, 2019
606f85e
map list
espvtesSep 14, 2019
f0081a4
pytest
espvtesSep 15, 2019
8e95462
readme
espvtesSep 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletionsexercises/00-welcome/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
# Welcome to Python!

Welcome to the Python repl.it at 4Geeks Academy!!!



!["Welcome to python repl.it at 4Geeks Academy!!!"](https://i.udemycdn.com/course/750x422/95568_9c21_6.jpg)

20 changes: 20 additions & 0 deletionsexercises/01-hello-world/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop

This file was deleted.

31 changes: 31 additions & 0 deletionsexercises/01.1-Access-and-Retrieve/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff 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'];
```

![What is an list?](http://i.imgur.com/DbmSOHT.png)

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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
#Your code here, have fun:
22 changes: 22 additions & 0 deletionsexercises/01.5-loop-seventeen/test.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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
Loading

[8]ページ先頭

©2009-2025 Movatter.jp