menu_book Course Curriculum (Intro to Programming) expand_more
Core Concepts
Data Structures
Problem Solving
Assertions
Learn Assertions in Intro to Programming with a focused explanation, a topic-specific example, and a mastery check.
12 min read
•
Intermediate
Advertisement
intro-programming-019.py
python
def discount(total):
assert total>=0, 'total cannot be negative'
return total*.1
print(discount(80))
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content