Abs Function
Predict Output Beginner
Question
What does this code print?
Code
print(abs(-5) + abs(3))
Hint
abs(-5)=5, abs(3)=3, sum=8.
Explanation
abs(-5) returns 5, abs(3) returns 3. 5 + 3 = 8. abs returns the absolute value of a number.
Related Resources
Related Lessons
- Data Types
Learn Python data types.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.