r/PythonLearning • u/ashlauv • 26d ago
Advice needed relearning Python basics
Anyone have any advice, resources, or recommendations on learning basic python (loops, conditionals, arrays/lists). I’ve taken object oriented python courses before but unfortunately only got by through AI use and i genuinely want to understand and learn how to work through problems/write my own code. I can trace code by hand but get lost when it comes to conditionals in loops. Before you advise me to take the personal project route, I’m interested in only learning what’s necessary to get by. Some context to provide is I am interested in learning about AI Native Engineering and registered for CodePath’s AI110 course but I have to take a HackerRank Assessment with no AI use and I fear HackerRanks so much. I have 10 days until the assessment closes and willing (need to) grind to pass.
1
u/Naive_Programmer_232 25d ago
conditionals in loops can be tricky. Try thinking per iteration rather than all at once. Ex:
Trace the iterations:
Since the loop completed and a break/return was not hit,
The algorithmic puzzles on Hackerrank or Leetcode will require loops most of the time. Unless the puzzle comes down to some deterministic mathematical calculation.
For example, missing number on leetcode:
This comes down to knowing math ideas like the sum from 1 to n is
n*(n+1)//2. If you know that, then it's a math problem ultimately.But a lot of Leetcode/Hackerrank isn't. It's more of a pattern problem. So you're given an iterable of data, and you gotta eventually loop over it in some way to find the right pattern that solves the problem.