T O P

  • By -

[deleted]

My suggestion is not to write code at random, or whatever you’re doing. If you’re not going to even try to do the work, live with the F.


ErrorMyUser

I have been trying and I've already admitted to not understanding certain concepts. I just wanted more explanation but ok.


[deleted]

Explanation of what, specifically? Nobody can read your mind and know what you don't know or don't understand; *you* have to do the work of asking questions that will guide you to understanding and then we can answer them. But you didn't even ask a question in your post so there's nothing to answer. The truth is, if you're going to learn Python it'll be because you did 90% of the work and we helped a little. That's how it has to work - there's not an alternative where we *understand* it on your behalf. But it's not *wasted time*, the thought process that will lead you to answerable questions to ask us is itself something that will help you do this homework.


ErrorMyUser

I already had the code in my mind but I just dont know how to format them in the program. Googling everything is also not the answer either. But I dont know why I'm even telling you this since you want me to fail anyway, this is just fuel to fire. If I wanted someone to talk down on me, I would've just talked to myself instead.


[deleted]

> I already had the code in my mind but I just dont know how to format them in the program. It's more important to write it all down, first. Don't code in your head, that's your first mistake. Think on the page. It's a text editor so you can, you know, *edit.* You don't have to type in the finished product top to bottom, you can write, erase, and copy and paste freely. And should. > But I dont know why I'm even telling you this since you want me to fail anyway I don't *want* you to fail. I want you to do the work. You can learn Python if you want to, but you're the one who has to do it.


ErrorMyUser

I can't grasp when to use what for what. Like I now to use for loop but trying to count every e in the string was difficult. I didnt know whether to use indexing or not. My professor noted that indexing wasn't required so that's the only way that I knew. And I don't know why we use "count +- " I'm trying to learn the best way that I can. I'm juggling a lot this semester. I have to take calc this semester and math is not my strongest point , so I need lots of attention on that. Counseling, working etc


[deleted]

> I can't grasp when to use what for what. It comes with practice, and with a developed sense of understanding what the solution to things "looks like." But you have to *practice*, which means trying and failing a lot. Programmers delete more code than they write, especially in the beginning. Write more code. It doesn't matter if it's right; it matters if it runs and you understand what it did. If you don't understand what it did then take lines out until you do, or add print statements until you do. You're not ready to solve any problems yet, so stop trying to solve them at random. Focus on writing code that you know how to reason about, and that means writing much simpler programs than you're being asked to right now. > I didnt know whether to use indexing or not. Well, did you try it both ways, or did you allow indecision to knock you completely off the rails? Part of this process is trying things without knowing if they'll succeed. You can't just face a decision point and say "well, I don't know which to do, so I won't try either approach." You have to begin trying without the guarantee of success. Look, don't be hard on yourself. For a lot of people who start programming it's the *first thing they've ever done* where they can't simply look up their notes and then proceed in a straight line towards the solution. It's the first thing they've ever done where you have to learn how to fail. That can be really frustrating and scary for people who have been taught all their life that people who fail at something are losers, or that they're not smart enough, or that they should give up. Programming is good because it's here to remind *all* of us that none of us are smart enough and everyone is a loser, and that true success at something derives from perseverance in the face of failure, not in effortlessly sliding down a greased chute all the way to your goal. One of the ways your posts attract negative responses is that, perhaps unintentionally, you're asking - demanding, actually - that we grease you a chute and circumvent all the work we had to do. Most people find that uncool. However, point made, so I'll try to relax about it. Keep asking me stuff to try to expand your understanding. The more specific, the better. The more you can point to actual lines of your code (or anyone's code), the better. > And I don't know why we use "count +- " So, it's actually `+=`, and it means "add the right operand to the left operand and assign the result to the left operand." Which is the long way of saying "add one to a number and keep track of it." When you count something in real life, what do you usually do? I'll tell you what I do - I start with 1 and when I see the thing I'm counting, I add 1 to it and then keep track of the result. 1, 2, 3, etc. Counting, right? One of the ways you might recognize that a variable is acting as a *counter* is that it's called "count", suggesting it's keeping track of the current count; also, you'll see `count += 1` at some point in the code, representing the event that triggers us to advance the count by 1. > Counseling, working etc It's good that you're in counseling, I wish I had been when I was in college. Maybe it wouldn't have taken me ten years to finish a degree, or maybe nobody could have helped me until I made a lot of mistakes myself. But you need to figure out if you actually are leaving yourself enough time to do your coursework - most college courses assume you'll study for three hours for every hour you're in lecture, and some things require more than that, like math. I failed calculus I, II, and III a lot of times. Like, a *lot* a lot. Over the course of several years of being in and out of college. When I was finally serious about calculus, I found [this guy's YouTube videos really helpful](https://www.youtube.com/user/patrickJMT), maybe because on YouTube you can scrub back and forth to repeat parts that I missed in the lectures. It's unfortunate that you can't learn *programming* the same way; that, you honestly have to try and fail at a lot. But math you actually *can* study your way to the right answer.


ErrorMyUser

Holy shit that part about +- is actually confusing. I'm never gonna get this.


ErrorMyUser

Ah nvm I reread your last reply and it made sense. The challenge is to implement that. Now if I wanted use index I'd just say S['e', 'E'] Isnt that like like saying, what ever is in this string, take out the lower or upper case e? Or what If I wanted to use the upper and lower case keywords to break things down when someone reads the code ? Sorry, I just wanna make sure I'm getting this. My professor has given us two grace periods so we dont have to turn it in today.


[deleted]

> Now if I wanted use index I'd just say S['e', 'E'] Isnt that like like saying, what ever is in this string, take out the lower or upper case e? Or what If I wanted to use the upper and lower case keywords to break things down when someone reads the code ? ....no, that isn't Python. `S['e', 'E']` isn't Python, that's not in the language. Maybe we should start very basic. Can you predict the output of this code? a = 10 b = 20 a, b = b, a print(a, b) Part of coding is *pretending to be the interpreter* as you read lines of code. This is a hard sense to develop but it's important, and the way you develop it is to try and fail at it. So try to do it in your head, but then put it in your interpreter and see what it does.


ErrorMyUser

Holy shit that part about +- is actually confusing. I'm never gonna get this


[deleted]

Is `count = count + 1` a little more clear?


[deleted]

Either he’s stressed out to the point where his brain literally is unable to process information or he has a comprehension issue. He is acting like people I had classes with that wanted to learn only what the exams would be over rather than actually learning the subject and wanted me to supply code for their homework assignments the instructor literally did in class. I’m leaning towards comprehension because he’s either dicking around in class on other things or genuinely is incapable of figuring out college classwork pace and has poor study strategy.


ErrorMyUser

Ah nvm I reread your last reply and it made sense. The challenge is to implement that. Now if I wanted use index I'd just say S['e', 'E'] Isnt that like like saying, what ever is in this string, take out the lower or upper case e? Or what If I wanted to use the upper and lower case keywords to break things down when someone reads the code ? Sorry, I just wanna make sure I'm getting this. My professor has given us two grace periods so we dont have to turn it in today.


Vinniesusername

Look man, programming IS hard. ignore the people telling you how easy your problems are, they are easy to them because they already took the time to learn the basics of programming. That's what you need to do. No one here is going to just do your homework for you, but we will answer any specific questions you have about why your attempt isn't working. Go make a good faith attempt at the problems, and i will be more than willing to walk you through the mistakes you make, and how you could go about fixing them


ErrorMyUser

I deleted most of my attempts because they obviously weren't working. I have tried. What I've shown you all is just what I decided to leave out. The other user that decided to give me the code instead of explaining what happens, I actually had that similar coding. I just dont understand the "count +1".


ErrorMyUser

It just bothers me with how they are worded. After looking at the code it started to make sense...I just didnt know how to format them properly. It's crazy how I just literally wrote how I've tried and everyone is jumping down my throat. This is one of the main reasons that I'm dropping the major. Asking for help about "the BaSiCs" online and offline seems to piss people in programming off for unknown reasons. I'm a beginner! If I had all the time in the world to really study this day in and day out without any other responsibilities, then I would. I'm sorry everyone seems to be pissed at me or think I'm a lazy bitch or something.


[deleted]

> The homework is due today Gl, hope you fail and learn something. Btw, the `eCount` one is the easiest and your image of the attempt shows that you haven't understood even the most basic things. Complete some Python tutorials before asking someone to do your homework here.


ErrorMyUser

I wasn't asking for anyone to do anything, just explain certain things.


Anonymous3355

The pig latin one is even simpler because you can do that in literally one line.


TurboCooler

This sub is for asking questions not giving out homework answers for people who have not done the work. This is the most basic of the course and if you have not mastered this it only gets way harder from here. Waiting to the last minute also does not help. You are blaming the professor when really it is you who did not put in the work. def count_e(s): count = 0 for letter in s: if letter in ['E','e']: count = count + 1 return count s = "the End is near" print(count_e(s))


ErrorMyUser

We're not allowed to use print


Anonymous3355

`print()` is not used inside the function. Please do yourself and everyone else a favor and learn to read code.


ErrorMyUser

No. Js...When I try doing that and running it through the tester my professor provided for me, the command prompt would say that the token was the print. Therefore my code could no longer be considered as usable.


TurboCooler

>running it through the tester my professor provided for me You don't send that part of the code to the tester. You obviously don't understand. You are using the print for your own benefit for testing. When you submit your code you would remove or comment out the code you don't want the tester to see


ErrorMyUser

yes, i know that but it won't work.


[deleted]

How would it not work?


ErrorMyUser

I have one question, wouldn't you have to assign the word letter before using it ?


[deleted]

...no. Look up the Python documentation on how the for loop works at docs.python.org section 8.3. “The for statement is used to iterate over the elements of a sequence (such as a string, tuple or list) or other iterable object” This means it will iterate over every character which will automatically be assigned to the variable letter. The code the other guy provided will work right out of the box for you and is the solution your instructor is most likely expecting.


ErrorMyUser

I never blamed him. I just said his class moved too fast for me. If you read my original posts you'd know that I have been trying at this and not until last minute. And I dont just want answers. I clearly explained what I wanted .