Elias Bomberger

@pyelias (857)
Iterables: A Crazy, Crazy World
posted to Learn by a5rocks

nice, these are definitely an interesting feature
<pedantry>technically you're describing generators here, which are just one type of iterable</pedantry>

Weird syntax error
posted to Ask by 20rduncan

else shouldn't be followed by a condition (like (age < 21)). Just use else { ... }

Language “sight range”?
posted to Ask by Highwayman

Can you know something's address?

In Python, you will almost never have to deal with memory addresses, but if you need to you can use the ctypes module to get an address (it can also do a few other things that C++ can).

Can you know their type?

Variables are dynamically typed, but you can get the type of an object with the type(obj) function.
For example, type(1) == int.

Can you know their size?

Again, you won't need to, but if you want to know, sys.getsizeof(obj) will find the size of an object (not counting things like elements of an array, see here)

And finally how does type casting work in Python.

Python doesn't have type casting in the same way C++ does. int(obj) just passes obj to int's constructor, which is able to convert types (it can also do user-defined conversions if obj has a __int__ method)

Proof that .99 repeating = 1?
posted to Ask by timmy_i_chen
= 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
PyNet! Back from the dead!!
posted to Share by TimothyAnderso1

A few bugs:

  • there can only be one net app at a time
  • encryption needs more spaghet (or actual cryptography probably)
  • the nn key is never used
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

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).

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
Python Advanced Concepts Explanation (for beginners)
posted to Learn by pyelias

@CoolqB Yeah, I might add some of that stuff in here when I have time.

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 updated 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.

Python Advanced Concepts Explanation (for beginners)
posted to Learn by pyelias

@CoolqB I just finished a rudimentary explanation of bytecode, and I'll be adding more to it when I can.

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.

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.