Based on the previous slides, name some functions that we've learned so far →
(Remember, a function is a named sequence of statements that performs a specific task or useful operation)
How do you use (call) built-in functions in your code? How would you call the function, str, on a value, 300 (that is, convert 300 to a string)? →
"""
1. start with the function name, str
2. use parentheses to signify that you're calling a function
3. within those parentheses, put in the value that you're passing in, 300
"""
str(300)
"""
print can take multiple values as inputs
this contrived example shows two strings as inputs to print
"""
print("Hi ", "there")
Using this code as an example:
num = "5"
x = int(num)
length = 10
width = 7
print(length, width)
Note that print does not return a value to your program; rather it prints values to the screen.
t = type(str(5 + 5))
print(t)
What is printed out by this program? →
The type of the result of calling str(5 + 5), which turns out to be? →
<class 'str'>