Skip to content

Commit 4baac0d

Browse files
committed
Py functions done
1 parent 59d2593 commit 4baac0d

File tree

9 files changed

+36
-8
lines changed

9 files changed

+36
-8
lines changed

exercises/02-Hello-World/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# your code here
1+
# your code here
2+
print("Hello World")

exercises/03-What-is-a-function/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ def sum(number1,number2):
55
print(total)
66

77

8-
8+
super_duper = sum(3445324,53454423)
9+
print(super_duper)
910

1011

1112

exercises/04-Call-a-function/app.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
def calculate_area(length,edge):
22
return length * edge
33

4-
# Your code Below this line:
4+
# Your code Below this line:
5+
square_area1 = calculate_area(4,4)
6+
print (square_area1)
7+
8+
square_area2 = calculate_area(2,2)
9+
print(square_area2)
10+
11+
square_area3 = calculate_area(5,5)
12+
print(square_area3)
13+
14+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Define the function called "multi" that expects 2 parameters:
2-
2+
def multi(a,b):
3+
return a*b
34
# don't edit anything below this line
45
return_value = multi(7,53812212)
56
print(return_value)

exercises/06-lambda-functions/app.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
# your function here
22

3+
# this function return True if a number is odd.
4+
# def is_odd(num):
5+
# return (num % 2)! == 0:
6+
7+
is_odd = lambda num: (num % 2)!= 0
8+
9+
print(is_odd)

exercises/07-lambda-function-two/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
rapid = lambda string: string[:-1]
22

33

44
# From this line above, plese do not change code below

exercises/08-Function-that-returns/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ def dollar_to_euro(dollar_value):
44
def euro_to_yen(euro_value):
55
return euro_value * 124.15
66

7-
####### ↓ YOUR CODE BELOW ↓ #######
7+
####### ↓ YOUR CODE BELOW ↓ #######
8+
dollar1euro = dollar_to_euro(137)
9+
10+
euro1yen = euro_to_yen(dollar1euro)
11+
print(str(euro1yen))

exercises/09-Function-parameters/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Your code goes here:
2-
def render_person(param):
3-
return param
2+
def render_person(name,date,color,age,gender):
3+
concat = name +" "+ "is a"+" "+str(age)+" "+ "years old" +" "+ gender+" "+"born in"+" "+date +" "+ "with" +" "+ color +" "+ "eyes"
4+
return concat
5+
46

57

68
# Do not edit below this line

exercises/10-Array-Methods/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
names = ['John', 'Kenny', 'Tom', 'Bob', 'Dilan']
22
## CREATE YOUR FUNCTION HERE
33

4+
def sort_names(order):
5+
return sorted(order)
46

57
print(sort_names(names))

0 commit comments

Comments
 (0)