2nd Semester Intro to Computer Science

Do Now 2.06

1. In your Notebook

Answer the following

  1. How would you print out something 10 times? What about 100? What about 1,000?
  2. Can you remember something from Snap! that might allow that?

2. Open up the console

Type the following code using interactive mode

while True:
    print('a')

3. In your Notebook

Write responses for the following

  1. What happens when you run this code?
  2. Try using other Boolean expressions instead of True (e.g. 4 > 5 and 9 != 2), and explore what happens.

  3. How would you print out something 10 times? What about 100? What about 1,000?

  4. Can you remember something from Snap! that might allow that?

4. Open up the console

Type the following code

while True:
    print('a')

5. In your Notebook

continue responses for the following

  1. What happens when you run this code?
  2. Try using other Boolean expressions instead of True (e.g. 4 > 5 and 9 != 2), and explore what happens.

6. Open up the console

Type and run the following code (Remember this from Unit 2?)

if animal in ['cat', 'dog']:
    print("A great pet!")

Edit this page Report an issue