← Quiz: Type Hints and Dataclasses: all 10 questions
Quiz: Type Hints and Dataclasses · Question 2 of 10
What does - float mean in def area(r: float) - float:?
What does -> float mean in def area(r: float) -> float:?
- A.r must be positive
- B.The function prints a float
- C.The function is meant to return a float
- D.The function converts its result to float
Answer & explanation
Correct answer: The function is meant to return a float
The arrow annotates the return type.
Can you get the rest right without peeking?
Take the timed Quiz: Type Hints and Dataclasses quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →