Problem with First Python Script using what I have learned


#1



I am having problems with a linux terminal .py script that I wanted to create.
Basically I just wanted something where you can input a city like chicago, and get the gps coordinates.
so far I am only able to produce a full list of all the cities and not the specific information for each city like I wanted.
thanks for any help in advance.


Replace this line with your code. 
print("\033[3;33;40m Welcome to GPS Coordinates, Enter City & Press Enter, To Get GPS Coordinates. \033[3;33;40m \n")

original = raw_input('Enter a request:',)
toronto = raw_input('Continue Pressing ENTER')
chicago = raw_input()
montevideo = raw_input()
tokyo = raw_input()
paris = raw_input()
rome = raw_input()
if len(original) > 0 and original.isalpha():
    print 'FULL LIST'
  
else:
    print 'FULL LIST'
    
if len(toronto) > 0 and toronto.isalpha():
    print ''


else:
    print 'Toronto 43.6532 N 79.3832 W'



if len(chicago) > 0 and chicago.isalpha():
	print ''

else:
	print 'Chicago 41.8781 N, 87.6298 W'

if len(montevideo) > 0 and montevideo.isalpha():
	print ''

else:
	print 'Montevideo 34.9011 S 56.1645 W'

if len(tokyo) > 0 and tokyo.isalpha():
	print ''

else:
	print 'Tokyo 35.6895 N, 139.6917 E '

if len(paris) > 0 and paris.isalpha():
	print ''

else:
	print 'Paris 48.8566 N, 2.3522 E'

if len(rome) > 0 and rome.isalpha():
	print ''

else:
	print 'Rome 41.9028 N, 12.4964 E'


#2

What's stopping you?

BTW you have lots of repeated code, consider storing cities in a data structure instead, so that you can do something like:

print coordinates[city]

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.