. Flashcards

1
Q

What is a list ?

A

Lists are used to store multiple items in a single variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

.—contains—

A

Checks if a value or variable is inside a list or variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is programming?

A

Creating a set of instructions that tells a computer how to perform a task

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a variable?

A

A value that can change. Variables are containers for storing data values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to add numbers together?

A

answer = 2+3
print (answer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a comment?

A

Allows you to write about what your code does so that you don’t lose track of it, similar to writing on your notebooks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the symbol for writing a comment?

A

(hashtag)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 4 different data types?

A

1)Integer (numbers)
2)String (Eg: “Hello World” )
3) Boolean (TRUE and FALSE)
4) Lists (expList = [a,b,c,d,e] )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are If, elif, and else statements in python?

A

Evaluates whether a condition is equal to (else) true or false (If, elif)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create a variable that is set to 5, if the variable is more than 5 print “more than 5” if it is less than 5 print “ less than 5”

A

answer = 5
if answer > 5:
print ( “Greater than 5” )
elif answer < 5:
print ( “Less than 5” )
else:
print ( “Equal to 5” )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are these symbols used for (+,-,<,>, ==, !=, /, *)

A

(+) addition
(-) subtracting
(<) less than
(>) more than
(==) equal to
(!=) not equal
(*) multiplication
(/) Division

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the assignment operator?

A

=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to check if a value or variable is inside a list or variable?

A

myList = [ 1,2,3,4 ]
if myList .—contains—(2):
print (True)
else :
print (False)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Create a variable called hello that takes the value “Hello World”. Then create a list with the following variables, 1, “Goodbye”, True, hello. Check if the list contains hello print True otherwise print False.

A

hello = “Hello World”
myList = [ 1, “Goodbye” , True, hello]
if myList .—contains—(hello):
print (True)
else:
print (False)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly