0% found this document useful (0 votes)
9 views

Python_Built-InFunctionsPracticeProblemsSolutions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Python_Built-InFunctionsPracticeProblemsSolutions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Built-In Functions Practice Problems Solutions:

"""

abs() and type():


1.use abs() to get and print the absolute value of a positive number
2.use abs() to get and print the absolute value of a negative number
3.use type() to get and print the type of a float
4.use type() to get and print the type of an integer
5.use type() to get and print the type of a boolean value
6.use type() to get and print the type of a string

"""

# ----------------------------------------------------------------------------------------------------------------------

# 1.
print​(​abs​(​2​))

# 2.
print​(​abs​(-​5​))

# 3.
print​(​type​(​3.21​))

# 4.
print​(​type​(​7​))

# 5.
print​(​type​(​False​))

# 6.
print​(​type​(​"string"​))

# ----------------------------------------------------------------------------------------------------------------------

"""

max() and min():


1.use max() to get and print the largest of inputs of your choosing that are all integers
2.use max() to get and print the alphabetical maximum of inputs of your choosing that are all strings
3.use min() to get and print the smallest of inputs of your choosing that are all floats
4.use min() to get and print the alphabetical minimum of inputs of your choosing that are all strings

"""

# ----------------------------------------------------------------------------------------------------------------------

# 1.
print​(​max​(​1​, ​3​, ​9​))

# 2.
print​(​max​(​"a"​, ​"c"​, ​"f"​))

# 3.
print​(​min​(​3.9​, ​92.7​, ​1.3​, ​4.0​))

# 4.
print​(​min​(​"sdfjsdhfkh"​, ​"asdkuhkuh"​, ​"aaaaaaaaa"​))

# ----------------------------------------------------------------------------------------------------------------------

You might also like