Search code examples
pythonpython-3.xgeolocation

Unable to take user input to add the markers


In the below code I'm unable to take user input to add marker of Lat and Longitude. It would be of great help if someone helps me in this problem

import pygmaps
mymap5 = pygmaps.maps(Lat, Long, Zoom)
a = float(input("Enter the lat of Person - 1 :"))
b = float(input("Enter the longitude Person - 1 :"))
mymap5.addpoint(a[0], b[0], "#ff0000", "Title")
mymap5.draw('pygmap.html')

Solution

  • You are trying to index a float, which is not supported. Try putting the following in your interpreter:

    a = float(input("Enter the lat of Person - 1 :"))
    b = float(input("Enter the longitude Person - 1 :"))
    
    print(a, b)
    

    In short, it looks like you just need to use a and b rather than a[0] and b[0].