Question: Problem 3: Truth values An expression -e, will be called truthyyi f-bool (e), is True (i. e.. if -if e: stuff executes stuff); otherwise e

 Problem 3: Truth values An expression -e, will be called truthyyi

Problem 3: Truth values An expression -e, will be called truthyyi f-bool (e), is True (i. e.. if -if e: stuff executes stuff); otherwise e is falsy 3a. Create a list 1 consisting of 10 different Python objects that are falsy. For correctness, your list must have the property that a is b evaluates to False whenever a and b are entries of the lst in different posltions For thoroughness, the entries should look as different as possible. (Hint: ] is an example.) : [] # insert ten objects here # Use this code to test correctness of your answer print (len(1)-10) # Checks that your list has exactly 10 elements print (all (not 111 for i in range (10))) # Checks that your list consists of falsy elements print (all (not (1[i] is 1L51) for i in range (10) for j in range (1+1, 10))) Checks that different list elements correspond to different 3b. In Python, "is" means "identical objects", whereas"can be much more subtle. Create a list 1 consisting of 5 tuples (a, b) for each of which a-b evaluates to True but a is b evaluates to False. (Hint: the uple (I1, [is an example) 1-insert five objects here 3b: By analogy with the code snippet given in 1a, write a code snippet to verity correctness of your answer to 1b. That is, the code snippet should print one or more True/False values, all of which are True if and only i the answer is correct. I" Your code snippet goes here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!