I am working on the guided project of “Mobile App for Lottery Addiction” from Stats.
According to the instruction, we should write a function named extract_numbers() that takes as input a row of the lottery dataframe and returns a set containing all the six winning numbers.
I know [4:10] refers to the column index of the dataframe we work on. But why is row[4,10]?
The argument of the function, as the input, is dataframe or the rows of the dataframe?
what does set(row.values) do here?
As a beginner programmer and python is the first language I have ever learned. Sometimes I feel my programming skill still sucks. For the functions I wrote so far in DQ, I was able to write 90% of them under DQ’s detailed step by step instructions. But once without those detailed instructions or DQ just clarify a function’s objectives, I struggle to write one, especially if it involves statements such as if, while and a for loop.
I tried to practice my programming skills on codewars and start to look at some easy questions on leetcode. Those easy questions on leetcode are not easy for me.
What is your suggestion? I may go over my python courses and some projects again.
LeetCode easy question ranges from medium to hard.
If you struggle on doing LeetCode easy, then you have to work on your computer science fundamental knowledge and theory. This step cannot be skipped.There are no easy way out. You have to build the knowledge first.
The question is a word problem. Highlights all the keywords. To answer what the question wants, you have to rephrase into exactly straight to the point. Then each want in the problem represent each step in writing a code.
For not straightforward answer, you have to figure the process of doing what each step want.
@alvinctk WOW, Thank you so much for the detailed information. I certainly will check that online MIT Algorithms course. I thought our DQ data science’s course design had a little bit touch on that topic.
Whenever I struggled writing a function, my husband suggested I draft a pseudo code first. But I have difficulty in even coming up with one. Maybe he is an engineer and I am not. Or maybe I just lack the background knowledge in Algorithms. Or maybe I need to familiarize with all the commonly used syntaxes.
I will certainly try codingbat. I am comfortable with some easy questions from codewars. I think I need to sharpen my programming skills before I get to Leetcode.
Again thank you so much! You are unbelievably so helpful!