Liking a company on Facebook
Answer:
The function is as follows:
import random
import string
def solution(riddle):
s = list(riddle)
for i in range(len(riddle)):
alpha = "".join(random.choice(string.ascii_letters) for x in range(1))
alpha = alpha.lower()
if s[i] == '?':
if i > 0 and i < len(s)-1:
if s[i+1] != alpha:
s[i] = alpha
elif s[i-1] != alpha:
s[i] = alpha
else:
i=i
else:
if i == 0:
if s[1] != alpha:
s[i] = alpha
else:
i = i
else:
if s[i-1] != alpha:
s[i] = alpha
else:
i = i
riddle = ""
for ele in s:
riddle+=ele
return riddle
Explanation:
See attachment for explanation where comments are used to explain some lines
Answer:
a. Object cannot be converted to Person
Explanation:
This program demonstrates polymorphism.
e.g., a Student IS a Person therefore you can call m() with a Student as well as a Person object.
The same goes for GraduateStudent.
However, and Object is not a Person, so the last call fails. This can be deducted by the type checking that happens at compile time.
Answer:
b. Thin provisioning
Explanation:
Thin provisioning is a storage space feature that makes allocating disk storage space flexible based on the space needed by each user, it improves the way storage space is utilized.