<< Chapter < Page Chapter >> Page >
Figure 2 . Question 6.
def prod(a,b): return a*bdef sum(c,d): return c+dcomp = lambda w,x,y,z : sum(w,x) * prod(y,z) print(comp(3,4,5,6))=============================================================================== 210

Go to answer 6

Question 7

True or False? The code in the top panel of Figure 3 produces the output shown in the bottom panel of Figure 3 .

Figure 3 . Question 7.
highNumbers = list(filter((lambda x: x>5), range(10))) print(highNumbers)=============================================================================== [5, 6, 7, 8, 9]

Go to answer 7

Question 8

True or False? The code in the top panel of Figure 5 produces the output shown in the bottom panel of Figure 5 .

Figure 5 . Question 8.
import re str = "abcd$"if re.search(r'[ceg$]', str):print("Match") else:print("No Match") if re.search(r'[^abcd$]', str): print("Match")else: print("No Match")=============================================================================== MatchMatch

Go to answer 8

Question 9

True or False? The code in the top panel of Figure 7 produces the output shown in the bottom panel of Figure 7 .

Figure 7 . Question 9.
import re s = "pqrabcdefg-abcd-abc$"matches = re.findall(r'ab', s) for substr in matches:print(substr) searchObj = re.search(r'ab', s)if searchObj: print(str(searchObj.start()) + "-" + str(searchObj.end()))=============================================================================== abab ab3-5

Go to answer 9

Question 10

True or False? The code in the top panel of Figure 8 produces the output shown in the bottom panel of Figure 8 .

Figure 8 . Question 10.
myList = [0,1,2,3,4,5,6] print(myList)print("ok") print(*myList)=============================================================================== [0, 1, 2, 3, 4, 5, 6]ok [0, 1, 2, 3, 4, 5, 6]

Go to answer 10

Question 11

Note: You will need to understand lambda and filter to understand the code in most of the remaining questions.

True or False? The code in the top panel of Figure 10 produces the output shown in the bottom panel of Figure 10 .

Figure 10 . Question 11.
import re myList = ('Dick', 'TomDickHarry', 'Dick is my name')for testString in myList: print("Test string:",testString)lambdaFunction = lambda arg: re.search(r"Dick", arg) matchObject = lambdaFunction(testString)if(matchObject!=None): print(" Matching subString:",matchObject.group())=============================================================================== Test string: DickMatching subString: Dick Test string: TomDickHarryMatching subString: Dick Test string: Dick is my nameMatching subString: Dick

Go to answer 11

Question 12

True or False? The code in the top panel of Figure 11 produces the output shown in the bottom panel of Figure 11 .

Figure 11 . Question 12.
import re myList = ('Dick', 'TomDickHarry', 'Dick is my name')for testString in myList: print("Test string:",testString)lambdaFunction = lambda arg: re.match(r"Dick", arg) matchObject = lambdaFunction(testString)if(matchObject!=None): print(" Matching subString:",matchObject.group())=============================================================================== Test string: DickMatching subString: Dick Test string: TomDickHarryMatching subString: Dick Test string: Dick is my nameMatching subString: Dick

Questions & Answers

general equation for photosynthesis
Ojasope Reply
6CO2 + 6H2O + solar energy= C6H1206+ 6O2
Anastasiya
meaning of amino Acids
AJAYI Reply
a diagram of an adult mosquito
mubarak Reply
what are white blood cells
Mlungisi Reply
white blood cell is part of the immune system. that help fight the infection.
MG
what about tissue celss
Mlungisi
Cells with a similar function, form a tissue. For example the nervous tissue is composed by cells:neurons and glia cells. Muscle tissue, is composed by different cells.
Anastasiya
I need further explanation coz celewi anything guys,,,
Calvin Reply
hey guys
Isala
on what?
Anastasiya
hie
Lish
is air homogenous or hetrogenous
damiane Reply
homogenous
Kevin
why saying homogenous?
Isala
explain if oxygen is necessary for photosynthesis
Allice Reply
explain if oxygen is necessary for photosynthesis
Allice Reply
Yes, the plant does need oxygen. The plant uses oxygen, water, light, and produced food. The plant use process called photosynthesis.
MG
By using the energy of sunlight, plants convert carbon dioxide and water into carbohydrates and oxygen by photosynthesis. This happens during the day and sunlight is needed.
NOBLE
no. it s a product of the process
Anastasiya
yet still is it needed?
NOBLE
no. The reaction is: 6CO2+6H20+ solar energy =C6H12O6(glucose)+602. The plant requires Carbon dioxyde, light, and water Only, and produces glucose and oxygen( which is a waste).
Anastasiya
what was the question
NOBLE Reply
joining
Godfrey
the specific one
NOBLE
the study of non and living organism is called.
Godfrey
Is call biology
Alohan
yeah
NOBLE
yes
Usher
what Is ecology
Musonda Reply
what is a cell
Emmanuel Reply
A cell is a basic structure and functional unit of life
Ndongya
what is biolgy
Hawwi Reply
is the study of living and non living organisms
Ahmed
may u draw the female organ
MARTIN Reply
i dont understand
Asal
:/
Asal
me too
DAVID
anabolism and catabolism
Sani Reply
Anabolism refers to the process in methabolism in which complex molecules are formed "built" and requires energy to happen. Catabolism is the opposite process: complex molecules are deconstructed releasing energy, such as during glicolysis.
Anastasiya
Explain briefly independent assortment gene .
Otu Reply
hi
Amargo
hi I'm Anatalia
Joy
what do you mean by pituitary gland
Digambar
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Itse 1359 introduction to scripting languages: python. OpenStax CNX. Jan 22, 2016 Download for free at https://legacy.cnx.org/content/col11713/1.32
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Itse 1359 introduction to scripting languages: python' conversation and receive update notifications?

Ask
Royalle Moore
Start Quiz
Carly Allen
Start Quiz
Anonymous User
Start Quiz