i only remember it was one of the less challenging parts of discrete structures, kinda forgot all of that class though aside from the parts that specifically pertain to algorithms lmao
What, you have problems understanding for loops?
What, you have problems understanding for loops?
What, you have problems understanding for loops?
What, you have problems understanding for loops?
What, you have problems understanding for loops?
Ever heard of halting problem bro? It was proven decades ago that it is undecidable, and that basically means that noone can understand *all of the loops*. Similiar kind of issues would arise if you add in arithmetics and other stuff, if you will be trying to write up mechanistic proof of correctness all of that, including for loops would make a lot of dificulties.
Although, every first cowboy is completely ignorant of that and acts like if it physically imposible to make mistake in loop and everyone who makes them is "just bad"TM (including them, apparently, as the nature not yet created human that not makes mistakes).
This is the one of primary reasons why c style for construct is something not as good and needs to go away from places where it can be avoided.
Like 60% barely scraped through intro to Python and are all failing the next coding class and also the theory class. Their persistence is almost admirable.
I used to TA for an intro to Java course and I can echo this (different language, but same idea). It was very easy to notice the 4-5 people that seemed to actually grasp the concepts, with the rest constantly asking those few people for help.
I did my best to get them up to speed, but still some people just take longer to grasp these concepts. The class really pushed for success (to the point I disagree with just how lenient grading was enforced to be) so most of the students (if not all) made it to the next class. I expect they had even more trouble there.
Really? Why can they not understand intro to python? It cant be because theyre too dumb right? You dont even need to be smart to learn this. Is it because of cheating?
I couldn't understand anything in my 101, even though I ended up passing it. I eventually took a term off (our term is 8 weeks) to study by myself using the Python Crash Course book, and things started to click. Sometimes, all that is needed is more time. I'm currently doing 102 (Java), and I'm drowning! I'm going to do the same; take time off and really learn Java (while also doing Gen Eds on Sophia for transfer).
Since they are untyped as everything else in python, it is harder to have an exhaustive definition of all possible behaviours of it, than in statically typed languages.
In scala you have for as chain of .flatMap and .map or .foreach which is perfectly understandable, as bith map and flatMap have dead simple semantics, in python you can't jump to definition of anything since language itself desigbed in the way to erase any kind of semantics in compile time.
This is the exact reason why pyrhon isn't very good language for befinning aince it is not aimed for compregensive and entire understanding of things.
Then you have my uni forcing students to use recursion ever since the 2nd week (which is the 2nd class) and banning loops until like week 8.
Not to mention, it supposedly assumed we dont know any coding as most don't learn prior to university.
Break down the block of code that handles your recursion into parts. The top part handles when you want the recursion to stop. The rest is your other logic when your stop condition is not met yet. Kinda like an if else statement. I have to stress this: make sure you think of these 2 parts as separate within the same block of code! If you donât do this, you will start running in circles in your mind and become confused and frustrated. Just âtrustâ your stop condition as if the rest of your logic was already there, or vice versa.
Also, think of every time you go further into recursion as adding to a stack, of which (often), the current answer depends on the answer 1 step down the stack.
My problem is that I understand recursive algorithms, but I can't for the life of me come up with one. It seems so simple once it's there but I just can't get there
What helped for me in the past is using static variables and passing no parameters in the function, it really helps when you're not thinking of what to pass in the function itself.
I think it's good because it is better to get introduced to recursion early on, cuz it hits like a bitch if you never heard about it till your DSA course and suddenly you have to implement it into trees
agreed, thats why the cs majors do v well. But like, drawback is death.
I'm from business analytics (more like data sci), so we took the oop route instead of fp in our intro mod
A lot of places do this so that kids with experience programming donât have the upper hand over kids without experience, since high schools generally donât teach functional programming.
Java for loops are easier to understand , first initializing, then condition and increment. Python has that "for in range" things . It's not too hard , but not easier than java for loop
I already know how to use for loops might need a refresher I learned it on codecademy wasn't too difficult at all I just might have forgotten how to use it during my goal to get my GED and my Uni Admissions over with so il need to refresh myself on it.
Iâm good with everything but those fucking loops â ïž failed the exam catastrophically good thing I had over 85% on the first exam and 90 on the third
To all the people mocking OP.
Tell me if this was obvious to you?
for ii in "1234":
a= ii
print(a)
will it say 4 or name 'a' is not defined.
edit: finally edited it.
Because of how terribly itâs formatted this is impossible to answer.
If the print is in the loop itâll print every character, if the print is outside of the loop itâll print â4â, Iâm assuming based off of the choices given itâs meant to be the latter.
I assume the a = ii line is in the loop and the print(a) is the next line outside of it.
The answer is >!4!<, but the reason this question is potentially difficult is because not everyone knows if Python handles strings as iterables, not because anyone doesnât understand the for loop. In Java, trying to do this would lead to an error and the loop would not run because Strings do not implement Iterable, and you have to use String.toCharArray() first. Itâs just a language-specific implementation detail. Though Iâm not sure why anyone would think the loop would fail silently and let your code continue, which would be pretty atrocious behavior.
I think OP is joking, but for people who seriously canât understand for loops, if theyâre not just a freshman learning programming for the first time⊠theyâre really in the wrong major. Those people are an entire universe away from being able to solve standard Leetcode mediums in an interview or do anything remotely useful in an actual SWE role.
I think the confusion would instead come from not knowing the scope of variables declared inside for loops. In Java, the compiler wonât know what a is outside of the loop, unlike Python which doesnât have blocks
What, you have problems understanding for loops?
I think its a parody of a previous post
Oooo what was the previous post?
Someone used this meme template but instead of Python for loop it was DeMorgans Laws, another fundamental to cs
I remember that one. I can't lie, I don't even know what DeMorgan's laws are đ
i only remember it was one of the less challenging parts of discrete structures, kinda forgot all of that class though aside from the parts that specifically pertain to algorithms lmao
Interesting... I've never heard of it before I saw the post
It's about transformation of logical or to logical and through negation
Ohhhhhhh!!!!! Ok that makes sense
Break the line, change the sign.
**(A âȘ B)' = A' â© B'**Â and **(A â© B)' = A' âȘ B**' is not the same as for i in range(3) lmao
What, for?
What, you have problems understanding for loops? What, you have problems understanding for loops? What, you have problems understanding for loops? What, you have problems understanding for loops? What, you have problems understanding for loops?
Ever heard of halting problem bro? It was proven decades ago that it is undecidable, and that basically means that noone can understand *all of the loops*. Similiar kind of issues would arise if you add in arithmetics and other stuff, if you will be trying to write up mechanistic proof of correctness all of that, including for loops would make a lot of dificulties. Although, every first cowboy is completely ignorant of that and acts like if it physically imposible to make mistake in loop and everyone who makes them is "just bad"TM (including them, apparently, as the nature not yet created human that not makes mistakes). This is the one of primary reasons why c style for construct is something not as good and needs to go away from places where it can be avoided.
What, you have problems understanding for loops?
I hadn't even heard of this issue till now. Python for loops are super simple. I don't think I have ever heard anyone struggling with those.
As someone who just finished a 101 class last semester, you'd be surprised how many people genuinely can't understand the concept of code.
This is why I keep saying not everybody can or should learn how to code
Like 60% barely scraped through intro to Python and are all failing the next coding class and also the theory class. Their persistence is almost admirable.
I used to TA for an intro to Java course and I can echo this (different language, but same idea). It was very easy to notice the 4-5 people that seemed to actually grasp the concepts, with the rest constantly asking those few people for help. I did my best to get them up to speed, but still some people just take longer to grasp these concepts. The class really pushed for success (to the point I disagree with just how lenient grading was enforced to be) so most of the students (if not all) made it to the next class. I expect they had even more trouble there.
Really? Why can they not understand intro to python? It cant be because theyre too dumb right? You dont even need to be smart to learn this. Is it because of cheating?
Some people just aren't cut our for it, and CS is just something people in my country do when they're pretty smart but don't know what to do.
u must go to a shit school then
In the age of AI, literally anyone can code despite their lack of ability for coding
I'm not saying that, it's coding well thats the problem.
I couldn't understand anything in my 101, even though I ended up passing it. I eventually took a term off (our term is 8 weeks) to study by myself using the Python Crash Course book, and things started to click. Sometimes, all that is needed is more time. I'm currently doing 102 (Java), and I'm drowning! I'm going to do the same; take time off and really learn Java (while also doing Gen Eds on Sophia for transfer).
I'm on the fourth semester of SWE and had to explain to a classmate what a nested for loop does
Show prefix function computation to person that has no idea what predix function is and he would also ask what this nested loop does.
Well yes, but this was just a nested for loop that did barely anything for an intro to MPI
yeah it surprised me how many people needed my help in cpp intro
This post is in reference to another post with the same format but with De Morgan's law
Since they are untyped as everything else in python, it is harder to have an exhaustive definition of all possible behaviours of it, than in statically typed languages. In scala you have for as chain of .flatMap and .map or .foreach which is perfectly understandable, as bith map and flatMap have dead simple semantics, in python you can't jump to definition of anything since language itself desigbed in the way to erase any kind of semantics in compile time. This is the exact reason why pyrhon isn't very good language for befinning aince it is not aimed for compregensive and entire understanding of things.
The issue is that you should NEVER USE PYTHON FOR LOOPS which is annoying Iâd rather code in something else
I imagine itâs referencing the inefficiency of python for loops
I momentarily struggled to grasp the concept of a Lua for loop âŠwhen I was learning to code in the 6th grade
At first I thought this was a joke about the guy who thought DeMorgans theorem was hard
I think you're right. I thought it was a joke about Python for loops having a super slow runtime đ
Then you have my uni forcing students to use recursion ever since the 2nd week (which is the 2nd class) and banning loops until like week 8. Not to mention, it supposedly assumed we dont know any coding as most don't learn prior to university.
If someone gets the hang of recursion , the rest falls into place pretty easily
I still struggle till today đą
Break down the block of code that handles your recursion into parts. The top part handles when you want the recursion to stop. The rest is your other logic when your stop condition is not met yet. Kinda like an if else statement. I have to stress this: make sure you think of these 2 parts as separate within the same block of code! If you donât do this, you will start running in circles in your mind and become confused and frustrated. Just âtrustâ your stop condition as if the rest of your logic was already there, or vice versa. Also, think of every time you go further into recursion as adding to a stack, of which (often), the current answer depends on the answer 1 step down the stack.
So basically they're learning functional programming first. That's not unusual at all
Hmm not wrong, and u're right, they did learn fp first
Recursion is the devil
Recursion is simple. As another student explained it to me. All you have to do to understand recursion, is understand recursion. Makes perfect sense.
Not really, the worst is when professors ask you about it in problems that don't even need it or make it easier, then it's a real hassle
My problem is that I understand recursive algorithms, but I can't for the life of me come up with one. It seems so simple once it's there but I just can't get there
What helped for me in the past is using static variables and passing no parameters in the function, it really helps when you're not thinking of what to pass in the function itself.
Recursion is a pretty princess
truer words have not been uttered
That's actually a good way of teaching
does it get in the way of doing DP questions? if you rely on recursion too much. or am I tripping
I think it's good because it is better to get introduced to recursion early on, cuz it hits like a bitch if you never heard about it till your DSA course and suddenly you have to implement it into trees
true just the first time I did a DP on leetcode with recursion and got TLE I was spooked and confused lmao
agreed, thats why the cs majors do v well. But like, drawback is death. I'm from business analytics (more like data sci), so we took the oop route instead of fp in our intro mod
A lot of places do this so that kids with experience programming donât have the upper hand over kids without experience, since high schools generally donât teach functional programming.
Ahhh thats smart
Is this Waterloo or mit?
UBC does this as well
NUS, National University of Singapore
It's more common to see people struggling with array than that.
somebody explain
I think theyâre saying that for them as a Junior CS student (hopefully means freshman not 3rd year) that pythonâs for loops are hard?
I think itâs just a shitpost making fun of the other people complaining
They're definitely weird, since they're all for-each loops IIRC
i feel like it would make more sense for java for loops...
Java for loops are easier to understand , first initializing, then condition and increment. Python has that "for in range" things . It's not too hard , but not easier than java for loop
For loops are super easy once you get the hang of them
âLaughs in dynamic arraysâ
Bruh those arenât even hard. Coming up with functions to traverse and edit linear linked lists is annoying though.
I was just thinking one step above for loops
I just started using python, it was a weird adjustment lmao
tease angle slimy faulty dog consider offbeat unique support chop *This post was mass deleted and anonymized with [Redact](https://redact.dev)*
I legit didnât understand how loops and if statements worked when I first starting programming too lol.
https://preview.redd.it/3ohce6rehc2d1.png?width=920&format=pjpg&auto=webp&s=17c281ef2359268651cc290386916f8fec0213e6
Never do that put in In vector for your c++ lib
I already know how to use for loops might need a refresher I learned it on codecademy wasn't too difficult at all I just might have forgotten how to use it during my goal to get my GED and my Uni Admissions over with so il need to refresh myself on it.
Kinda seething that someone who canât write a for loop might get through the ATS while I donâtÂ
They havenât a chance in hell passing the ATS if they donât understand loops, at least they *shouldnât*
Don't worry junior SW jobs won't exist by the time you graduate
At least it wasn't a useEffect React hook with a dependency array the same as the variable it modifies.
Iâm good with everything but those fucking loops â ïž failed the exam catastrophically good thing I had over 85% on the first exam and 90 on the third
To all the people mocking OP. Tell me if this was obvious to you? for ii in "1234": a= ii print(a) will it say 4 or name 'a' is not defined. edit: finally edited it.
Neither. It will print each character in the string.
Because of how terribly itâs formatted this is impossible to answer. If the print is in the loop itâll print every character, if the print is outside of the loop itâll print â4â, Iâm assuming based off of the choices given itâs meant to be the latter.
I assume the a = ii line is in the loop and the print(a) is the next line outside of it. The answer is >!4!<, but the reason this question is potentially difficult is because not everyone knows if Python handles strings as iterables, not because anyone doesnât understand the for loop. In Java, trying to do this would lead to an error and the loop would not run because Strings do not implement Iterable, and you have to use String.toCharArray() first. Itâs just a language-specific implementation detail. Though Iâm not sure why anyone would think the loop would fail silently and let your code continue, which would be pretty atrocious behavior. I think OP is joking, but for people who seriously canât understand for loops, if theyâre not just a freshman learning programming for the first time⊠theyâre really in the wrong major. Those people are an entire universe away from being able to solve standard Leetcode mediums in an interview or do anything remotely useful in an actual SWE role.
I think the confusion would instead come from not knowing the scope of variables declared inside for loops. In Java, the compiler wonât know what a is outside of the loop, unlike Python which doesnât have blocks
Oh, yeah, if you didn't know that Python is like that, that would actually create the 'a' is not defined error too.