importmathdefcalculate_tip(amount,rating):ratings={'terrible':0,'poor':0.05,'good':0.1,'great':0.15,'excellent':0.2,}rating=rating.lower()ifratingnotinratings:return'Rating not recognised'rating_number=ratings[rating]returnmath.ceil(amount*rating_number)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is the Python solution: