00
Days
00
Hours
00
Mins
00
Secs
Tutorial Challenge / Ends November 5
🎁 First Prize $100 GC
🎁 Second Prize $50 GC
🎁 Third Prize $25 GC

Ask coding questions

Posts
Pinned
15
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 ### 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 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 ## **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.
10
posted by Mosrod (103) 12 days ago
15
Music you guys listen to
Do you regularly listen to music? If so, what genres and artists of music?
37
posted by JSer (861) 7 days ago
7
Vacations
If you were able to go on a vacation ANYWHERE where would you go and why?
13
posted by IEATPYTHON (86) 6 days ago
2
Please give me the answer
Instructions from your teacher: Lab Description : Given a distance traveled (miles) and elapsed time (hours and minutes), calculate the speed in miles per hour. distance = rate * time minutes / 60 = hours ( 360 / 60 == 6 hours ) Sample Output : Enter the distance :: 45 Enter the hours :: 0 Enter the minutes :: 32 45 miles in 0 hour and 32 minutes = 84 MPH. Enter the distance :: 96 Enter the hours :: 1 Enter the minutes :: 43 96 miles in 1 hour and 43 minutes = 56 MPH. Enter the distance :: 100 Enter the hours :: 2 Enter the minutes :: 25 100 miles in 2 hour and 25 minutes = 41 MPH.
4
posted by ThomasWeaver (1) 1 day ago
5
Girl wants to get good at coding...
Hi, my name is Cate and I recently discovered I had an interest in coding so with literally zero experience I started teaching myself python using pycharm IDE. I understand concepts pretty well, but there is soooo much information out there, does anyone have any tips for a n00b like me? Or advice for narrowing down a direction in regards to learning? Any help is appreciated!!
21
posted by catejenn (7) 9 days ago
7
Who is your favorite YouTube influencer?
There are so many different YouTube channels and influencers, I don't know who to follow.
5
posted by hayaodeh (39) 7 days ago
7
Thread with the best repl.it/discord bots
I'm talking to the nice people at Discord on Friday and I want to convince them to partner with us on Discord bots. To make repl.it a semi-official place to build and deploy discord bots. I want to show them some examples. So please paste here your discord bot with maybe a screenshot of what it does. Thank you
3
posted by amasad (554) 6 days ago
4
Can I get back on the leaderboard?
### amasad kicked me off I would like some cycles to get back on, so if anybody cares to upvote. :)
12
posted by fullern000 (493) 9 days ago
2
How to check if input is an integer or string (python)
I want to take an input from the user like this. text = input("Enter Text") and then I want to have an if statement like these if text is a int: if text is a float: if text is a string: But I am not sure how to put that in coding syntax. I am programming in python.
10
posted by IEATPYTHON (86) 6 days ago
8
Best resources for learning how to code?
It's no secret that repl.it is a destination for a lot of new programmers or learners. Many of them ask us for recommendations for the best resources to learn how to code. Be it tutorials, videos, courses, etc. We're trying to build the Learn board to become a destination for people to find coding content. In the meantime I'm putting the question to the community: what's the best resources that helped you learn?
10
posted by amasad (554) 13 days ago
9
Repl talk
I wonder why Repl talk isn't called "Reply". A perfect opportunity for a play on words.
7
posted by ChandlerMorell (35) 12 days ago
2
How to play an audio file in python?
I'm not sure how to play audio files. I've tried many stack-overflow answers, but they don't work. Any Solutions?
3
posted by HarperframeInc (5) 2 days ago
1
Could you please help fix the following code in Python?
shopping_cart = ["celery", 4, 9, "beef", 15, 3, "eggs", 2, 12, "bread", 4, 1] item = string() for item, cost, qty in shopping_cart: unit = cost/qty unit = round (unit, 2) print(item[0], "has a unit cost of $", unit)
2
posted by marinazhiv (0) about 12 hours ago
1
My Jquery code doesn't seem to be working. Anybody know how I can fix it?
https://repl.it/@ShirleyLam/FauxInsta2
2
posted by ShirleyLam (0) about 13 hours ago
3
Guess a number game
please figure out how to help me code this game for my tech class
16
posted by JaneDuncan (2) 19 days ago
1
Input is messing up.
https://repl.it/@AWitheredDragon/Computer-Quiz My "name" input is printing two inputs instead of one in the sentence after that.
2
posted by AWitheredDragon (0) about 13 hours ago
3
Mini Project 1
How do I get my user to actually be able to input what exercise or treat and actually input it like for example it says that she can have a treat and the user then puts in Snickers, and then the program goes ahead and runs.
21
posted by Steven204322 (2) 24 days ago
4
Python GUI
is there a python GUI that works in repl?
14
posted by dylanharding33 (3) 20 days ago
1
Python
Translate the following pseudocode for finding the minimum value from a set of inputs into a Python program. Name the source code file "minimum.py". Set a Boolean variable "first" to true. While another value has been read successfully If first is true Set the minimum to the value. Set first to false. Else if the value is less than the minimum Set the minimum to the value. Print the minimum
3
posted by tainguyen3 (0) about 15 hours ago
1
Python 3
How can we access Python 3? I search up Python 3 in the search bar, and I get Python 2.7. Also, can turtle be compatible with Python 3 please? Big thanks!
2
posted by ericyangeric (1) about 16 hours ago
1
Replit Module Does not Exist!
I am outraged that the replit module does not exist on replit! I cannot belive that their own module does not work on their own website. I would be happy to know if anybody has an answer to my problem. Thank you! Edit: Thanks Keganlandfried for solving my problem! Solution: Remove other files
9
posted by HarperframeInc (5) 8 days ago
4
Beginner - Need help with my project
Hey! So I've been trying to learn python for two days and began to make a joke teller. I have it ask the user if they want to hear a joke and if 'yes', than it asks them the joke. Now, I'm trying to make it where after it tells you a specific joke the user will input something like 'what' or '?' and get their answer. I cannot figure out how to get the second input to work. I've tried many things that haven't worked but here is a copy paste of what i have working so far. Thanks! https://repl.it/@jackoq/JokeTeller
16
posted by jackoq (6) about 1 month ago
2
Code
Each time I run my snake game. it just keeps on saying update your pip installer.... what do the mean by that?
27
posted by JoshuaWilmsen (1) about 1 month ago
5
Self-writing code
What if a computer could write its own code?
9
posted by mcko7304 (4) 22 days ago
2
Number Next To My Name
What is the zero next to my name? It's in parentheses. I see a lot of people with a really high number. I'd just like to know what this number signifies. It has the HTML title "cycles".
8
posted by ChandlerMorell (35) 13 days ago
5
Help with coding
<!DOCTYPE html> <html> <head> <title>Major Javascript Folio Assessment Task 5</title> </head> <body> <h1>Life Insurance Policy Generator</h1> <h2>Please input your details</h2> <p id="introductoryvariable"></p> <p id="Question 01"></p> <p id="Question 02"></p> <p id="Question 03"></p> <p id="Question 04"></p> <p id="Question 05"></p> <script> var A1 =("All Users") var A2 =("M") var A3 =("F") var A4 =("Age of <30") var A5 =("Age of 30") var A6 =("Age of 31 and over") var A7 =("High Risk") var A8 =("Med Risk") var A9 =("Low Risk") var A10 =("Yes") var A11 =("No") var A12 =("1") var A13 =("2") var A14 =("3") var A15 =("4") var A16 =("5") var A17 =("5+") var Q1 =("Q1) How old are you?: Age of <30, Age of 30, or Age of 31 and over") var Q2 =("Q2) What is your gender?: M/F") var Q3 =("Q3) What is the risk level at your place of employment?: High Risk, Med Risk, or Low Risk") var Q4 =("Q4) Are you a smoker?: Yes/No") var Q5 =("Q5) How many drinks are you consuming per week?: 1, 2, 3, 4, 5, 5+") document.getElementById("introductoryvariable").innerHTML = 'Hello! Let me ask you a few questions, in order to calculate your insurance policy!'; document.getElementById("Question 01").innerHTML = Q1 document.getElementById("Question 02").innerHTML = Q2 document.getElementById("Question 03").innerHTML = Q3 document.getElementById("Question 04").innerHTML = Q4 document.getElementById("Question 05").innerHTML = Q5 </script> </body> </html>
10
posted by SamCarr (4) 27 days ago
1
HELP PLEASE!!!
// Program to create a simple calculator // Performs addition, subtraction, multiplication or division depending the input from user #include <string.h> #include <cstdio> int main() { char operation; int num1; int num2; int ans; printf("Enter an operator (+, -, *, /): "); scanf("%s", &operation); printf("Enter an integer: "); scanf("%d",&num1); printf("Enter an integer: "); scanf("%d", &num2); switch(operation) { case '+': ans = num1 + num2; printf("The result is: %d", ans); break; case '-': ans = num1 - num2; printf("The result is: %d", ans); break; case '*': ans = num1 * num2; printf("The result is: %d", ans); break; case '/': if (num2 == 0) { printf("The result is undefined"); } else { printf("The result is: %d", ans); } ans = num1 / num2; break; // operator is doesn't match any case constant (+, -, *, /) default: printf("Error! operator is not correct"); } return 0; } Using switch statements I need to create a program which calculates two integers chosen by the user and an operation chosen by a user, however, I don't know how to write a program that will say "undefined" when dividing by 0. How do I do this on C?
13
posted by ARTINAMADANI (0) 17 days ago
1
Importing a course to teach
I have to teach AP Computer Science A this year, and just discovered the set of 114 exercises by Timothy Chen. They look wonderful. However, I can't seem to get started. When I click on the first assignment, it says at the top "This is a preview. Take or import to see all content." Then it goes on to say "By learning or teaching this classroom you will have access to the full functionality." Well, that sounds great, but for the life of me I can't seem to figure out how to accomplish this task of importing to see all content. Can someone get me started? Also, I can't seem to figure out how to search existing answers to questions, otherwise I would have searched to see if this question had already been answered. Perhaps I'm missing something really obvious? Thanks.
5
posted by scottstornetta (0) 4 days ago
1
Google Spreadsheet API in flask python
How can I import all the necessary packages in? I tried using "import oauth2client" but it shows this error message. ![image](https://storage.googleapis.com/replit/images/1538666682543_a05ba6e4d9c68a03d580ee2a55f4f1be.pn)
8
posted by nithilan4 (1) 12 days ago
1
Import github projects.
I was wondering if you could import (clone) a project instead of uploading the files manually.
2
posted by Lokraan (0) 1 day ago
Load more