Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we begin with the statement correct = False. What is the result of evaluating the expression correct and 1 / 0 = = 1

Suppose we begin with the statement correct = False. What is the result of evaluating the expression
correct and 1/0==1
(a) True (b) False (c) Error
2. Suppose we begin with the statement name =Anya Tafliovich. What is the result of evaluating
the expression name.lower().find(a).find(a)
(a)0(b)3(c)6(d) Error
3. Suppose we begin with the statement name =Kaveh Mahdaviani. What is the result of evaluating
the expression name.count(a,1,-3)
(a)1(b)2(c)3(d) Error
4. Which of the following boolean expressions evaluate(s) to True?
(a)-4==-4//1(b)2.0==2.0//1
(c)1.2==1.2//1(d) both (a) and (b)
5. Suppose we begin with the statement large = True. What is the result of evaluating the expression
42+2==44 or large
(a) True (b) False (c) Error
6. Suppose we begin with the statement phrase =You ARe AlmOsT TheRE. What is the result of eval-
uating the expression phrase.swapcase()+,+ phrase[8:phrase.find( The)].
(a)yOU arE aLMoSt tHEre, aLMoSt tHEre(b)yOU arE aLMoSt tHEre, AlmOsT TheRE
(c)yOU arE aLMoSt tHEre, aLMoSt(d)yOU arE aLMoSt tHEre, AlmOsT
7. A not-so-good Python programmer has written the following function:
def sign_function(num: int)-> str:
if num >0:
return Positive
elif num <0:
return Negative
What is the result of evaluating the expression str(sign_function(0)) in Positive
(a) True (b) False (c) Error
8. Consider another piece of code from that same not-so-good Python programmer:
def my_function(num: int)-> str:
if num %2==0:
result =Even
else:
result =Odd
my_function(0)
Suppose we run this code. Then what is the result of evaluating the expression type(result)
(a) None (b)(c)(d) Error
9. Consider the following code:
x =1
y =2
count =0
if x >0:
count = count +1
elif x + y <4:
count = count +2
if y - x >=1:
count = count +3
else:
count = count *2
After running this code, what is the result of evaluating the variable count
(a)1(b)2(c)4(d)6
10. Suppose we begin with the statement
last_word =If you have time, double check your answers before you leave! :).
What is the result of evaluating the expression last_word[-3:][::-1][:-1]:
(a):)(b)):(c):((d)(:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Science Project Ideas In Health Care Volume 1

Authors: Zemelak Goraga

1st Edition

B0CPX2RWPF, 979-8223791072

More Books

Students also viewed these Databases questions

Question

=+5. Who or what is affected by this situation?

Answered: 1 week ago