Question: USE PYTHON Write a function script in python that will return the following: def formatname(first_name, last_name): #put something here #put something here return #put something
USE PYTHON
- Write a function script in python that will return the following:
def formatname(first_name, last_name):
#put something here
#put something here
return #put something here
print(formatname("John", "Doe")) #Should return the string "Name: Doe, John"
print(formatname("", "Swift")) #Should return the string "Name: Swift"
print(formatname("Taylor Alison", "")) #Should return the string "Name: Taylor Alison"
print(formatname("", "")) #Should return an empty string
- The function fractional divides the numerator by the denominator and returns just the fractional part (a number between 0 and 1).
def fractional (numerator, denominator):
#put something here to keep the fractional part of the quotient
return #put something here
print(fractional(5, 5)) #Should return 0
print(fractional(5, 4)) #Should return 0.25
print(fractional(5, 3)) #Should return 0.67
print(fractional(5, 2)) #Should return 0.5
print(fractional(5, 0)) #Should return 0
print(fractional(0, 5)) #Should return 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
