Trying to write a code that finds out if a random latitude is north of a list of cities. I have the latitudes of the cities as was thinking to use them as the random latitudes.

I know this code is wrong, it was the way I could get it to work without any error. It is part of a bigger code.

    elif qcode == 'latitude':
        resp = raw_input ('Is ' + record ['name'] + ' North of ' + str(record['lat']) + ' yes/no?')
        try:
            val = float (resp)
            if (record['lat'] <= record['lat']):
                answ = 'Correct, ' + record['name'] + 'is North of' + str(record['lat'])
                questnum = questnum + 1
                correct = correct + 1
                wrong = wrong
            else:
                answ = 'sorry, ' + record['name'] + 'is not North of' + str(record['lat'])
                questnum = questnum + 1
                correct = correct + 1
                wrong = wrong
            print (answ)
        except ValueError:
            answ = resp + ' it is not yes or no'
            print (answ)

you need o produce more code than this as we cant help you without the entire code that makes sense. post full lenght of code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.