diff --git a/.learn/resets/01-Hello-World/app.py b/.learn/resets/01-Hello-World/app.py new file mode 100644 index 0000000..fce62c1 --- /dev/null +++ b/.learn/resets/01-Hello-World/app.py @@ -0,0 +1 @@ +# Your code here diff --git a/.learn/resets/02-What-is-a-function/app.py b/.learn/resets/02-What-is-a-function/app.py new file mode 100644 index 0000000..efeec63 --- /dev/null +++ b/.learn/resets/02-What-is-a-function/app.py @@ -0,0 +1,6 @@ +def sum(number1,number2): + return number1 + number2 + +# Your code here +total = sum(2,3) +print(total) diff --git a/.learn/resets/03-Call-a-function/app.py b/.learn/resets/03-Call-a-function/app.py new file mode 100644 index 0000000..0c131b3 --- /dev/null +++ b/.learn/resets/03-Call-a-function/app.py @@ -0,0 +1,4 @@ +def calculate_area(length, width): + return length * width + +# Your code below this line diff --git a/.learn/resets/04-Defining-vs-Calling-a-function/app.py b/.learn/resets/04-Defining-vs-Calling-a-function/app.py new file mode 100644 index 0000000..eedeae6 --- /dev/null +++ b/.learn/resets/04-Defining-vs-Calling-a-function/app.py @@ -0,0 +1,5 @@ +# Define below the function called "multi" that expects 2 parameters + +# Don't edit anything below this line +return_value = multi(7,53812212) +print(return_value) diff --git a/.learn/resets/05-lambda-functions/app.py b/.learn/resets/05-lambda-functions/app.py new file mode 100644 index 0000000..b4ac556 --- /dev/null +++ b/.learn/resets/05-lambda-functions/app.py @@ -0,0 +1,2 @@ +# Your function here + diff --git a/.learn/resets/06-lambda-function-two/app.py b/.learn/resets/06-lambda-function-two/app.py new file mode 100644 index 0000000..a156102 --- /dev/null +++ b/.learn/resets/06-lambda-function-two/app.py @@ -0,0 +1,5 @@ + + + +# Your code above, please do not change code below +print(rapid("bob")) # Should print "bo" diff --git a/.learn/resets/07-Function-that-returns/app.py b/.learn/resets/07-Function-that-returns/app.py new file mode 100644 index 0000000..fc81947 --- /dev/null +++ b/.learn/resets/07-Function-that-returns/app.py @@ -0,0 +1,7 @@ +def dollar_to_euro(dollar_value): + return dollar_value * 0.91 + +def euro_to_yen(euro_value): + return euro_value * 161.70 + +####### ↓ YOUR CODE BELOW ↓ ####### diff --git a/.learn/resets/08-Function-parameters/app.py b/.learn/resets/08-Function-parameters/app.py new file mode 100644 index 0000000..71294e0 --- /dev/null +++ b/.learn/resets/08-Function-parameters/app.py @@ -0,0 +1,7 @@ +# Your code goes here: +def render_person(param): + return param + + +# Do not edit below this line +print(render_person('Bob', '05/22/1983', 'green', 23, 'male')) \ No newline at end of file diff --git a/.learn/resets/09-Array-Methods/app.py b/.learn/resets/09-Array-Methods/app.py new file mode 100644 index 0000000..9d60f6b --- /dev/null +++ b/.learn/resets/09-Array-Methods/app.py @@ -0,0 +1,6 @@ +names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] + +## CREATE YOUR FUNCTION HERE + + +print(sort_names(names)) diff --git a/exercises/01-Hello-World/app.py b/exercises/01-Hello-World/app.py index fce62c1..a9b7688 100644 --- a/exercises/01-Hello-World/app.py +++ b/exercises/01-Hello-World/app.py @@ -1 +1,2 @@ # Your code here +print("Hello World") \ No newline at end of file diff --git a/exercises/02-What-is-a-function/app.py b/exercises/02-What-is-a-function/app.py index efeec63..a313431 100755 --- a/exercises/02-What-is-a-function/app.py +++ b/exercises/02-What-is-a-function/app.py @@ -2,5 +2,5 @@ def sum(number1,number2): return number1 + number2 # Your code here -total = sum(2,3) -print(total) +super_duper = sum(3445324,53454423) +print(super_duper) diff --git a/exercises/03-Call-a-function/app.py b/exercises/03-Call-a-function/app.py index 0c131b3..758b6e6 100755 --- a/exercises/03-Call-a-function/app.py +++ b/exercises/03-Call-a-function/app.py @@ -2,3 +2,6 @@ def calculate_area(length, width): return length * width # Your code below this line +square_area1 = calculate_area(4,4) +square_area2 = calculate_area(2,2) +square_area3 = calculate_area(5,5) diff --git a/exercises/04-Defining-vs-Calling-a-function/app.py b/exercises/04-Defining-vs-Calling-a-function/app.py index eedeae6..939012b 100755 --- a/exercises/04-Defining-vs-Calling-a-function/app.py +++ b/exercises/04-Defining-vs-Calling-a-function/app.py @@ -1,5 +1,6 @@ # Define below the function called "multi" that expects 2 parameters - +def multi(numero1, numero2): + return(numero1 * numero2) # Don't edit anything below this line -return_value = multi(7,53812212) -print(return_value) + return_value = multi(7,53812212) + print(return_value) diff --git a/exercises/05-lambda-functions/app.py b/exercises/05-lambda-functions/app.py index b4ac556..013e307 100755 --- a/exercises/05-lambda-functions/app.py +++ b/exercises/05-lambda-functions/app.py @@ -1,2 +1,10 @@ # Your function here +is_odd = lambda numero: numero %2 == 0 + +# Declarando una función normal para una multiplicación +def multiply(p1, p2): + return p1 * p2 + +# Declarándola en una línea como una función lambda +multiply = lambda p1,p2: p1 * p2 diff --git a/exercises/06-lambda-function-two/app.py b/exercises/06-lambda-function-two/app.py index a156102..67216e0 100755 --- a/exercises/06-lambda-function-two/app.py +++ b/exercises/06-lambda-function-two/app.py @@ -1,4 +1,4 @@ - +rapid = lambda str: str[:-1] # Your code above, please do not change code below diff --git a/exercises/06-lambda-function-two/solution.hide.py b/exercises/06-lambda-function-two/solution.hide.py index ecfc065..f7d85b7 100644 --- a/exercises/06-lambda-function-two/solution.hide.py +++ b/exercises/06-lambda-function-two/solution.hide.py @@ -2,3 +2,12 @@ # Your code above, please do not change code below print(rapid("bob")) # Should print "bo" + +# [n1:n2:n3] +# n1 --> donde empezamos a contar, si no ponemos nada empezamos desde el 0 +# n2 --> hasta donde contamos. Será hasta el número anterior al que le digamos. +# Si el número es -1 nos referimos hasta el último elemento que haya. +#n3 --> cada cuanto contamos, cada numero, cada 2, cada 3, etc. + +# [1:40:2] Empezamos a contar desde el número 1 hasta el número 39, y contaremos de 2 en 2 + diff --git a/exercises/07-Function-that-returns/app.py b/exercises/07-Function-that-returns/app.py index fc81947..1336cee 100755 --- a/exercises/07-Function-that-returns/app.py +++ b/exercises/07-Function-that-returns/app.py @@ -5,3 +5,7 @@ def euro_to_yen(euro_value): return euro_value * 161.70 ####### ↓ YOUR CODE BELOW ↓ ####### +euros = dollar_to_euro(137) +yenes = euro_to_yen(euros) + +print(yenes) \ No newline at end of file diff --git a/exercises/08-Function-parameters/app.py b/exercises/08-Function-parameters/app.py index 71294e0..9f817b1 100755 --- a/exercises/08-Function-parameters/app.py +++ b/exercises/08-Function-parameters/app.py @@ -1,6 +1,6 @@ # Your code goes here: -def render_person(param): - return param +def render_person(nombre, nacimiento, color, edad, genero): + return nombre + ' is a ' + str(edad) + ' years old ' + genero + ' born in ' + str(nacimiento) + ' with ' + color + ' eyes ' # Do not edit below this line diff --git a/exercises/09-Array-Methods/app.py b/exercises/09-Array-Methods/app.py index 9d60f6b..9f9a289 100755 --- a/exercises/09-Array-Methods/app.py +++ b/exercises/09-Array-Methods/app.py @@ -1,6 +1,7 @@ names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan'] ## CREATE YOUR FUNCTION HERE - +def sort_names(arr): + return sorted(arr) print(sort_names(names))