Question: Hi, I have a python program that is not working for some reason would you be able to help me figure out the problem and
Hi, I have a python program that is not working for some reason would you be able to help me figure out the problem and also i want to write it in c ++ too but i don't know how can you show me how to do it in c++.
what does this program suppose to do :
create a program that has a procedure that accepts an address and then prints it again but formatted nicely
-
the function will have 1 default parameter, the apartment number
-
not every address has an apartment, so it might not have this values
-
function should accept (just Canadian addresses):
-
Addressee
-
Apt. Number (optional)
-
Street number
-
Street name
-
City
-
Province
-
Postal Code
-
in the output, it should look something like this format

this is my code
#!/usr/bin/env python3
# Created by : Ahmad # Created on : Dec 2021 # This program prints out your name, using default function parameters
def city_address(Addressee, Apt_Number, Street_number, Street_name, City, province, Postal_Code = None): # return the full formal name
if Apt_Number != None: city_address = Addressee + " " + Apt_Number + " " + street_number + " " + Street_name + " " + city + " " + province + " " + postal_code[0] city_address = Addressee + " " + street_number + " " + Street_name+ " " + city + " " + province + " " + postal_code return city_address
def main(): # gets a users name and prints out their formal name AptNumber = None
Addressee = input("Enter your addressee: ") Apt_Number = input("Do you have a apartments? (y): ") if Apt_Number.upper() == "Y" or Apt_Number.upper() == "YES": Apt_Number = input("Enter your apartment: ") street_number = input("Enter your street number: ") street_name = input("Enter your street name") city = input("Enter your city: ") province = input("Enter your province: ") postal_code = input("Enter your postal code: ")
if Apt_Number != None: city_add = city_address(Addressee, Apt_Number, Street_number, Street_name, City, province, Postal_Code) else: city_add = city_address(Addressee, Street_number, Street_name, City, province, Postal_Code)
print(name)
if __name__ == "__main__": main()
The Addressee (First Line) Civic Address (Second-last Line) Municipality, Province and Postal Code (Last Line) JOHN JONES 10-123 1/2 MAIN ST SE MONTREAL QC H32 27
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
