Home python 3.6 basics: Create a program that captures user input and uses variables to store the addresses to be printed
Reply: 1

python 3.6 basics: Create a program that captures user input and uses variables to store the addresses to be printed

program123
1#
program123 Published in 2018-02-12 23:13:49Z

Please help :)

Write a program to collect input from the user for two complete addresses (name, street number, street name, city, state, and zip code) from the command-line prompt. You will first need to create variables to store the addresses in the variables, and then create the appropriate built-in functions to capture the input from the addresses from the user. The street number and zip must be represented in the system as numerical values. Create a program that captures user input and uses variables to store the addresses to be printed.

I know I need to use eval(input()) to convert the characters to numerical values.

I have this as an outline in python for mac currently, just need to enter the information but I am stuck on what "\n" means. as well as where to enter the information.

#user input for first address
print ("\nEnter first address")
name1 = input("Name: ")
streetName1 = input("Street Name: ")
streetNumber1 = input("Street Number: ")
city1 = input("City: ")
#user input for first address
print ("\nEnter first address")
name1 = input("Name: ")
streetName1 = input("Street Name: ")
streetNumber1 = input("Street Number: ")
city1 = input("City: ")
state1 = input("State: ")
zip1 = input("Zip Code: ")
#user input for first address
print ("\nEnter second address")
name2 = input("Name: ")
streetName2 = input("Street Name: ")
streetNumber2 = input("Street Number: ")
city2 = input("City: ")
state2 = input("State: ")
zip2 = input("Zip Code: ")

print both address

print ("\nFirst address is :")
print ("Name", name1)
print ("Street Name", streetName1)
print ("Street Number", streetNumber1)
print ("City", city1)
print ("State", state1)
print ("Zip Code", zip1)

print ("\nSecond address is :")
print ("Name", name2)
print ("Street Name", streetName2)
print ("Street Number", streetNumber2)
print ("City", city2)
print ("State", state2)
print ("Zip Code", zip2)
sharmila k
2#
sharmila k Reply to 2018-02-13 01:27:37Z

Python 3.x does not evaluate, you need to use int() at the time of getting and storing the user input like below:

streetNumber1 = int(input("Street Number: ")) zip1 = int(input("Zip Code: "))

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297508 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO