Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Remove ads
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards




share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Python Ch. 2 Review

Review of Python Chapter 2

QuestionAnswer
2-1. What are the values for Boolean in Python? a. True, False b. TRUE, FALSE c. true, false d. Yes, No a. True, False
2-2. How many comparison operators are there in Python? Six: ==, !=, >, >=, <, <=
2-3. What is the difference between = and ==? = is the assignment operator. It is used to assign a value to a variable. == is the equal comparison operator. It is used to compare if 2 values are equal.
2-4. What are the logical operators in Python? and, or, not
2-5. Multiple Boolean expressions can be combined by using a ________ operator to create compound expressions. logical
2-6. When using the _________ operator, one or both sub-expressions must be true for the final expression to be true. or
2-7. When using the _________ operator, both sub-expressions must be true for the final expression to be true. and
2-8. Which of the following is the correct if clause to determine whether y is in the range 10 through 50? a. if 10 < y 50 b. if 10 < y or y > 50 c. if 10 > y and y < 50 d. if y > 10 and y < 50 e. if y > 10 or y < 50 d. if y > 10 and y < 50
2-9. Is there another way to accomplish this comparison? if x > 10 and x < 20: Yes. by using: if 10 < x < 20:
2-10. What is the result of the following Boolean expression, if x is 5, y is 3, and z is 8? x < y or z > x True
2-11. What is the result of the following Boolean expression, if x is 5, y is 3, and z is 8? x < y and z > x False
2-12. What is the result of the following Boolean expression, if x is 5, y is 3, and z is 8? not (x < y or z > x) and y < z False
2-13. Which of the following is the correct if clause to use to determine whether choice is other than 10? a. if choice != 10: b. if choice != 10 c. if choice <> 10: d. if choice <> 10 e. None of the above a. if choice != 10:
2-14. A(n) ____________ statement will execute one block of statements if its condition is true, or another block if its condition is false. if-else
2-15. What Python keyword allows us to check for more conditions in case the first block was false? The elif keyword (if-elif...else)
2-16. The logical ____ operator reverses the truth of a Boolean expression. not
2-17. What will this code print? flag = False if not flag: print ('Line 1 will be printed') else: print ('Line 2 will be printed') Line 1 will be printed
2-18. What will this code print? x = 10 y = 15 if x%3==0 and y%3==0: print ('Line 1 will be printed') elif x%3==0 or y%3==0: print ('Line 2 will be printed') else: print ('Line 3 will be printed') Line 2 will be printed
Created by: klaidley