Coding help for project idea | Sololearn: Learn to code for FREE!


Coding help for project idea

Hi, I'm currently teaching myself coding and I am finding it a little challenging. I have decided to start a little project to help my coding experience. The premise of it is, I am trying to write a function that calculates the species richness of a habitat, based on my observations of various fish species. I want to write a list based on user input, have the function return a tuple consisting of the number of species I have cited (different species), remove any duplicates and list these species in alphabetical order. As you can probably tell I have my vision clearly laid out, however, the way in which I execute this project is challenging. The sophisticatedness of the coding doesn't have to be high level, only that it makes sense and is readable. Any assistance I can receive with this would be greatly appreciated. Thanks, Amy :D

4/26/2020 2:08:48 PM

Amy Lin

2 Answers

New Answer


Hello! You have a clear idea of what you have to do - and that is nice! You will find challenging the processing of the user input, but Google can help you with that! I can offer you some general guide: First, take the input from the user! Here the challenge arises, why? The user can enter any format he/she wishes! It can be (for example): specie1 specie2 specie3 ... specie1, specie2, specie3, ... specie1-specie2-specie3-... As you can see, the user has infinite options; you must stablish a format to make things easier! You can print on screen the format you wish the user should use - or assume the user knows about the format (not a good idea!) Second, once you have defined the format and you have received the user's input, you have to split or tokenize the input. This is where the fun begins, you need to research a bit! Third, eliminate duplicates and sort the species in alphabetical order. Fourth: return the tuple! I hope this guide helps you :)


Give an example input. My first though would be Counter().most_common() from the collections module.