Elias Bomberger
hacker

@pyelias (678)
A super simple chatroom that is fast and secure
posted to Share by Vandesm14

Your sanitize function doesn't work when given a string like <script 
>. You could fix this by just replacing all angle brackets with &lt; &gt; (I think, that might have problems too).

Proof that .99 repeating = 1?
posted to Ask by timmy_i_chen
.999999..
= 0.9 + 0.09 + 0.009 + ...
= 0.9 * (1 + 0.1 + 0.01 + 0.001 + ...)
= 0.9 * 1 / (1 - 0.1)
= 0.9 * 1 / 0.9
= 1
Python 3
posted to Ask by ericyangeric

The plain "Python" option in the language list is Python 3. Python with Turtle is implemented in a separate project from repl.it, and Python 3 has not yet been added there.

Will paid plans ever include constant uptime for our REPLs?
posted to Ask by 426729

Servers shut down if 30 minutes pass without them being pinged, so you can work around this with a website like Uptime Robot that will ping your website periodically.

/t not working
posted to Ask by Mowatdynes

\t, not /t

takin' a crack at cryptography
posted to Share by Rivase17

A few comments about code style:

  • function and variable names should be snake_case, not camelCase
  • no space after print in print ("stuff")

Code structure:

  • instead of having security, generatePassphrase, etc. print results, return them so you can store the results in a variable and re-use them later.
  • you don't need a reverse function, you can just use "abc"[::-1]

Other things:

  • Caesar cipher, not cesar cipher
  • Your passphrase generator should probably use cryptographically secure random numbers. Look into the secrets module
Text to spech python, Help
posted to Ask by EricBromstead

repl.it runs Linux, not Windows, so Windows modules like win32com don't work. Also, repl.it does not currently support playing sound, so if you want to run this code, you'll have to do it on your own computer.

Monopoly game
posted to Ask by juliomorenotos

When you import main, that re-runs the main.py file, including all your game code. To fix this, you could pass the things you need as arguments, or move card_chooser into main.py.

How are the comments sorted in profile
posted to Ask by spybrave

They appear to be sorted by votes.

The Quest into Abquoria
posted to Share by JohnnyWobble

You might want to salt your hash or something, it's still not very hard to break.

Need help correcting an error * urgent*
posted to Ask by NanaOhene_Nyark

On repl.it your class has to be named Main. (you could also move it to another file named Lab03.java)

problem with TESTOS 2
posted to Ask by Ryanand

Opening a .sh file is not the same as running its contents. If you want to run the files, use os.system like you did in main.py.

Not a coding question (for once)
posted to Ask by FARHEENPALAGIRI

I think what happens here is that once you think of a solution, you just use it without consider other possible approaches. Planning is always helpful. (and if your code is too complicated, you're probably doing something wrong)
Even most large projects I've worked on usually have simple code, just a lot of it.

CodeJam entry (Pong)

I wrote up a version with buffering here: https://repl.it/@pyelias/Codejam4
It runs faster and is a bit less jittery.

What is the update policy of repl.it regarding Rust?
posted to Ask by ylou

Language versioning is on their to-do list, but until it is implemented (no clear date yet), languages will not be updates for compatibility reasons.

I'm annoying, I know, I just really suck at this
posted to Ask by FARHEENPALAGIRI

There is a simpler way to approach this than what you are doing. Instead of finding the part after the decimal, find the part before the decimal (with int) and then subtract it from the original number.

Very odd functionality in list (python)
posted to Ask by cv88

When you do line = key, line and key become the same list, so changing one will also change the other. You can use line = key[:] or line = list(key) to copy key and fix the problem.

Mixing languages in one repl
posted to Ask by iiap623616

If you specifically want to create html+js in Python, you can use a framework like Flask or Django to create a webserver.

Help!
posted to Ask by danielalubezki

numerator/denominator ** -1 is equivalent to numerator/(denominator ** -1). You can add parentheses around numerator/denominator to fix this.

Python - Word Document with docx
posted to Ask by TobiasWagner

Add a requirements.txt file, and put python-docx in it, along with any other external libraries you need.

Mega sales
posted to Ask by RadhikaGupta1

money > 10 <= 20 means money > 10 and 10 <= 20. You might have meant 10 < money <= 20.

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

This seems to have something to do with newline buffering. Add a print() after and it'll work fine.

cloud
posted to Share by xanthsalas

There are quite a few problems here, so I'll just comment the code with the issues:

class queue:
  def __init__(self):
    self.item=[]

  def empty(self):
    return self.item==[]

  def enqueue(self):
    self.item.append=[] # you shouldn't do .append=whatever, you want .append(whatever)
    # also, the only thing you enqueue here is [], so you might want to take an argument and pass that instead

  def dequeue(self):
    return self.item.pop==[] # you don't want .pop==[], you just want .pop()

n=queue()
print(n.empty) # you probably want .empty() here or you'll print the actual function, not the result
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))
  
print("push:",n.item)
n.enqueue(input(""))

n.dequeue() # you dequeue twice here, not sure if this is intentional
print("dequeue",n.dequeue()) 

The revised code:

class queue:
  def __init__(self):
    self.item=[]

  def empty(self):
    return self.item==[]

  def enqueue(self, thing_to_enqueue):
    self.item.append(thing_to_enqueue)

  def dequeue(self):
    return self.item.pop()

n=queue()
print(n.empty())
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))

print("push:",n.item)
n.enqueue(input(""))
  
print("push:",n.item)
n.enqueue(input(""))

print("dequeue",n.dequeue())
Web-Scraping-XKCD903
posted to Share by timmy_i_chen

I'm coming for you! 42 votes and counting right now.

A super simple chatroom that is fast and secure
posted to Share by Vandesm14

@Vandesm14 You also might want to stop sockets from initing multiple times, and from re-using names.

A super simple chatroom that is fast and secure
posted to Share by Vandesm14

@Vandesm14 No, I mean you can xss everyone in the chat by including a unicode line separator (u+2028) in an html tag. I've tested this on myself (in another tab) and other people.

[JS]: List of indexes as path to recursive array/object
posted to Ask by Vandesm14
let curr = the_list;
for (ind of path) {
  curr = curr[ind];
}
console.log(curr);
calculator
posted to Ask by James193

@James193 Just so you're aware, you don't need the number = int() lines in Python.