30 Day code challenge- python

Ganesh Uthiravasagam
2 min readMar 9, 2021

--

Day 2— Operators

Task

Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost. Round the result to the nearest integer.

Sample Input and Output

Input Format

There are lines of numeric input:
The first line has a double, (the cost of the meal before tax and tip).
The second line has an integer, (the percentage of being added as tip).
The third line has an integer, (the percentage of being added as tax).

Output Format

Round total to the nearest integer and print the result

Solution

Explanation

The first three lines get input from the user.
Line 4, 5: Calculates the final tip and tax values
Line 6: prints final output which adds meal, final tip and tax where round function rounds the value to the nearest

Bonus Tip: print(round(meal + Final_tip + Final_tax, 2)). The output will be 15.36 I.e It rounds to the nearest 2 decimals

See you on day 3

--

--