Answer: C) Objects in the image will become smaller as pixels are removed from their edges.
Explanation: Erosion is the process which is used in the field of morphological image processing .The functioning of the erosion is base on the elimination of the pixel from the boundaries or edges of the object.Thus, it makes the image smaller than actual image. .The other part of the processing is dilation which is addition of pixels to image.
Other given options are incorrect because erosion does not add pixels so image cannot become larger, cannot be of same size due to removal of pixel and no change in the color of pixel can happen.Thus, the correct option is option(C).
Answer:
Here is the Python program:
def exec_2(f):
f()
f()
def exec_4(f):
exec_2(f)
exec_2(f)
def print_koala():
print("koala")
exec_4(print_koala)
Explanation:
The program works as follows:
First method:
def exec_2(f):
f()
f()
any function that is passed into exec_2() will be executed twice without parameters.
Second method:
def exec_4(f):
exec_2(f)
exec_2(f)
function exec_4(f) takes in a function f as a parameter and executes the function f 4 times using the function exec_2. At first exec_2(f) call the function f is executed twice and and second exec_2(f) call the function f is again executed twice so the function f executes 4 times in total.
Third method:
def print_koala():
print("koala")
a function that prints out the koala once
This function has a print statement which is passed the string koala to print on output screen.
exec_4(print_koala)
function exec_4 is used to print koala four times. This function exec_4 takes as argument the function print_koala() So this works as follows:
exec_4(print_koala)
The body of exec_4 executes as:
exec_2(print_koala)
exec_2(print_koala)
Now at first call to exec_2(print_koala) the program moves to the function exec_2 which executes print_koala() method twice. Since print_koala() method has a print statement print("koala") so this is executed twice:
koala
koala
Now at second call exec_2(print_koala) the program moves to the function exec_2 which executes print_koala() method twice again. Since print_koala() method has a print statement print("koala") so this is executed again twice:
koala
koala
So the output of the entire above program is:
koala
koala
koala
koala
The screenshot of program along with its output is attached.
Answer:
import numpy as np
def standardize_weight(inp):
#1
inp=inp.lower()
print(inp)
#2
inp=inp.strip()
print(inp)
#3
inp=inp.replace("lbs"," ")
print(inp)
#4
inp=inp.replace("lb"," ")
print(inp)
#5
inp=inp.replace("pounds"," ")
print(inp)
print(inp.find("kg"))
#6
if(inp.find("kg")>=0):
inp=inp.replace("kg"," ")
print(inp)
inp_int=int(inp)
print(inp_int*2)
inp=str(inp_int)
print(inp)
#7
inp=inp.strip()
print(inp)
#8
if(inp.isdigit()):
inp=int(inp)
#9
else:
inp=np.nan
res=standardize_weight(" List albkg repLacleg sublkg " )
Explanation:
Answer:
MyString= input('Enter string: ')
string_capitalize(MyString)
print(MyString)
def string_capitalize(str):
str= str.capitalize()
return str
Explanation:
This python code is learnt to access string value from users and capitalize all characters in the beginning of each sentence.