Ask coding questions

Posts
Pinned
42
Guide to Asking Coding Questions
# **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](https://repl.it/feedback) for feedback, or [repl.it/bugs](https://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 constantly - Make sure you 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. Thing 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](https://repl.it/feedback) for feedback, or [repl.it/bugs](https://repl.it/bugs) for bugs ## **Example:** ### **Question** We have some Python code with an error: [repl](https://repl.it/@Mosrod/Question-Tutorial) ```python rannumexe = int(input()) if rannumexe = 1: print('hi' + rannumexe) ``` ### Step 1 We show what each line does using comments. ```python 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](https://repl.it/@Mosrod/Question-Tutorial). We have an issue on line 2 ### Step 4 We can change "rannumexe" to "number" to clear confusion ```python 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](https://repl.it/@Mosrod/Question-Tutorial). 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 :). ```python 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](https://medium.com/@gordon_zhu/how-to-be-great-at-asking-questions-e37be04d0603). If you have any suggestions or feedback, post it in the comments below.
19
posted by Mosrod (180) 5 months ago
1
Can I run new Java 11?
or at least java10, I would love to test the news features from new versions os java.
0
posted by LuisPereira3 (0) 53 minutes ago
1
Node.js: Signature verification (PS256) succeeds in Node.js but fails in jwt.io debugger
https://stackoverflow.com/posts/54806097
0
posted by SamArtuso (0) 1 hour ago
0
I want to use clear screen function in my c++ code on repl
As repl provides ubuntu compiler for c++, I don't know how to use clear screen function and which header file will be used for that function. kindly guide me.
2
posted by RishuMishra (0) 2 hours ago
1
HTML won't run
I'm trying to correct my students' work in HTML, but none of them will run - it says replbox.repl.it refused to connect. I'm using google chrome, if that is relevant. ![image](https://storage.googleapis.com/replit/images/1550749104112_10e9825d99032d7b8b3c31b054568b6a.pn) ![image](https://storage.googleapis.com/replit/images/1550749104738_10e9825d99032d7b8b3c31b054568b6a.pn)
0
posted by emmabarton (0) 2 hours ago
1
JS Assignment 4: Control Flow Continued
Is anyone doing LambdaSchool JavaScript pretest because I have worked for 40 minutes and I can get question 3 from assignment 4 correct.
0
posted by BrianTran2 (0) 8 hours ago
1
Python raw_input error
On my repl (line 62), I have a raw_input. It works occasionally, but most of the time it displays a small part of the string correctly and the rest in the part where I am supposed to type(I can type over it). Does anybody know how I can fix this error? It seems to only happen on here but it would be nice to keep it on here. (https://repl.it/@MiloWebster/Dead-Woods) ![Screenshot 2019-02-20 at 12.52.28](https://storage.googleapis.com/replit/images/1550696057424_2c75654d7815eb3f7f70200003dee95d.pn) EDIT: I pressed \ and it went away. Is this just a visual error?
2
posted by MiloWebster (0) 17 hours ago
1
pip install mechanize ?
Hi i am building a linux distobution and i am using bash and python as my base languages and am building it in a bash repl when i was trying to intagrate one of my terminal apps well many times this has happened It says that there is no module called mechanize (or whatever other module name ) I realized that pip install wasn’t downloaded and of course I do not have root access I cannot just install it myself if someone could install it on whatever servers that host bash repls i would be eternaly gratefull ive tried to figure out a substitute to this but i cant find one https://repl.it/@Scorpia10x/GreyhatOS Plese note its still in beta so not evrything works as planned Thank you -stealth
3
posted by Scorpia10x (19) 19 hours ago
1
i have this HW and the top one is the assignment and the bottom is what i have done on sublime text
![Capture](https://storage.googleapis.com/replit/images/1550684075380_6d2c26ee6d92d911a84e3a875499c627.pn) ![PIC2](https://storage.googleapis.com/replit/images/1550684243739_7e49480a2c10ffc8238a8abeffcd6e0e.pn)
2
posted by hamzaaamir123 (0) 20 hours ago
1
help_me_pls
tryna find friends there, i kno Python (not so good) and like pop punk music
3
posted by nikitasmol (0) 23 hours ago
2
Please change the comment color
Please change the grey color of the #comment on Python to something clearer. Green for example.
4
posted by AzureScripts (11) 24 hours ago
1
What is wrong with this code?
https://repl.it/@AzureScripts/Rock-Paper-Scissors Trying to make a Rock Paper Scissors, but when i choose option "2" it does nothing.
1
posted by AzureScripts (11) 1 day ago
1
After adding a new file, repl's don't run.
I've been using repl.it for about a week now just as kind of a scratch pad. I now want to save across various files but as soon as I create a second file like "xxxxx.js" neither the new file or the old file execute when I press run. The console just returns a new empty line. To make my first repl execute again I have to delete the new file. What's happening? What am I doing wrong if anything?
1
posted by TomBelton (0) 2 days ago
1
How do I increase the font size in the console?
I was able to change the font size in the code editor (awesome!) using settings. How do I change the font size in the console where the result displays?
2
posted by PatriciaSamora (0) 2 days ago
1
bot deployment (multiple questions)
once i have my code and required files written (uploaded), and run the bot, will the bot be online 24/7? even if i close the repl.it tab? or do i need to do something else? i thought i read somewhere that i needed to use uptimerobot, but i can't recall, as i rushed through things like a fool. thank you for your reply(ies)
6
posted by camckee (0) 2 days ago
3
elem.onlick for multiple elements
I'm trying to add several links into a paragraph in Javascript. I am trying to add an `onclick` to each element but it only adds it to the first element created. My Javascript code is: ``` function addDrawing(url, html, id) { var elem = document.createElement('a'); elem.id = id; elem.onclick = function() {tableauClicked(id)}; fetch(url) .then( r => r.text() ) .then(t => elem.innerText = t) html.appendChild(elem) } ``` The code creates a new a element, gives it an id and an onclick event. The `fetch(url)` part gets text from a txt file to be displayed in the link. The link is added to the `html` paragraph. None of the ids are duplicated. My repl is [here](https://repl.it/@NSCarter/Klondike)
3
posted by NSCarter (3) 2 days ago
1
Repl.it as a pwa ?
I use mobile alot and was wounering if in the next update they would make repl.it a progesive web app this would be very helpful to be able towork full screen thank you
1
posted by Scorpia10x (19) 3 days ago
2
Python proxy
Hi ive been experimenting with a python web proxy but i keep getting an error code saying that the port im trying to use is not available Ive tried all the comin ports i could tink of but i keep getting the same error code if anyone can give me a clue as to whats going on id be very thankful https://repl.it/@Scorpia10x/OpulentHollowMicrocode
2
posted by Scorpia10x (19) 3 days ago
1
How can I make a discord bot stay online even after I close the page?
I have a discord bot [here](https://repl.it/@hillsam001/BAD-CHILD) that I made just as a placeholder for my discord server. Everything works fine, but when I close the tab it goes offline! How can I make it stay online?
3
posted by hillsam001 (21) 3 days ago
1
Someone joined my multiplayer. what do i do?
so i was making a small number guessing game with my friend. we were doing too much.. just mucking around for a bit to have a break, lol but anyways someone joined by the name of Anon-NpsBogf and i have no idea who that was. they left immediately. is this normal when starting a multiplayer room? i have only shared the code with my friend.
1
posted by AlaricGalbraith (0) 4 days ago
3
File changes not shown in real time for HTTP server use case
When running HTTP servers, files that are created programmatically won't show up until running the repl again. This can be relating to a mentioned limitation in the docs: https://repl.it/site/docs/repls/files#file-changes This limitation causes major impact during normal use, e.g. log file cannot be inspected while the HTTP server is running. Please consider exposing the files in a running repl for real time access. https://repl.it/@kennethtom/NeighboringHightechPoint
1
posted by kennethtom (2) 4 days ago
1
Hello repl.it
Hi, I am a new repl.it user but am quite impressed so far. For a 'read–eval–print loop' it actually has a pretty decent little project management system in there! One question though - is c++17 support coming any time soon? It's not a deal breaker right now, but it may be one day soon-ish. This is really the only thing holding my back from subscribing at the moment. c++11 support seems to work, but the syntax checker doesn't appear to recognize c++11 code and I get annoying 'cquery' warnings in the editor when I use c++11 features like initializer lists and range based for loops. Apart from that, nice work! Bye, Mark
1
posted by mark_sibly (0) 4 days ago
1
c++17 support?
Hi, I am a new repl.it user but am quite impressed so far. For a 'read–eval–print loop' it actually has a pretty decent little project management system in there! One question though - is c++17 support coming any time soon? It's not a deal breaker right now, but it may be one day soon-ish. This is really the only thing holding my back from subscribing at the moment. c++11 support seems to work, but the syntax checker doesn't appear to recognize c++11 code and I get annoying 'cquery' warnings in the editor when I use c++11 features like initializer lists and range based for loops. Apart from that, nice work! Bye, Mark
2
posted by mark_sibly (0) 5 days ago
1
Why does this program have a problem
For some random reason, line 16 doesn't work (could be multiple lines of code with the same problem) and I have proof-readed it to my best shot and it had an error image saying that the syntax is incorrect even though the program looked as if it is completely errorproof. Please help!
5
posted by madmonster (3) 5 days ago
1
why wont my code work also i don't want to use bin()
dinary = int(input("input a dinary number between 0 and 255 ")) while dinary <0 and dinary >255: dinary = int(input("input a dinary number between 0 and 255 ")) bit8 = dinary%2 dinary1 = dinary//2 bit7 = dinary1%2 dinary2 = dinary//4 bit6 = dinary2%2 dinary3 = dinary//8 bit5 = dinary3%2 dinary4 = dinary//16 bit4 = dinary4%2 dinary5 = dinary//32 bit3 = dinary5%2 dinary6 = dinary//64 bit2 = dinary6%2 dinary7 = dinary//128 bit1 = dinary7%2 print(bit1,bit2,bit3,bit4,bit5,bit6,bit7,bit8,)
1
posted by u16hallamj (0) 5 days ago
1
GCC compiler switched to Clang. Now barely any of my code runs.
What is with Repl.it these days? First you don't offer command-line arguments (to enable unsafe pointers in C# for example), and now you replace GCC with Clang. Now many of my Repl's do not work anymore. And there's no option to choose which compiler to use. Really, what is Repl's design goals when you swap out compilers like this and offer no option to choose the compiler or the compile-options?
0
posted by bryc1 (0) 5 days ago
1
Discordpy [rewrite] custom send function not being defined
For my bot (rewrite), I have a function that changes every command that is updated every command in the `on_command` function, however it seems to not be working? ```py @bot.event async def on_command(ctx): bot.send= CustomSendFunction(ctx)``` ```py @commands.command() async def blah(self, ctx): self.bot.send('blah')```(I'm doing this so I dont have to custom define my send function in every cog file) The error I'm getting is `discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'AutoShardedBot' object has no attribute 'send'` Anyone know why this isn't working/any simple alternatives?
1
posted by chocolatejade42 (8) 5 days ago
1
Watch and Code Hlep
Hey all, I'm following along with Watch and Code to learn JS, so I'm really new. I was doing pretty well until I ran into a problem. Essentially, I'm trying to change the boolean using the "!" (see the bottom function). But I'm being told 0 is undefined, and I don't understand why. I think I followed the code in the lesson I'm working on (and I tried to compare our codes) and his obviously worked. So if anyone sees what I'm doing wrong please let me know. Thanks! Link to code: https://repl.it/@Mdking2012/UnwillingShadyArchives
1
posted by Mdking2012 (0) 6 days ago
1
Answers
I have worked on a problem for hours now and can't figure it out. I have searched the internet as well. What do I do now?
1
posted by ms_barnett (0) 6 days ago
1
Java: Converting alternating characters in a string to uppercase and lowercase
When I use my code, it tells me that "a" is not locale. I don't know what that means or how to fix it. Can somebody help? My program is below. https://repl.it/student/submissions/4519126
3
posted by 20rduncan (0) 6 days ago
Load more