From cf04d6bd45a4a6362d979f7a68f3b0fe902ff87a Mon Sep 17 00:00:00 2001 From: adriancastro626 Date: Tue, 30 Mar 2021 05:30:43 +0000 Subject: [PATCH 1/2] practica --- exercises/02-Hello-World/app.py | 4 +++- exercises/03-What-is-a-function/app.py | 2 ++ exercises/04-Call-a-function/app.py | 11 ++++++++++- exercises/05-Defining-vs-Calling-a-function/app.py | 5 +++++ exercises/06-lambda-functions/app.py | 3 +++ exercises/07-lambda-function-two/app.py | 2 +- exercises/08-Function-that-returns/app.py | 12 +++++++++--- exercises/09-Function-parameters/app.py | 11 +++++++++-- exercises/10-Array-Methods/app.py | 4 ++++ 9 files changed, 46 insertions(+), 8 deletions(-) diff --git a/exercises/02-Hello-World/app.py b/exercises/02-Hello-World/app.py index 801de24..7dc0435 100644 --- a/exercises/02-Hello-World/app.py +++ b/exercises/02-Hello-World/app.py @@ -1 +1,3 @@ -# your code here \ No newline at end of file +# your code here + +print("Hello World") \ No newline at end of file diff --git a/exercises/03-What-is-a-function/app.py b/exercises/03-What-is-a-function/app.py index 551610b..c3be814 100755 --- a/exercises/03-What-is-a-function/app.py +++ b/exercises/03-What-is-a-function/app.py @@ -2,7 +2,9 @@ def sum(number1,number2): return number1 + number2 total = sum(2,3) +super_duper = sum(3445324,53454423) print(total) +print(super_duper) diff --git a/exercises/04-Call-a-function/app.py b/exercises/04-Call-a-function/app.py index c856d48..9b561f6 100755 --- a/exercises/04-Call-a-function/app.py +++ b/exercises/04-Call-a-function/app.py @@ -1,4 +1,13 @@ def calculate_area(length,edge): return length * edge -# Your code Below this line: \ No newline at end of file +# Your code Below this line: + +square_area1 = calculate_area(4,4) +square_area2 = calculate_area(2,2) +square_area3 = calculate_area(5,5) + +print(square_area1) +print(square_area2) +print(square_area3) + diff --git a/exercises/05-Defining-vs-Calling-a-function/app.py b/exercises/05-Defining-vs-Calling-a-function/app.py index 79b86d8..98962db 100755 --- a/exercises/05-Defining-vs-Calling-a-function/app.py +++ b/exercises/05-Defining-vs-Calling-a-function/app.py @@ -1,5 +1,10 @@ # Define the function called "multi" that expects 2 parameters: +def multi(a,b): + let = a * b + return let + + # don't edit anything below this line return_value = multi(7,53812212) print(return_value) \ No newline at end of file diff --git a/exercises/06-lambda-functions/app.py b/exercises/06-lambda-functions/app.py index e59626e..e574398 100755 --- a/exercises/06-lambda-functions/app.py +++ b/exercises/06-lambda-functions/app.py @@ -1,2 +1,5 @@ # your function here +x = 2 +is_odd = lambda x: x % 2 != 0 + diff --git a/exercises/07-lambda-function-two/app.py b/exercises/07-lambda-function-two/app.py index fca265d..b3084c9 100755 --- a/exercises/07-lambda-function-two/app.py +++ b/exercises/07-lambda-function-two/app.py @@ -1,4 +1,4 @@ - +rapid = lambda x: x[:-1] # From this line above, plese do not change code below diff --git a/exercises/08-Function-that-returns/app.py b/exercises/08-Function-that-returns/app.py index 44ab611..fcae8f6 100755 --- a/exercises/08-Function-that-returns/app.py +++ b/exercises/08-Function-that-returns/app.py @@ -1,7 +1,13 @@ def dollar_to_euro(dollar_value): - return dollar_value * 0.89 + return dollar_value * 0.89 # $137 * 0.89 = 121.93 euros def euro_to_yen(euro_value): - return euro_value * 124.15 + return euro_value * 124.15 # e121.93 * y124.15 = 15137.6095 yenes + +####### ↓ YOUR CODE BELOW ↓ ####### + +euros = dollar_to_euro(137) +yenes = euro_to_yen(euros) + +print(yenes) -####### ↓ YOUR CODE BELOW ↓ ####### \ No newline at end of file diff --git a/exercises/09-Function-parameters/app.py b/exercises/09-Function-parameters/app.py index 71294e0..7812470 100755 --- a/exercises/09-Function-parameters/app.py +++ b/exercises/09-Function-parameters/app.py @@ -1,6 +1,13 @@ # Your code goes here: -def render_person(param): - return param +def render_person(a,b,c,d,e): + a = "Bob is a " + b = "23 " + c = "years old male born in " + d = "05/22/1983 " + e = "with green eyes" + + return str(a + b + c + d + e) + # Do not edit below this line diff --git a/exercises/10-Array-Methods/app.py b/exercises/10-Array-Methods/app.py index fdddc23..130721a 100755 --- a/exercises/10-Array-Methods/app.py +++ b/exercises/10-Array-Methods/app.py @@ -1,5 +1,9 @@ names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] ## CREATE YOUR FUNCTION HERE +def sort_names(): + orden = names.sort() + return orden + print(sort_names(names)) From 6513157d6882571e859fcc0148ca6cadafee8002 Mon Sep 17 00:00:00 2001 From: adriancastro626 Date: Wed, 31 Mar 2021 01:01:42 +0000 Subject: [PATCH 2/2] ready --- exercises/09-Function-parameters/app.py | 10 ++-------- exercises/10-Array-Methods/app.py | 7 +++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/exercises/09-Function-parameters/app.py b/exercises/09-Function-parameters/app.py index 7812470..b13ac72 100755 --- a/exercises/09-Function-parameters/app.py +++ b/exercises/09-Function-parameters/app.py @@ -1,12 +1,6 @@ # Your code goes here: -def render_person(a,b,c,d,e): - a = "Bob is a " - b = "23 " - c = "years old male born in " - d = "05/22/1983 " - e = "with green eyes" - - return str(a + b + c + d + e) +def render_person(a, b, c, d, e): + return f'{a} is a {d} years old {e} born in {b} with {c} eyes' diff --git a/exercises/10-Array-Methods/app.py b/exercises/10-Array-Methods/app.py index 130721a..74986ca 100755 --- a/exercises/10-Array-Methods/app.py +++ b/exercises/10-Array-Methods/app.py @@ -2,8 +2,7 @@ ## CREATE YOUR FUNCTION HERE def sort_names(): - orden = names.sort() - return orden + sortlist = sorted(names) + print(sortlist) - -print(sort_names(names)) +sort_names()