Search Header Logo
Module 3 Tough Problem NOTES

Module 3 Tough Problem NOTES

Assessment

Presentation

•

Computers

•

12th Grade

•

Practice Problem

•

Hard

Created by

Dr. Moriarty

FREE Resource

7 Slides • 0 Questions

1

​NOTES for PCEP Module 3 Toughies

By Dr. Moriarty

2

media

Problem 3 looked like the first two lines here

This for loop just starts at -1 and ends one before 1, so it prints out two hashtags. I ran it a second time here printing the value of i so you could see what it holds...

​

​For loops with negative numbers

3

​Even when they are negative numbers, for loops always have (start point, end point, counter) inside their parenthesis!

​

more for loop examples
media

4

media

For this problem, you should write down the list and lablel its regular AND negative indices.

​For this problem, -1 has an index of -1, 1 has an index of -2, and 3 has an index of -2.

Line 2 puts whatever is in list slot -2 INTO list slot -1. So the last slot now contains a 1.

​swapping list values with negative indices

5

media

​notice that in all these examples the right value goes and OVERWRITES the value on the left.

If we wanted to truly swap and keep each value, we'd need a second temp variable!

​

more swapping examples

6

media

For this problem, you want to figure out if the inequalities/equals check are true or false, then think about the or that links them.

​

logical operators

​Remember if you have multiple ors, ands, and nots in one expression, do the not first, then the and, and save the or for last :)

7

more logical operator examples
media
pattern-tertiary
​NOTES for PCEP Module 3 Toughies

By Dr. Moriarty

Show answer

Auto Play

Slide 1 / 7

SLIDE