<< 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

what is profit maximizing level of out put for above hypothetical firm TC = Q3 - 21Q2 + 600 + 1800 P = 600 MC = 3Q2 - 42Q + 600
Sosna Reply
what is labor productivity
Lizzy Reply
if the demand function is q=25-4p+p² 1.find elasticity of demand at the point p=5?
Puja Reply
what are some of the difference between monopoly and perfect competition market
Obeng Reply
n a perfectly competitive market, price equals marginal cost and firms earn an economic profit of zero. In a monopoly, the price is set above marginal cost and the firm earns a positive economic profit. Perfect competition produces an equilibrium in which the price and quantity of a good is economic
Naima
what are some characteristics of monopoly market
Obeng Reply
explicit cost is seen as a total experiences in the business or the salary (wages) that a firm pay to employee.
Idagu Reply
what is price elasticity
Fosua
...
krishna
it is the degree of responsiveness to a percentage change in the price of the commodity
Obeng
economics is known to be the field
John Reply
what is monopoly
Peter Reply
what is taxation
Peter
why do monopoly make excess profit in both long run and short run
Adeola Reply
because monopoly have no competitor on the market and they are price makers,therefore,they can easily increase the princes and produce small quantity of goods but still consumers will still buy....
Kennedy
how to identify a perfect market graph
Adeola Reply
what is the investment
jimmy
investment is a money u used to the business
Mohamed
investment is the purchase of good that are not consumed today but are used in the future to create wealth.
Amina
investment is the good that are not consumed
Fosua
What is supply
Fosua
 Supply represents how much the market can offer.
Yusif
it is the quantity of commodity producers produces at the market
Obeng
what is the effect of scarce resources on producers
Phindu Reply
explain how government taxes and government producer subsidies affect supply
Chanda
what is economic
Charles Reply
what are the type of economic
Charles
macroeconomics,microeconomics,positive economics and negative economics
Gladys
what are the factors of production
Gladys
process of production
Mutia
Basically factors of production are four (4) namely: 1. Entrepreneur 2. Capital 3. Labour and; 4. Land but there has been a new argument to include an addition one to the the numbers to 5 which is "Technology"
Elisha
what is land as a factor of production
Gladys
what is Economic
Abu
economics is how individuals bussiness and governments make the best decisions to get what they want and how these choices interact in the market
Nandisha
Economics as a social science, which studies human behaviour as a relationship between ends and scarce means, which have alternative uses.
Yhaar
Economics is a science which study human behaviour as a relationship between ends and scarce means
John
Economics is a social sciences which studies human behavior as a relationship between ends and scarce mean, which have alternative uses.....
Pintu
how will a country's population be equal to it's labour force
Hope Reply
what is the meaning of ppf
Obeng Reply
Production Possibility Frontier
Igbekele
What is Economic
Governor Reply
economic
Nwosu
Economics is the social science that deals with the unlimited human wants in the face of scarce (limited in supply) resources.
Azka
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