Guided Project#2

Profitable App Profiles for the App Store and Google Play Markets.ipynb (103.6 KB)

Hi,

This is my second guided project. Have a couple questions:

When printing the results, the numbers are all over the place. I tried to sort the numbers but did not know how to do it properly when there is a string in front of the number. I did some research and came across this following code online:

companies = [(‘Google’, 2019, 134.81),
(‘Apple’, 2019, 260.2),
(‘Facebook’, 2019, 70.7)]

companies.sort(key=lambda company: company[2])
print(companies)

so I attempted my own version, but I don’t think it worked.

Another question I have is:

Capture2

So this is the correct answer, which returned 3rd and 4th answer as False.
However, if I use else , it would give a different answer. (I thought else , and returning outside of the if statement would give the same answer.)

Capture3

Had lots of fun doing this project. Looking forward to the next one!
Thank you for dropping by this post and would greatly appreciate if you could answer my questions.

Click here to view the jupyter notebook file in a new tab

1 Like

Congratulations on finishing your first guided project. Your code looks good, and the usage of headings to structure your project also looks good.

About the companies.sort(key=lambda company: company[2]) print(companies) I’d? love to know what you were trying to achieve with it

If you require code to run only when the statement returns false (and do nothing else if true) then an else statement is not needed

1 Like

Thank you for your reply!
Capture4
When analyzing the results, I find it hard to read the numbers, so I wanted to return the results based on the numbers in ascending or descending order .

However, I don’t know how to sort it so that it would return[category, “:” , numbers that I want to sort]
So I attempted to turn the list into a tuple and sort it that way.

okay instead of that why not use sort it before you add the column into it and print it out like this,

for list in list_socials:
print(list[1],’:’,"{:.2f}".format(list[0]))

1 Like