Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


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.
Your email address is only used to allow you to reset your password. See 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.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
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
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards