Question: def format _ address ( address _ string ) : house _ number = street _ name = # Separate the
def formataddressaddressstring:
housenumber
streetname
# Separate the house number from the street name.
addressparts
for addresspart in addressparts:
# Complete the ifstatement with a string method.
if
housenumber addresspart
else:
streetname addresspart
# Remove the extra space at the end of the last "streetname".
streetname
# Use a string method to return the required formatted string.
return
printformataddress Main Street"
# Should print: "House number on a street named Main Street"
printformataddressst Ave"
# Should print: "House number on a street named st Ave"
printformataddress North Center Drive"
# Should print "House number on a street named North Center Drive"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
