JoshDaBosh (78)

How to modules? In python
posted to Ask by YvngBashit

You would need to import them. For example, to use the time module, you'd do:

import time

and you could use it's functions like time.time(), time.sleep(), etc etc

Stop python code with function?
posted to Ask by EricBromstead

if you've learned about user defined functions, you could put all your code into function main() and call it. Whenever you need it to stop running, you would simply just put the statement return in your code.
If you need more help, please link your repl. ^^

What is wrong with this code?
posted to Ask by DJWang

first off, you should indent your code to make it more readable.

in line 3: replace the single equal signs with double equal signs
in line 4: you're missing an ending parenthesis after random.randint(1, 15)

Classes in separate files (Python 3)
posted to Ask by DanielNorthcott


from {fileName[:-2]} import {className}
William Klein
posted to Ask by WILLIAMKLEIN1


calling "define function (def function) for a simple login
posted to Ask by OmegaX

First, remove the parameters username and password from line 1:
def Login(username , password): -> def Login():
put this at the bottom of your code:

Get rid of the return print() statements and just print() first and then just put "return" at the end.

Have a problem with only this IDE.
posted to Ask by thongth

@thongth change the last 2 lines to just this:
print(*lisR, sep=" ")

Could you please help fix the following code in Python?
posted to Ask by marinazhiv

you forgot to group the ingredients together in shopping_cart like so:

shopping_cart = [["celery", 4, 9], ["beef", 15, 3], ["eggs", 2, 12], ["bread", 4, 1]]
Google Search Discord.Py
posted to Ask by replitcode

you'd need a web crawler and send a query to google

the Live.txt doesnot created
posted to Ask by cup

check your logic line for the if statement:

try this line instead:
if(index($resp->decoded_content, '{"transactionId":"")' != -1){

Need help with a simple Java programming question
posted to Ask by mnp

for the second method:
keep the data elements in an array.

split the array into pairs using this SO thread:

Then iterate through each element of the array (each one should be a sub-array) and if the average is either less that 68% of the general average of all the elements or greater than 168% of the general average, then store that in a new array and that will be the outliers list.

Need help with a part on a JAVA assignment
posted to Ask by mnp

I'm not sure what you're program is since it just says "Uploading java.docx", etc. but if it's an integer counter then i would suggest using modular operations.

Number Guess Game
posted to Share by pole55

try using the new formatting style in your print statements, which makes it easier to read (in my opinion).
i.e. - print("The maximum possible value is {}".format(max_val))

JavaScript starter projects
posted to Ask by MeowC

Perhaps you could try animations, or making something along the lines of a car sim (driving a block around). Of course, you could always try responsive web designing.
I've always wanted to do a physics simulator but I haven't gotten the time yet.

Have a problem with only this IDE.
posted to Ask by thongth

@thongth it's something to do with the end=" " and how repl.it handles it. (I was super confused as well lol)
The "*" in my line is just python "shorthand" for all elements in that list. I've tried using end="\n" and sep=" " in your original code's last line and it works.
Repl.it is funny sometimes :\

If you have time to help with C++
posted to Ask by cchapman

houseType is now a c++ set right
s is a type string, bed is type int, etc. etc.
doubles are a type which can accommodate up to around like 15-16 digits
(ask me if you need more clarification)

If you have time to help with C++
posted to Ask by cchapman

what's the issue?

I need help
posted to Ask by MadeleineFlores

what's the issue?

The Game Of Life - Feedback!
posted to Ask

Very nice! Although you may want to experiment with adjusting the map size if the given window is too small, but that would require the use of a GUI or web browser client

Asking about how to write the code
posted to Ask by TZLALA

@TZLALA unless you're just copy-pasting into your homework portal i don't see why it wouldn't work

what's the issue?

Asking about how to write the code
posted to Ask by TZLALA

@TZLALA how is it not correct

Asking about how to write the code
posted to Ask by TZLALA

@TZLALA you didn't call the function and didn't indent properly

Asking about how to write the code
posted to Ask by TZLALA
def sum2(n1, n2):
    return int(n1)+int(n2)
Asking about how to write the code
posted to Ask by TZLALA

I'm not sure if this is your cs course hw but I'd suggest trying it yourself first.

Anyway, here's the function:

def replaceCharAtPos(s, i):
    if i > (len(s)-1):
        return s
    s = list(s)
    s[i] = str(i)
    return ''.join(s)
python3 not available form drop down in repl.it and a question
posted to Ask by svishnubhatt

1) Repl.it lists python3 as just "python" in the dropdown menu
2) No it is not, at least in python

posted to Ask by KeeganMcGough

you're missing parenthesises

How do I code a program to perform a logical shift to the left with binary numbers?
posted to Ask by arthurabelo

if you're talking about LSHIFT, this would be it in Python:

def lshift(x, am):
        if am >= 8:
                 return "00000000"
        return (x[am:]).ljust(8, "0")

There may be better ways to do it, but that was the quickest way I could think of.

I have gaps in my knowledge. PYTHON
posted to Ask by YvngBashit

come up with your own project that branches off standard info

you'll learn more from experience and researching after you know the basics

Loops in python are super confusing am I right or wrong? PYTHON
posted to Ask by YvngBashit

you iterate through a certain number of times (the most simple for loop)

basically you run the code inside the for loop for the amount specified.

also im not trying to be rude or anything but you're pretty wrong about them being confusing in python, if you've seen loops in other languages