-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (21 loc) · 1008 Bytes
/
main.py
File metadata and controls
34 lines (21 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Your task is to help me edit the function myFunc below.
#myFunc is meant to take in an integer 'size', and return a string of alternating 1's and 0s that is the same length as the size parameter. It doesn't work because I have poopoo brain, help me fix it
def myFunc(size):
myString = "1010"
for i in range(10):
myString += str(i%3)
return myString
print(myFunc(3))
#Your second task is to help me figure out how much money different carpets cost.
#The dictionary myDict stores the cost of each different material.
#myFunc is supposed to calculate the area of the carpet using parametes, and then return how much it would cost to use each different material
#Price is for 5m^2 of each material
myDict = {"Silk":50, "Shag":12, "Gold":150, "Human":25}
def myFunc2(l, w):
msqrd = 1*w
myString = ""
for key,value in myDict.items():
price = msqrd*value
myString = ("\nA {} carpet of area {}m^2 would cost ${}".format(key,msqrd,price))
return myString
print (myFunc2(5,5))