0

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)
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by richieking
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.