[Solved] Python: Sort dictionary by value (equal values)

dictionaries are unordered (well pre 3.6 at least), instead sort the items d = {3: ‘__init__’, 5: ‘other’, 7: ‘hey ‘, 11: ‘hey’} print(sorted(d.items(),key=lambda item:(item[0].strip(),item[1]))) # output => [(3, ‘__init__’), (7, ‘hey ‘), (11, ‘hey’), (5, ‘other’)] if you really want it as a dict (for reasons i cant fathom) and you are using 3.6+ … Read more

[Solved] the error is ‘int’ object is not iterable, I am working on a small project in python that allows the user to input ten names and ten ages of students [closed]

for element in range(10): … input_ages = int(input(“\t\t\t\t\tNow please input their ages as well: “)) team_leader = max(input_ages) input_ages is a single integer that gets reassigned each loop iteration. max(input_ages) expects input_ages to be a list for which to find the maximum value by iterating over it. Therefore you get ‘int’ object is not iterable. … Read more

[Solved] Please change your browser settings or upgrade your browser ( urllib, python 3.6) [closed]

The site you are accessing requires javascript and cookies. Urllib only provides support for cookies (with cookie jar). To get around the need for javascript, check out a library like selenium, and use it with phantomjs. pip install selenium Selenium with phantomjs is more powerful then urllib, but you pay the penalty of it being … Read more