just trying to learn how to code
Posted by Dragonate_2010@reddit | learnprogramming | View on Reddit | 25 comments
sooooo... i'm 15 years old, i'm a boy and i use onecompiler for writing codes. however i'm trying to learn more so here's my first quetion: how do i make it so that i can input something like hello and that the x value changes to 2 so it will output a different line of text so i can have multiple lines of text already waiting?
Aggressive_Ad_5454@reddit
You’re wandering around in a huge building with the lights off. Trying to figure out what is there, and how it works, by feel. It’s totally normal to be disoriented. Keep wandering around, and at the same time use explanatory materials. Very smart teachers have worked hard to help people like you. https://wiki.python.org/moin/IntroductoryBooks
You’re trying to do things. Keep trying. The lights will start to come on in this huge and confusing building. Welcome to our great trade.
Aidalon@reddit
You mean a dictionary ?
Aidalon@reddit
I saw your reply,
Maybe you mean like a list of predetermined items like that:
If that’s what you are more or less doing, this is called Finite State Machine
Dragonate_2010@reddit (OP)
no, a code that i can chat with and that will create it's own responses it thinks fit the conversation, but easier. so just me writing responses and giving them a x value and the code looking for the response that fits the input and then changing x = 0 to the value the response has
aqua_regis@reddit
Sidenote:
Instead of posting this, you should just have edited your post to make it clear what you actually want.
No, it's not the wrong place, but you give absolutely zero useful information - that's the problem with your post.
Read the Posting Guidelines and try again, with a meaningful, comprehensive post.
Dragonate_2010@reddit (OP)
dude just trying to burn me down instead of being helpful and kind like someone-44 and _mohitdubey_...... you ain't nice....
Budget_Putt8393@reddit
Why would you reject helpful advice from someone with experience? This is the definition of "nice."
Why would you jump to attacking their character?
I don't understand why you, at 15, have this level of anger towards helpful advice.
I am a software developer, here is some advice:
Getting "code that works" is not your only goal at this point. You need to learn why it works that way. A structured course will cover both 1) how a specific language does things, and 2) deeper patterns so you can plan your projects. The planning will lead to more success.
Personal projects are good learning tools, it is exciting to see you pushing through to gain these skills.
Dragonate_2010@reddit (OP)
I SAID SORRY AND ADMITTED MY MISTAKE
thx for the hope you have for me tho
english confuses me man XD i'm dutch and i only understand half of what people say to me...
NationsAnarchy@reddit
This is proper information being presented very nicely, I don't see this as burning you down whatsoever - spend some time reading it instead of calling out someone trying to help you.
Dragonate_2010@reddit (OP)
oh wait i forgot that reddit will totally burn you down if you are "mean"...but thanks for the comment and i see what you mean and i apoligize to aqua_regis
NationsAnarchy@reddit
I know that you are trying to build something and then playing around with it. Welcome to the world of programming ^^ I would suggest you going through some learning materials to understand the basic things first, and then you can use that knowledge to build what you want so you can have something to play around with. Good luck!
Dragonate_2010@reddit (OP)
thx but i did...i used coddy and brilliant...finished both last week...learned a few things...but i'm not someone who learns the same as other's...i learn by people explaining it to me or reading it to me....i learn by hearing over and over again and trial and error...so litteraly nothing works for me...except this :D
_mohitdubey_@reddit
What do you mean by "ALREADY WAITING" btw..?
Dragonate_2010@reddit (OP)
that different x values are assigned different responses. for example: if x == 1: print("hello") if x == 2: print("how are you?") etc
aqua_regis@reddit
Still, this doesn't tell us what you want to do, and why something like this would be necessary.
Describe what program you want to write. Not just bits & bobs - everything.
What do you want to achieve with that?
Why would you need such a construct?
Dragonate_2010@reddit (OP)
because i want a program to talk with because i'm lonely and i want to make myself a friend and i don't care that it's my own code who's my friend, i care that i have a friend.
Someone-44@reddit
Just use any ai app
Dragonate_2010@reddit (OP)
i get it if this post confuses you :D, i'm having a stroke reading it myself too....
Sweaty_Island3500@reddit
I have no Idea what onecompiler is, but maybe I understand what you want to do?
If I‘m guessing correctly you want to have some kind of dialogue, so your program prints something, the user responds and then, based on what the user entered you want to progress in the dialogue. Or in your words, the program prints something different.
If we go off if your idea with the counter you could do something like the following:
But this a very simple approach. A nicer approach would be:
Note that this is not real code, you will have to adjust it to the programming language you are using
Dragonate_2010@reddit (OP)
you absolutely guessed what i meant so congrats! and onecompiler is a place you can write codes idk how to describe it in a different way than "microsoft word for writing codes"
Someone-44@reddit
Can u please add more details for what language do you use and what is the language you working on so we can help
Dragonate_2010@reddit (OP)
did it
Dragonate_2010@reddit (OP)
sure
_mohitdubey_@reddit
But I can't "LEARN" what you've wrote 😭
Dragonate_2010@reddit (OP)
i know....im asking the people who are on here how i can do it....i ain't teaching something...was this the wrong place to ask my question?