From 38da9a7c47015a4a21e8d920728f5a58b18d0e9b Mon Sep 17 00:00:00 2001 From: chip-student Date: Thu, 1 Apr 2021 22:22:48 +0000 Subject: [PATCH] practica de funciones 1.0 --- exercises/02-Hello-World/app.py | 3 ++- exercises/03-What-is-a-function/app.py | 3 +++ exercises/04-Call-a-function/app.py | 8 +++++++- exercises/05-Defining-vs-Calling-a-function/app.py | 3 ++- exercises/06-lambda-functions/app.py | 2 ++ exercises/07-lambda-function-two/app.py | 2 +- exercises/08-Function-that-returns/app.py | 8 +++++++- exercises/09-Function-parameters/app.py | 5 +++-- exercises/10-Array-Methods/app.py | 2 ++ 9 files changed, 29 insertions(+), 7 deletions(-) diff --git a/exercises/02-Hello-World/app.py b/exercises/02-Hello-World/app.py index 801de24..a7b3217 100644 --- a/exercises/02-Hello-World/app.py +++ b/exercises/02-Hello-World/app.py @@ -1 +1,2 @@ -# 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..a9a2b26 100755 --- a/exercises/03-What-is-a-function/app.py +++ b/exercises/03-What-is-a-function/app.py @@ -4,6 +4,9 @@ def sum(number1,number2): total = sum(2,3) print(total) +super_duper= sum(3445324, 53454423) +print(super_duper) + diff --git a/exercises/04-Call-a-function/app.py b/exercises/04-Call-a-function/app.py index c856d48..52055a2 100755 --- a/exercises/04-Call-a-function/app.py +++ b/exercises/04-Call-a-function/app.py @@ -1,4 +1,10 @@ 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) +print(square_area1) +square_area2 = calculate_area(2,2) +print(square_area2) +square_area3 = calculate_area(5,5) +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..e7b5163 100755 --- a/exercises/05-Defining-vs-Calling-a-function/app.py +++ b/exercises/05-Defining-vs-Calling-a-function/app.py @@ -1,5 +1,6 @@ # Define the function called "multi" that expects 2 parameters: - +def multi(a,b): + return a * b # 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..e63430e 100755 --- a/exercises/06-lambda-functions/app.py +++ b/exercises/06-lambda-functions/app.py @@ -1,2 +1,4 @@ # your function here +is_odd = lambda num:(num % 2)!= 0 +print(is_odd(4)) diff --git a/exercises/07-lambda-function-two/app.py b/exercises/07-lambda-function-two/app.py index fca265d..5cd32c3 100755 --- a/exercises/07-lambda-function-two/app.py +++ b/exercises/07-lambda-function-two/app.py @@ -1,5 +1,5 @@ - +rapid = lambda word: word[:-1] # From this line above, plese do not change code below print(rapid("bob")) #should print bo \ No newline at end of file diff --git a/exercises/08-Function-that-returns/app.py b/exercises/08-Function-that-returns/app.py index 44ab611..df77b0b 100755 --- a/exercises/08-Function-that-returns/app.py +++ b/exercises/08-Function-that-returns/app.py @@ -4,4 +4,10 @@ def dollar_to_euro(dollar_value): def euro_to_yen(euro_value): return euro_value * 124.15 -####### ↓ YOUR CODE BELOW ↓ ####### \ No newline at end of file +####### ↓ YOUR CODE BELOW ↓ ####### + +dollar_euro = dollar_to_euro(137) +# print(str(dollar_euro)) + +euro_yen = euro_to_yen(dollar_euro) +print(str(euro_yen)) \ No newline at end of file diff --git a/exercises/09-Function-parameters/app.py b/exercises/09-Function-parameters/app.py index 71294e0..76e98fc 100755 --- a/exercises/09-Function-parameters/app.py +++ b/exercises/09-Function-parameters/app.py @@ -1,6 +1,7 @@ # Your code goes here: -def render_person(param): - return param +def render_person(name, datebirth, color, age, genero): + concatena = name +' is a '+ str(age) +' years old '+ genero +' born on ' + datebirth + ' with ' + color +' eyes' + return concatena # Do not edit below this line diff --git a/exercises/10-Array-Methods/app.py b/exercises/10-Array-Methods/app.py index fdddc23..0156c76 100755 --- a/exercises/10-Array-Methods/app.py +++ b/exercises/10-Array-Methods/app.py @@ -1,5 +1,7 @@ names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] ## CREATE YOUR FUNCTION HERE +def sort_names(list): + return sorted(list) print(sort_names(names))