Skip to content

Instantly share code, notes, and snippets.

@jim-clark
Created October 26, 2021 19:27
Show Gist options
  • Save jim-clark/c1468df3566400237eb3287b5ab2001c to your computer and use it in GitHub Desktop.
Save jim-clark/c1468df3566400237eb3287b5ab2001c to your computer and use it in GitHub Desktop.

Python Intro / Control Flow Review Questions:

  1. Instead of using code blocks delimited with curly braces, Python uses i_________.

  2. The line preceding an indented block of code must end with a _ character.

  3. True or False, the number 0 is falsey in both JS & Python?

  4. True or False, the number 1 is truthy in both JS & Python?

  5. True or False, an empty array in JS ([]) and an empty list in Python ([]) are both truthy?

  6. True or False, conditional expressions in an if/elif/else statement must be surrounded by parenthesis?

  7. Instead of ! in JS we use ___ in Python.

  8. What does the expression 1 and 2 return?

  9. What does the expression 1 or 2 return?

  10. True or False, f'5 + 10 equals {5 + 10}', is a valid formatted string literal (AKA F-string)?

  11. Write the Python single-line ternary statement that assigns to a variable named message the string 'You Won' if the variable score is greater than 100, otherwise assign the string 'Nice Try'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment