/
What is the division operator symbol?
a = 5
a = 7
print(a*a)
What is 49?
person = "penguin"
print(penguin)
What is an undeclared variable?
koala = 20
duck = 50
print(penguin + koala + duck)
Name for a location in the memory that has data stored
What is a variable?
**
What is the exponent symbol?
def add(a, b):
print(a + b)
add(input("First: "), input("Second: "))
Second: not blob
blobnot blob
a = 10
b = 0
print(a / b)
What is dividing by 0?
Ask the user for a word, and print it twice (with no spaces) to the console.
def print_twice():
word = input("Enter a word: ")
print(word + word)
%
What is the modulus operator?
def strange(a):
a = a + a
print(a)
strange(input("Enter: ") * 2)
Enter: {eg.} penguin
penguinpenguinpenguinpenguin
Write a function that takes a first name and last name from user input (two separate inputs) and prints them together with a space.
def full_name():
first = input("First name: ")
last = input("Last name: ")
print(first, last)
A value that is hard-coded into the program
What is a literal?
//
What is the integer division symbol?
def mix(a):
print(a + "2")
print(int(a) + 2)
mix(input("Enter: "))
Enter: b
b2
{unicode value of b} + 2, so 98 + 2 = 100 is what gets printed out
alternatively,
Enter: 2
22
4
a = 5
b = 10
c = 15
average = a + b + c / 3
print(average)
What is PEMDAS/BEDMAS?
Write a function that asks for your current age and a number of years, then prints your age after that many years.
def future_age(current, num_years)
print(int(current) + int(num_years))
c = input("How old are you? ")
n = input("How many years to the future?")
future_age(c, n)
Variable defined in function declaration
What is a parameter?
>>
What is the operator used to redirect output to a file, that appends the content?
def combine(x, y):
print(x * int(y))
combine(input("Word: "), input("Times: ") + "1")
prints out the word (taken from input) y times (also taken from input)
eg.
Word: penguin
Times: 3
penguinpenguinpenguin
penguin = "penguin"
age = 8
print(penguin + "is" + age)
What is the lack of str()?
Input that is passed into a function
What is an argument?