what is wrong here? Flashcards

1
Q

for level(attempts):

invalid syntax

A

for i in range(attempts):

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

def difficulty():
if input(“Choose a difficulty. Type ‘easy’ or ‘hard’: “) == “easy”:
level = EASY_LEVEL
else:
level = HARD_LEVEL

what is wrong here that would return typeError when you call it in other functions

A

Your get its because this function could be returning an None instead of a value as nothing is returned you are just assigning stuff

change level = EASY_LEVEL to return EASY_LEVEL and same with HARD_LEVEL

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