Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Ask GOOD Questions

Give Feedback

People always say there is no such thing as a bad question, but when it comes to programming, it is possible to ask a question badly. When you’re asking for help from someone who has little or no context on the problem you are trying to solve, then it’s best to ask GOOD questions by following this acronym:

  • G: Give context on what you are trying to do, clearly describing the problem.
  • O: Outline the things you have already tried to fix the issue.
  • O: Offer your best guess as to what the problem might be. This helps the person who is helping you to not only know what you are thinking, but also know that you have done some thinking on your own.
  • D: Demo what is happening. Include the code, a traceback error message, and an explanation of the steps you executed that resulted in the error. This way, the person helping does not have to try to recreate the issue.

Good questions can save a lot of time. Skipping any of these steps can result in back-and-forth conversations that can cause conflict. As a beginner, you want to make sure you ask good questions so that you practice communicating your thought process, and so that people who help you will be happy to continue helping you.

avinashhm on Aug. 15, 2019

I love this video lesson .. its very valuable to any newbies in a community to learn how to describe a problem better making it faster, more likely to get a good response.

tuxis2 on Jan. 29, 2020

In the ask good questions video it seems like it’s being asked about #an old way of doing.
string = "A number of words"
float_number = 9000.0
print(f'I can insert "{string}{float_number}" things into the brackets')
Old way?..: Using the Syntax : {}.format(value) or if there are multiple: {} {}.format(value1, value2)
string = "A number of words"
float_number = 9000.0
print('I can also insert "{} {}" things into the brackets this old way'.format(string, float_number))
So it seems the answer with the new method is:
var = 372.52
print(f"{var:06.1f}")
But I’m not sure if it’s correct nor do I quite understand it, what is :06.1f ?

tuxis2 on Jan. 29, 2020

Should have used “Toggle Preview” to make it more legible, since it seems I can’t edit it directly.

This part is more legible this way.

Using the Syntax : {}.format(value)

Syntax if there are multiple: {} {}.format(value1, value2)

tuxis2 on Jan. 29, 2020

Answerish:

print(f"12.3:06.1f}")

12.3- Is just a number.

:- I’m not sure what to call the colon but it seems to do something under the hood to get it to work.

0- Indicates what symbol to use to “pad” the left side.

6- Gives us the number of symbols that must be printed.

.- The period before 1f is also needed to get it to work.

1f- Signifies that it should be displayed as floating point number with 1 decimal place.

Since 12.3 already has four symbols, the number of 0’s we need to pad the left side with to reach 6 symbols in total is 2 or “00”

print(f"12.3:06.1f}")

Will therefore print: 0012.3

Why would you use this?

One use case is if you have many numbers and you want them all to line up underneath each other with the . in the right place.

0012.3

0912.3

9999.9

Simpler one if you just want to use space.

print(f"{12.3:<15} Wow, how did I end up moving 15spaces this way?")
# or
print(f"{12.3:>15}")

It’s kind of the opposite of what I would expect because I feel like it should point towards the side the spaces are being made but it is actually pointing towards the side the number will stay “stuck” to.

”<” The number is justified left.

”>” The number is justified right.

Become a Member to join the conversation.