Skip to content
← Back to Community
Guide to Asking Coding Questions
Profile icon
h
has Hacker Plan
Mosrod

Guide to Asking Coding Questions

Why?

Good questions help your question be solved faster, and people will want to answer your question

Bad questions waste time, you will often not get answers that you asked for, and people will often ignore your questions

Quick Questions Guide

Do This

  • Always ask your questions in English
  • Explain what you want the code to do
  • Explain what the code does
  • Include error messages
  • Share the repl with the line numbers
  • When you figure out the answer, update your post
  • Put the repl link, instead of pasting code

Don't Do This

  • Don't post homework questions
  • Don't use caps in the title
  • Don't use words like 'HELP' or 'PLEASE' in the title
  • Don't post questions that already have an answer (Search Box)
  • Don't post feedback or bugs on Talk, use repl.it/feedback for feedback, or repl.it/bugs for bugs

Steps For Better Questions

  1. Understand the code

    • Read your code and figure out what each line does
    • If a concept is unfamiliar, Google it
    • You can also use a debugger to help you
  2. Describe the problem

    • Explain what you want the code to do
    • Explain what the code does (error messages)
  3. Provide the code

    • Share a repl that has your code
    • Share the line number(s) of your code issue
    • Make sure that the code you shared has the issue
  4. Format code consistently

    • Make sure your code is easy to read
  5. Check for typos

    • Make sure the code does not have any typos that would cause the problem
  6. Explain what you did to troubleshoot the problem

    • Make a list of what you think the problem is and try to fix your problem by going through the list
  7. Make a guess on what you think the problem might be

    • Use the list from the previous step
  8. Proofread the question

    • Make sure you provided everything
    • Clear all confusions that you think there might be
  9. Update people on the question

    • If you figured out the answer, edit the post to tell people
    • When you get an answer, fully understand it
    • Be nice to people who answer your question
    • Remember that the people wanted to answer your question, but didn't have to
  10. Things to NOT do

    • Don't post homework questions
    • Only post questions in English
    • Do not use caps in the title
    • Do not use "HELP" or "PLEASE" in the title
    • Don't post questions that have already been answered (Use search box)
    • Don't post feedback or bugs on Talk, use repl.it/feedback for feedback, or repl.it/bugs for bugs

Example:

Question

We have some Python code with an error: repl

rannumexe = int(input()) if rannumexe = 1: print('hi' + rannumexe)

Step 1

We show what each line does using comments.

rannumexe = int(input()) # Asks the user to input a rannumexe if rannumexe = 1: # If the rannumexe equals 1 print('hi' + rannumexe) # Print hi and the rannumexe

Step 2

We want the code to input a number, and if the number is one, print "hi" and the number.

Our problem is that we have an invalid syntax error on line 2 in the main.py file.

File "main.py", line 2 if rannumexe = 1: ^ SyntaxError: invalid syntax

Step 3

Our repl with the issue is located here.

We have an issue on line 2

Step 4

We can change "rannumexe" to "number" to clear confusion

number = int(input()) # Asks the user to input a number if number = 1: # If the number equals 1 print('hi' + number) # Print hi and the number

Step 5

We don't have any typos

Step 6

Our problem could be that we improperly used the if statement

Step 7

The problem could be about using the if statement incorrectly

Step 8

Our final question:

Title:

Invalid syntax error about equal signs

Content:

I have an invalid syntax error on line 2 in the main.py file of this repl. The program should take a number as an input, check if the number is equal to one, and if so, print "hi" and the number. The error point to the equal signs and I think this issue is with the incorrect syntax of the if statement. Help is appreciated :).

number = int(input()) # Asks the user to input a number if number = 1: # If the number equals 1 print('hi' + number) # Print hi and the number
File "main.py", line 2 if rannumexe = 1: ^ SyntaxError: invalid syntax

Steps based on Gordon Zhu's post.

If you have any suggestions or feedback, post it in the comments below.

Voters
Profile icon
BoranW
Profile icon
KaizOffical
Profile icon
harmandeept1
Profile icon
Cryptoler
Profile icon
OmkArGangathade
Profile icon
adfg3
Profile icon
KINGDhruvKolte
Profile icon
FrankieTurner
Profile icon
AaronYe5
Profile icon
mvlnikhila
Comments
hotnewtop
Profile icon
stonefish

Stackoverflow without down votes... There's no stress now finally :)

Profile icon
ChezCoder

@stonefish lol this is what I like about repl

Profile icon
RahulChoubey1
Profile icon
UnluckyFroggy

If I eat myself will I get twice as big or disappear completely?

Profile icon
FlaminHotValdez

@UnluckyFroggy Depends. If u eat urself all at once u will disappear, otherwise you will stay the same size because you're basically moving all the mass of your body into your stomach.

Profile icon
GalaxyWolfX

@FlaminHotValdez Infinite mirror phenomenon

Profile icon
FranklinStopar

@FlaminHotValdez what about when you get to your mouth...how do you eat your mouth

Profile icon
FlaminHotValdez

@FranklinStopar uhhhhhhhhhhhhhh bite your lips. can you bite your lips?

Profile icon
FranklinStopar

@FlaminHotValdez can you bite your teeth?

Profile icon
FlaminHotValdez
Profile icon
FranklinStopar

@FlaminHotValdez so how can you eat your teeth broski...

Profile icon
FlaminHotValdez

@FranklinStopar by grinding them together into powder and swallowing it

Profile icon
FranklinStopar
Profile icon
NathanTodd2

but do you have a throught???
@FranklinStopar

Profile icon
CHRISTIANMATTHY

@UnluckyFroggy If you spam the same comment on popular threads over and over, is this annoying or dumb?

Profile icon
[deleted]

@UnluckyFroggy, First of all your size will be the same. Second, you would look very gross with your stomach inside out.

Profile icon
P0GCHAMPB0i
Profile icon
mechtank

@UnluckyFroggy bruh how can you resist the pain

Profile icon
[deleted]
Profile icon
[deleted]

@ScTaR actually you wont live to see the result. Watchers will also die just looking.

Profile icon
[deleted]

@CHRISTIANMATTHY the best comment on replit

Profile icon
Vargskelethor

How would I be able to be inside of my own stomach?

Profile icon
Logimite

NICE PROFILE PIC

Profile icon
K2TipaE

thanks hehehehhe :))))))))@laksh5

Profile icon
K2TipaE

oh wait you weren't talking to me, sorry <3 @laksh5

Profile icon
Logimite

@K2TipaE Its ok

Profile icon
Steven_The_GuyT

@laksh5 are you talking to me?

Profile icon
Logimite

@Steven_The_GuyT me talk to mosrod

Profile icon
Steven_The_GuyT

@laksh5 we were just kidding :)

Profile icon
deepakchaula
Profile icon
GalaxyWolfX

@laksh5 Me replying to a comment from two years ago

Profile icon
26eldrpa

me replying to a comment from 2 months ago @GalaxyWolfX

Profile icon
Logimite
Profile icon
Michael8910

@26eldrpa me replying to a comment 28 days ago

Profile icon
Logimite
Profile icon
Michael8910

@Logimite hello?

Profile icon
kannibalistic

@Logimite me repling to a comment 3 years agoo.... its been three of your birthdays already!

Profile icon
Logimite
Profile icon
SPQR

Do you think you could add "include programming language in title" or something of that nature? It'd make it a lot easier for one to tell if one can help or not. :)

Profile icon
Mosrod

@SPQR In the future, Repl.it might add tags and you can also join the Repl.it Discord server and the Repl Talk bot sometimes tells you the language. I could add "include programming language in body", but I'm not sure if that would help.

Profile icon
SPQR

@Mosrod If you don't mind adding that, I think that would be helpful. I'd imagine it'd make things come up more frequently in the search results at least. I've been planning on joining the Discord as soon as I'm able, but right now I'm on a Chromebook from my school, and Discord's blocked. Thanks, though.

Profile icon
Steven_The_GuyT

@SPQR yeah, it would be useful

Profile icon
Grify

@SPQR You can dodge the block by installing a VPN or installing Kali Linux on the chromebook

Profile icon
CucaBeludo1

good morning

Profile icon
ryanjbwang

@CucaBeludo1 bruh wtf

Profile icon
ryanjbwang

@CucaBeludo1 bruh wtf

Profile icon
P0GCHAMPB0i
Profile icon
P0GCHAMPB0i
Profile icon
ryanjbwang
Profile icon
ryanjbwang
Profile icon
DJWang

Do you really need help with that problem?

Profile icon
[deleted]

It’s a example, of course he doesn’t need help! @DJWang

Profile icon
DJWang

@CodeABC123 Lol i'm JOKING

Profile icon
Imthebestthe

sorry to ask a question here, but as
you're a moderator, how dose explorer mode work?

Profile icon
CodeLongAndPros

@Imthebestthe It's basically being beta tester

Profile icon
Imthebestthe

@CodeLongAndPros I know but how do I know what I'm beta testing. Thanks for the response tho

Profile icon
CodeLongAndPros

@Imthebestthe Any new feature. There aren't any now.

Profile icon
joan1grrl

thanks for this thread!

Profile icon
XavierDD

Where is the search bar?

Profile icon
Mosrod

@XavierDD Below the Posts header line
This file cannot be displayed: https://storage.googleapis.com/replit/images/1539011051712_11d5b6d554b35ab46b37e3a3c4e0f366.pn

Profile icon
XavierDD

@Mosrod I see none....
This file cannot be displayed: https://storage.googleapis.com/replit/images/1539383626036_ce201a0e5036be59a5c730ebdb7a85c9.pn

Profile icon
Mosrod
Profile icon
XavierDD

@Mosrod Eh... Explore mode is too buggy for IOS Chrome... Nothing works quite right.
Edit : Nevermind seems to work nicely now.
Post Edit : Nope the weird gliches that I can't quite explain happen.

Profile icon
HackermonDev

This is awesome

Profile icon
HackermonDev

👏

Profile icon
CoolCoder200089

vfvf

Profile icon
CoolCoder200089

hi do you want to join me on HTML
CoolCoder200089

Profile icon
DigitCommander

Very helpful! Thanks!

Profile icon
NoahKWebber

for line 3 do
print('hi'+str(number))
Number is a int type and to add it to a string type you need to convert it to a Sting. the str function converts a integer to a string.

Profile icon
ChezCoder

@Mosrod
It says if number = 1:

number = int(input()) # Asks the user to input a number if number = 1: # If the number equals 1 print('hi' + number) # Print hi and the number

and now it says if rannumexe = 1:

File "main.py", line 2 if rannumexe = 1: ^ SyntaxError: invalid syntax

lol wut happened

Profile icon
SixBeeps

@ChezCoder that's supposed to be an error

Profile icon
ChezCoder

@SixBeeps yes but the first variable is number and the second rannumexe.

Profile icon
CodeLongAndPros

I would make repl.it redirect you to this post before you make your first post on ask. That way we can avoid the "IndentionError" messages.

Profile icon
glitchish
Profile icon
CodeLongAndPros

I would add something about following code formatting standards like PEP 8 or K&R. Just a suggestion.

Profile icon
ZacPlayz

Ok....???

Profile icon
AdriaDonohue

._.

Profile icon
Highwayman
Profile icon
AdriaDonohue

@Highwayman just kidding.This is very good advice!

Profile icon
Highwayman
Profile icon
AdriaDonohue
Profile icon
ChezCoder

@AdriaDonohue ======.__.======

Profile icon
DylanMaxwell

Ok, so question: I'm trying to make a text-adventure game and I have almost no clue how I would make some sort of damage calculation. My problem is I have two variable, and I need to have a set number for them. I also have a rand that I need to have an actually random number for every time the player does damage. And I have no clue how I would subtract the rand from the variable. C code.

Profile icon
CodingCactus

@DylanMaxwell ask this as an actual post, not just a comment on this one, then people will answer it

Profile icon
generationXcode

thanks!

Profile icon
pixelpigeon

i need help on how to put a console on c++ i need help badly

Profile icon
Highwayman

@pixelpigeon you don’t need one, when you are not running the repl, the main console output interprets input as bash commands.

Profile icon
pixelpigeon

k thanks :)

Profile icon
AdriaDonohue

noice

Profile icon
EliJonas1

I went on your Hangman project and forked it then I added you to the multiplayer for MY Hangman project, so now you can edit it, Mosrod (I Like You!)

Profile icon
Highwayman

@EliJonas1 ...

👌

Profile icon
EliJonas1

@Highwayman Adding you to multiplayer...

Profile icon
Highwayman
Profile icon
P0GCHAMPB0i
Profile icon
bgrubert

Thank you!

Profile icon
EliJonas1

Can I add you to my multiplayer?

Profile icon
Mendelevium

Cool! Thanks!

Profile icon
EliJonas1

@Mendelevium Hey It's me!

Profile icon
Heypeoples2

Hmm, wow that is a lot of info to process. Before I have any questions, feedback, and other stuff you repl ppl have, I'd better read and understand the rules. Though I really don't look forward to it, once I saw your post. :P But anyways thanks tho. <3