ITE 119 Qz 10 Module 10 Flashcards

1
Q

Write a function in python that prints “This is a Quiz”

A

def quiz_function():

print(“This is a Quiz”)

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

Write a function in python that takes in two numbers and returns the difference.

A

def calcDiff(a,b):

return a-b

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

Call your function that prints “This is a Quiz”

A

print_quiz() OR. print_quiz(‘This is a Quiz’)

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

Call your function that returns the difference of two numbers, pass into the function the numbers 6 and 3. Store the result in y.

A

y = calcDiff(6,3)

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

With the following function:

def print_message(username, greeting):
print("Hello %s, I wish you %s!"%(username, greeting))

What will the following function call print?
print_message(“Abe Honest”, “a happy holiday”)

A

Hello Abe Honest, I wish you a happy holiday!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
shirt = {
"brand":"Gucci",
"size":"Large",
"price": 200.00
}

how do you print the above dictionary?

A

print(shirt)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
shirt = {
"brand":"Gucci",
"size":"Large",
"price": 200.00
}

How do you print the value of the “brand” key using get?

A

print(shirt.get(“brand”))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
shirt = {
"brand":"Gucci",
"size":"Large",
"price": 200.00
}

How do you change the “price” of the dictionary to 1000.00?

A

shirt[“price”] = 1000.00

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
shirt = {
"brand":"Gucci",
"size":"Large",
"price": 200.00
}

How do you remove the “size” key name using pop()?

A

shirt.pop(“size”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
shirt = {
"brand":"Gucci",
"size":"Large",
"price": 200.00
}

Add an item to the above dictionary called “color”, set it to yellow.

A

shirt[“color”] = “yellow”

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