Hey, in today's programming tool, I will teach you how to ask good programming questions.
Now that is very important not only when you are a beginner, but also if you are an experienced programmer,
because 30% of programmers use Stack Overflow every single day.
So that is every single day.
Now Stack Overflow, it is a forum on asking and answering questions so everyone can ask programming
questions there and everyone can answer them if they know how to answer.
So you get upvotes for giving good answers and you also get upvotes when you ask good questions.
But getting upvotes is not the important thing here.
You should know how to ask good programming questions because otherwise you will not get a good answer
or you will not get an answer at all.
So it's very important to know the way you communicate your problems to other programs so they can help
you.
So Stack Overflow is the biggest repository of question and answers, so you can basically find everything
there.
But if you don't find it, then you can ask your your own question.
So I'll show you how to use StackOverflow and how to ask a good programming question there.
First, let's simulate a problem.
Let's suppose we were trying to create this program.
So we ask the user to enter KGS using this input function and the user enters ten, for example, and
then we try to multiply that by 2.2, but we get this error.
So first of all, you might want to try to search on StackOverflow.
So you want to go to StackOverflow.
And this is the text box where you can search.
I would suggest it to start with Python and then try to put some little details about your code and
above the error.
So in your code you have this input function, so you can say python input.
Event here in error you have this type error.
So it right type.
Error.
Presenter.
And you'll get several answers there.
These can be about anything.
So we want to be more specific there and we want to include the entire error message, the last line
here.
So inputs and then copy and paste that type error can't multiply sequence by non end.
So then you might want to click on the first answer, which usually might might have your solution.
And then down here you have this answer so you can get some clues that this is saying you need to convert
it into a float.
And that is actually the solution here.
So this value will be a string.
So you want to convert it into a float.
Run the codes again.
Answer ten perhaps.
And now no error.
So if I print this out to see the outputs, I'm going to get 22.
So 22.0.
So that is the solution.
Now, that was the research part.
So how to search for a problem so you can search using that box or you could search directly on Google.
So you have to write like Python inputs type error and press enter.
And usually the first few results are from StackOverflow.
In this case, it is the second result.
If you click that, it will take you here.
So this also is another question from somewhere else.
And it also suggests you to use float in front of input.
Now this row input is actually from Python two.
So this is quite an old answer by the way.
Raw inputs was used previously instead of inputs, which is used now.
But this stays the same.
So that is how to research a question.
Now let's see how we can ask you the programming questions.
So on StackOverflow, you can use this ask question button and then you want to provide the title and
the description of the problem.
The title should be written in a way that you should be able to describe your entire question in one
sentence.
So in our case, let me undo this so we get the error.
Reproduced.
So when we run this, we enter a number.
We get this.
So you could say type error when trying to convert k j to ll be s so you're trying to convert kg to
pounds.
But you get a typer and you're using inputs.
Against StackOverflow.
We'll suggest you some existing answers so you can click there if you want.
Otherwise, you can continue with writing your the body of the question.
And here is where you want to be very specific and I'll show you the anatomy of a good programming question.
So first of all, you want to describe what you tried.
I'm trying to get kilograms from the user and convert them to pounds using the code below.
And here is where you paste your code.
So that is the code I copied.
I go here and I paste it.
It's very important to select the code and press that button to highlight the code.
Otherwise the code will be shown in a very chaotic manner and perhaps you'll not get any good answers.
So you see down here how the code will display when I highlight it and don't provide screenshots of
your code, so don't provide an image which has the code inside because others cannot copy the code.
So they might want to try the code on their own ID And the only way to do that, the only sane way to
do that is by providing the text.
Not an image, then you want to describe what error this produces.
So you say that code produced the following error.
And here you want to paste the entire error message.
So be careful.
You want everything.
So all the details, which is the rate text.
Again, the code has to be highlighted.
The error message is also code, so it has to be highlighted and then you want to describe what you
expect the code to do.
I expect pounds to be converted from cage.
And then finally, you want to ask the question again How can I get the KG from the user and convert
them to pounds?
So that's what you want to do and you want to ask that question at the end of your post.
Finally, you want to provide some tags.
Python is the first tag, then input perhaps, which is the function you're using and maybe the error
type error.
You see, these are existing tags that others have used before.
So StackOverflow is suggesting them.
And then if you press on, review your question.
So you just have look at the question and then post your question and it will post it publicly on StackOverflow.
And usually you get answers very quickly in a matter of minutes most of the time.
So that is the anatomy of a good programming question.
Describe what you're doing, Put your code there, put the error message that the code produces or the
output.
If it's an output and maybe you're not expecting that output.
And then here, describe what output you expect so that others know where they can help you and then
ask the question.
And that's it.
So that's about asking programming questions and that's about StackOverflow.
You can ask a question if you like.
Also in the Q&A inside the code.
So again, the same structure would be recommended in the Q&A.
Inside the course, you also have this highlighting feature, so please highlight the code.
It's easier for people to read it on StackOverflow.
You'll probably get answers quicker because there's a big number, thousands of people online all the
time here, so that makes sense.
So thanks a lot.
I'll see you later.