An algorithm is what?
True or false
Assignments are not equations
true assignments are instructions to be exectuted
What is the format for an if statement?
if condition:
block of statements
What is the difference between = and ==
= is assignment
== is equals to
adding a string and integer together
To execute a python program you need a?
Python interpreter
true or false you can use expressions in assignments
true and example would be days = 7 * 31 * 4 +28
print("What’s your name?")
user = input()
print("Hello", user)
change this program so that if their name is Ms. Riccardi it will tell me that I am 25 but if it is someone else it will ask for their age.
if user == "Ms. Riccardi":
print ("you are 25")
else:
age = input("what is your age?")
print ("you are", age)
What is wrong with this variable ?
3varT= 4
it starts with a number
give an example of a syntax error
What is syntax in Python? and what is a syntax error?
Syntax error is when the code has a problem because the rules of python were broken
Provide all the arithmetic operators that you can do with python
+
-
*
/
%
//
**
What are all the relational operators in python
==
!=
<
<=
>
>=
Are these the same?
bee = "fun"
Bee = "fun"
no Bee is a different variable
give an example of a name error
when you forget to define your variables
print ("hello", user)
What is the syntax error and how do you fix it?
Claude has no "
What would happen if you added these together
print("a" + "a")
Create a variable store the name freddy in it and write a sentence by calling freddy.
var = freddy
print ( var, "is a senior")
Create a program that contains an if statement to say that if you like cookies you are awesome else you suck!
if input =="Yes":
print ("you are awesome")
else:
print("you suck")
true or false we learned about loops last semester - while, for etc? (in python)
I think false but I am unsure
Provide an example
the input function
user = input("What is your fav color")
provide a type error for string and integer what would it look like in code?
user = input("What is your favorite number?")
print(user + 3)
What is the key thing I have to do if I want to use the randint function?
import random from randint
What is wrong with this variable
Lexi Riccardi = "teacher"
there is a space variables cant have spaces
What is ms riccardis birthday, and name of her dog
march 26 and finn