Need help for a "heavy weight" QS, Python help for beginner

Hi , so basically i didn’t make 100% the same like in the solution (not enough explanations which is bad because i don’t have enough data in this kind of new stuff), and i import the last codes for the finishing i have few QS on that…

"def last_list(database):
database_list =
for key in database:
export = (database[key], key) --------there is something special i need to know here? Like can I do it only from dictionary?(pulling 2 parameters)
return database_list

of_ios = last_list(genre_ios)
of_google = last_list(genre_google)why for this type of codes i was needed to do the print under compare to the apple_final and the google final which just printed by its own its making me so confuse to be honest


def highest_genre(database):
table_sorted = sorted(database, reverse = True)Am i must use the reverse name or not? and the True function here is basically saying hey i want to start from the biggest to the lowest right? so if i wasn’t use the True it was start from the low to the highest? Also the sorted can’t work in dictionary only from lists?
for row in table_sorted:
print(row[1], ‘:’, row[0])- so its consider (database[key], key) as a different part now my questions i how the hack should i call to the different parameters in this list i mean if row[1] and row[0] are all over the list even for stuff in the 232 place how should i have control on things i will want to use without calling the whole other “friends”

apple_final = highest_genre(of_ios) - why in this type of codes it printed the “data” compare to the ios thing i have mentioned above(As well the google) and here the print of the variables or whatever is printing None(for the print_final thing below, so confusing)
google_final = highest_genre(of_google)

This is a short video’s recording - Loom | Free Screen & Video Recording Software

Fast response will be appreciated so i will be able to understand better for the continues lessons, Thanks!!!

Hi @yovel860

It is difficult to understand what is happening with your code without context (please provide a link to the mission you’re working on) and proper code formatting (it’s hard to read without indentation). Please see this post for some tips and tricks for asking technical questions in the community.

Also, what is genre_ios and genre_google? Are they dictionaries? Lists? What data do they contain? How did you define them? Providing all of your code would help a lot with helping to troubleshoot your results.

I’m not 100% sure but I think the reason you’re seeing None being printed as output is because the objects you’re trying to print are empty. Again, without more context I can’t be sure though.

That is correct: sorted() by default will return a list with elements going from smallest to largest. If you set reverse = True then it will return largest to smallest.

By default, Jupyter Notebook will print the results of your last line of code. When you add more lines, it does not show the output of that code and you must use print() to see the results.
also, something in my codes got messy

"categories_android = freq_table(android_final, 1) —solutions/Mission350Solutions.ipynb at master · dataquestio/solutions · GitHub(why they compare categories_android to the android_final i mean the source of the category thing is the same and im sure its almost duplication stuff or they just want to check again everything is fine ?

for category in categories_android:
    total = 0
    len_category = 0
    for app in android_final:
        category_app = app[1]
        if category_app == category:            
            n_installs = app[5]
            n_installs = n_installs.replace(',', '')
            n_installs = n_installs.replace('+', '')
            total += float(n_installs)
            len_category += 1
    avg_n_installs = total / len_category
    print(category, ':', avg_n_installs)"