All in python Evaluate the following expressions: a) (True) and (3 > 4) [ Select
ID: 2864823 • Letter: A
Question
All in python
Evaluate the following expressions:
a) (True) and (3 > 4) [ Select ] ["False", "True"]
b) not (1 > 0) and (1 > 0) [ Select ] ["False", "True"]
c) (1 > 0) or (1 < 0) [ Select ] ["False", "True"]
d) (1 != 0) or (1 == 0) [ Select ] ["False", "True"]
e) (1 >= 0) or (1 < 0) [ Select ] ["False", "True"]
f) (1 != 1) == (not (1 == 1) ) [ Select ] ["False", "True"]
g) 2 * 2 – 3 > 2 and 4 – 2 > 5 [ Select ] ["False", "True"]
h) 2 * 2 – 3 > 2 or 4 – 2 > 5 [ Select ] ["False", "True"]
Flag this Question
Question 210 pts
You are given a jar full of loose change.You count up how much money you have. Using the variable x to indicate the TOTAL value of all the coins in the jar. You don't want such heavy change, so you decide to go to the bank to cash in the coins. Now, write Python statements (each should require only a single line of code) to accomplish the following (10 points):
a) Determine how many FULL dollars ($1 = 100 cents) you will get from the coins in the jar and store this result in the variable dollars:
Python Statement to determine dollars (integer value) given total value of coins:
b) Determine how many cents will be left over after the full dollar amount has been determined. Store this result in the variable cents:
Python statement to determine cents (integer value) left after as many coins as possible have been traded for paper dollars:
Flag this Question
Question 310 pts
Given the following list:
numbers = [15, 27, 17, 23, 10, 2, 46]
a) Provide a statement that stores the value of the fourth list item in the variable a:
b) Provide a statement that store the value of the last list item in the variable b:
c) What is the value of a / b (provide answer in the same format Python would)?
Flag this Question
Question 48 pts
After execution of the main, what is the value of result? (8 points)
def main():
result = 8
if result >= 12:
result = result + 3
else:
result = 2 * result - 8
print('Result: ',result)
main()
Flag this Question
Question 58 pts
After execution of the main, what is the values of count?
def main():
count = 5
for i in range(3):
count = count + 1
for j in range(2):
count = count + 1
print('Count:', count)
[count]
Flag this Question
Question 66 pts
Write Python code that validates whether a user wants to quit the program depending on whether the user has entered a 'Yes' response or a 'No' response. Your code should ask the user for a decision, validate the response, continuing to ask for the user's information to as long as valid responses for "Yes" and "No" have not been entered.
HTML EditorKeyboard Shortcuts
Font Sizes
Paragraph
p
Flag this Question
Question 710 pts
a) Used to pass information into a function
b) Keyword used to have a method provide a response back to the calling program
c) Keyword used to signify that the following code will create a new method
d) This type of loop is an example of an indefinite loop
e) An event that disrupts the normal flow of the program in a way not intended by the programmer
Flag this Question
Question 87 pts
Look at the following Python code. What is the expected output?
a = "QPXYYTLHAORNW!"
def mystery(a):
for i in range(len(a)):
if i%2 == 0:
print(a[i+1],end='')
mystery(a)
a) (True) and (3 > 4) [ Select ] ["False", "True"]
b) not (1 > 0) and (1 > 0) [ Select ] ["False", "True"]
c) (1 > 0) or (1 < 0) [ Select ] ["False", "True"]
d) (1 != 0) or (1 == 0) [ Select ] ["False", "True"]
e) (1 >= 0) or (1 < 0) [ Select ] ["False", "True"]
f) (1 != 1) == (not (1 == 1) ) [ Select ] ["False", "True"]
g) 2 * 2 – 3 > 2 and 4 – 2 > 5 [ Select ] ["False", "True"]
h) 2 * 2 – 3 > 2 or 4 – 2 > 5 [ Select ] ["False", "True"]
Explanation / Answer
Solved the first 8 T/F problems, post multiple questions to get the remaining answers
a) FALSE, since the operation is "and", one statement is TRUE and other is FALSE, so the output will be FALSE
b) FALSE
c) TRUE
d) TRUE
e) TRUE
f) FALSE
g) FALSE
h) FALSE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.