Ask Question
Today, 03:15

The format_address function separates out parts of the address string into new strings: house_number and street_name, and returns: "house number X on street named Y". The format of the input string is: numeric house number, followed by the street name which may contain numbers, but never by themselves, and could be several words long.

+4
Answers (1)
  1. Today, 04:45
    0
    function format_address separates it into two strings:

    house_number and

    street_name

    Explanation:

    For example, "123 Main Street", "1001 1st Ave", or "55 North Center Drive". Fill in the gaps to complete this function.

    # Declare variables

    house_number = ''

    street_name = ''

    # Separate the address string into parts

    spi = address_string. split ()

    # Traverse through the address parts

    for ele in spi:

    # Determine if the address part is the

    # house number or part of the street name

    if ele. isdigit ():

    house_number = ele

    else:

    street_name + = ele

    street_name + = ' '

    # Does anything else need to be done

    # before returning the result?

    # Return the formatted string

    return "house number {} on street named {}". format (house_number, street_name)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The format_address function separates out parts of the address string into new strings: house_number and street_name, and returns: "house ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers