CS158-1L: Artificial Intelligence Laboratory Machine Problem #1: Getting Started With Python
CS158-1L: Artificial Intelligence Laboratory Machine Problem #1: Getting Started With Python
Name: Score:
Section: Date:
OBJECTIVES
● To familiarize the students with the python interface.
● To enable the students to use some basic operations.
Instructions:
2. You will submit a zip file and containing the following and send it to BB .
a. PDF file of Machine Problem 1 provided with the screenshot of your answers.
b. Python script with .py extension.
PROBLEM
print(format_name("John", "Katigbak"))
# Should return the string "Name: Katigbak, John"
print(format_name("", "Domingo"))
# Should return the string "Name: Domingo"
print(format_name("Bon Ryan", ""))
# Should return the string "Name: Bon Ryan"
print(format_name("", ""))
# Should return an empty string
b. The function “fractional” divides the numerator by the denominator and returns just the
fractional part (a number between 0 and 1).