Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13919881/12495441 #18

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion assignment_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def lower_case(string):

"""

### your code starts here

### your code starts here
lower_string = string.lower()
### your code ends here

return lower_string
Expand All @@ -38,6 +39,7 @@ def upper_case(string):
"""

### your code starts here
upper_string = string.upper()

### your code ends here

Expand Down
4 changes: 2 additions & 2 deletions assignment_2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
just give a correct one.
"""

var_1 = function_2c(...)
var_1 = function_2c(1000,100,100,-50)["add"]

var_2 = function_2b(...)
var_2 = function_2b("Seminars","Borrel")["C"]

if var_1 == 950:
print("Good job!")
Expand Down
20 changes: 20 additions & 0 deletions assignment_2b.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
No cheating! Don't show or tell hem the code directly
"""
def function_2b(string_1, string_2):
"""
Takes two strings and returns a dictionary of 3 strings. string_1 in lowercase. String_2 in uppercase.
A third string which is the concatenation of the operations on string_1 and string_2.


Parameters
----------
string_1: str
a string to convert to all lowercase
string_2: str
a string to convert to all uppercase

Returns
----------
dict : dict
a dictionary with keys: "L","U","C"
contains string_1 in lowercase, string_2 in uppercase and the concatenation of string_1 and string_2 respectively

"""

lower = string_1.lower()
upper = string_2.upper()
Expand All @@ -15,3 +34,4 @@ def function_2b(string_1, string_2):
"C": combined}

return dict

22 changes: 22 additions & 0 deletions assignment_2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@
No cheating! Don't show or tell hem the code directly
"""
def function_2c(w, x, y, z):
"""
Takes 4 integers w,x,y and z. Returns a dictionary containing multiplication, division, addition
and subtraction on these integers.


Parameters
----------
w : int
integer
x : int
integer
y : int
integer
z : integer

Returns
----------
results : dict
a dictionary with keys: "multiply","divide","add", "subtraction"
contains multiplication of x,y; division of x,y; addition of w,z; subtraction of w,z respectively.

"""

multiplication = x * y
division = x / y
Expand Down