About: This Tip Calculator comes in handy when you go out to the restaurant with your friends and you not good at math to split the bill according to the tip you want to give. So here's my program doing the work for you.
Functions Used:
print():
SYNTAX : print(" hello world ")
Quick tip: We can print values of different datatypes without converting them into str.
This can be done using an f string:
SYNTAX : print(f"{int_datatype_var} {str_datatype_var}")
input():
SYNTAX : input(" what is your name? this is a prompt ")
Datatypes Used:
int:
Whole numbers i.e not decimal numbers.
Eg: 1, 4, 6 are integers
Quick tip: 10,000 from normal math can be written as 10_000 in python for your convience, however python compiler sees it as 10000!
float:
Decimal numbers.
Eg: 2.098, 35.8753, 345.65
Quick tip: We can print exactly two digits after decimal by: print("{:.2f}".format(value/variable..lets say 9.600000)).
The output is: 9.60
Note that this is not what round() function does. round(9.600000) will give an output 9.6