Renaming Python’s Functions¶
int are names. They are variables whose values are a set of statements that achieve a goal. Later on, we’ll know enough code to write
int ourselves. The important point right now is that
int are names for functions. You can create several names that have the same value. You can think of this like how a person can have both a name and a nickname. In the program below we demonstrate that you can even create new names for Python functions.
- No, absolute will change the negative
- No, the original number will change
- No, noDecimal will remove the decimal part
- Yes! Absolute will make it positive, and noDecimal will throw away the values after the decimal point leaving just the 16.
csp-6-7-2: If you add one more line to the above program, print(noDecimal(absolute(-16.789))), what prints?
Discuss topics in this section with classmates.