Write a program that prints the type for a string, integer, and double.
print(type(5))
print(type("Hello"))
print(type(5.0))
What is a boolean?
A boolean is a True or False statement
How are loops helpful?
They help programmers with code that is repeated multiple times.
How are functions helpful?
Functions help organize code and allow programmers to reuse repetitive code
What is your Instructor's name?
Thomas/Tommy/Tom Robbins
What is an integer?
A data type that stores whole numbers
What statement is true?:
Ice is cold
The sky is green
This sentence is true
The previous sentence is false
Ice is cold
Create an infinite while loop that prints "Hello there"
while true:
print("Hello there")
Create a function that prints your favorite food.
def food():
print("favorite food")
food()
What software allows use to draw using python?
Python with turtle
Write a program to cast a integer into a string
numString = str(5)
Write a program that asks the user a yes or no question and use an if statement to check if they entered a yes or no. If yes, print good. If no, print wow, you should have said yes.
userInput = input("Question goes here")
if userInput == "yes"
print("good")
if userInput == "no"
print("wow, you should have said yes")
Write a program and use a loop to count from 0 - 10
for i in range(0,11):
print(i)
write a program that passes 2 integers into a function. Then the function adds the 2 integers and prints the sum.
def add(num1, num2):
print(num1 + num2)
add(5, 3)
Who created Python?
Guido van Rossum
Can you use arithmetic addition to add a sting and integer?
No
Create a nested if statement and have the outside if statement check if a number is less than 20 and the inside statement checks in a number is greater than 10. Include an else statement with the inner if statement for any number less than or equal to 10.
if num < 20:
if num > 10:
print("greater than 10 but less than 20")
else:
print("Less than or equal to to")
Write a program and use a loop to count from 0 to -100 in intervals of 5
for i in range(-100, 0, -5)
print(i)
write a program that passes 1 integer into a function. The function will then check if the integer is odd or even and print the result.
def odd_even(num1):
if num1 % 2 == 0:
print("even")
else:
print("odd")
odd_even(6)
How did python get it's name?
Monty Python
Can you use arithmetic addition to add a double and integer?
Yes
Draw an AND truth table
false | false | false
true | false | false
false | true | false
true | true | true
Use a loop to print out each letter in the word "Hippopotomonstrosesquippedaliophobia" with a space between each letter.
for i in "Hippopotomonstrosesquippedaliophobia":
print(i, end = ' ')
Daily double:
Create a function that adds two numbers and then pass the sum to another function that subtracts the sum by 5. Print the result outside of the functions
def add(num1, num2):
sum = num1 + num2
return subtract(sum, 5)
def subtract(num1, num2):
diff = num1 - num2
return diff
x = add(7,3)
print(x)
I ran out of ideas for this category so have a free 500 points.
:)