Variables
Conditionals
Loops
Lists
NC State
100

Do you have to initialize variables in Python?

YES

100

What is the difference between the following lines: 

x = 8 and x == 8

x = 8 assigns the variable to the number 8

x == 8 tests for equality

100

What are the two types of loops you learned? What's the difference between them?

For and While

100

What does the append method do in a list?

Adds new value to the end of the list

100

What is the NC State mascot?

Wolfpack!

200

True or False, this program will return PYTHON:

text = "Python"

text.upper()

print(text)

False

200

num % 2 checks if num is ______

EVEN

200

What is the term for the process of finding and resolving bugs in a program

Debugging

200

The process of outputting a substring from a string is called string _____. 

If text = "string", how could you output the substring "ring"?

String slicing

text[2:]

200

What is our motto?

"Think and Do."

300

Initialize a variable named var that holds the number 10; then convert var to a string type.

var = 10

var = str(var)

300

What is the output of the following code:

x = 10

if x < 5:

    print("x is greater than 5")

else:

    pass

Nothing

300

What is the output of the following:

print(range(10))

range(0,10)

300

What is the output of the following:

list = [4, 5, 8, 2, 6, 9]

other = [3, 3, 3]

list.append(11)

other.insert(1, 3)

list.extend(other)

print(list)

[4, 5, 8, 2, 6, 9, 11, 3, 3, 3, 3]

300

How far did our men's basketball team get this past year in the NCAA?

Final Four

400

What is the output of the following:

x, y = 5, 8

x, y = y + 1, x

print(x)

print(y)

9

5

400

What is the output of the following:

height = 2.3

rain = true

time = 2

if (rain and (time > 1)):

    print(height + 0.2)

else:

    print("no plant growth!")

2.5

400

How many times will the loop run:

count = 0

for i in range(10):

    if i % 2 == 0:

        count += 1

    if count == 3:

        break

print("Loop ran", i + 1, "times.")

5 times

400

What is the name of NCSU's official dairy farm/ice cream brand?

Howling Cow

500

What is the output:

# what is this type of variable called:

a = 3 

def function(): 

    # what is this type of variable called:

    a = 5

    print(a)  

 function()

print(a)

5

3

#global

#local

500

Write a program to check if the given sides of a triangle is equilateral, isosceles or scalene.

x = int(input("x: "))

y = int(input("y: "))

z = int(input("z: "))

if x == y == z:

    print("Equilateral triangle")

elif x == y or y == z or z == x:

    print("Isosceles triangle")

else:

    print("Scalene triangle") 

500

for x in range(6):

  if x == 3: break

  print(x)

else:

  print("Finally finished!")

0

1

2

500

James Goodnight is one of NCSU's most famous alumnus and is the CEO/founder of a well-known software company named _______.  

SAS

M
e
n
u