Write a function to calculate a tip of 20%.

Note: The simple way to do this is:


```
def calculateTip(amount):
return amount*0.2
```

Note: If you instead want to be sure that you don’t have an answer that includes anything under a penny, you could instead use (though it won’t round up):
```
def calculateTip(amount):
tip= amount*0.2
tipStr = str(tip)
split = tipStr.split(".")
if len(split)==2:
tipStr = split[0]
if(len(split[1])>2):
tipStr += "."+split[1][0:2]
else:
tipStr+= "."+split[1]
return tipStr
```

Computer Science & Information Technology

You might also like to view...

This protocol is used to send data over the Internet or other networks.

What will be an ideal response?

Computer Science & Information Technology

Items such as a Pencil tool, Brushes, Colors, and Shapes are a part of the ________ program

A) Snipping Tool B) Notepad C) Paint D) WordPad

Computer Science & Information Technology

In the code below, the table consists of ________ cells?

This is data
A) 4 B) 1 C) 2 D) 3

Computer Science & Information Technology

How do you generate a random number?

What will be an ideal response?

Computer Science & Information Technology