I saw a repl from someone else who made a python Interpreter. That project is bad, so I made a better one :)
Although this is better than the other one, both are low effort. So you shouldn't call the other one bad (even though it is lol)
Awesome.
You could make it slightly shorter by getting rid of that x
variable. Make the while
loop into a while True:
and replace x = 0
with either break
or quit()
. In fact, you could get rid of that "exit" check altogether, as simply typing Python's built-in quit()
function would have the same effect.
remove:
if prompt == "exit":
x = 0
You dont need that, as when they type in exit()
, it will automatically terminate the entire program. You also dont need if while x == 1:
, as it will also be terminated when exit()
is typed in. Because you no longer need x, you can remove x = 1 as a variable
lol yet the "worse" one has more votes than this one...
nonetheless,
while True:
votes += 1
competitorVotes -= 1 # if possible
loop += 1
# IDK how to do synchronous python so this won't be run :P
Loop(
Print(
Eval(
Read(
input()
)
)
)
)
Yay!
Read
Eval
Loop!
Yayyy
How about my script? https://repl-python.ganeshatpc.repl.run/ It's called repl python. The project is at https://repl.it/@ganeshaTPC/Repl-python.
@ganeshaTPC You just start python3 from shell haha
you dont need the exit thing. The user can just type in exit() into the interpriter, and it will work. You could also use a while True loop, and use the break statement in order to exit. You could also do this:
try:
eval(input())
except Exception as e:
print(e)
That will print the exception onto the screen, and is better than: Syntax Error
, as sometimes it wont be Syntax Error
all the time
@TaylorLiang I will change it, thanks for your feedback
It would be cool if you did it in something besids python...
@MrMinimax Like what? :)
I made a node.js one: https://repl.it/talk/share/Nodejs-REPL/28587 @MrMinimax
how about node.js? @SvenDeveloper
lol seems like you have some competition! @Andi_Chin
@Andi_Chin it really isn't
well, he was the creator of the original one so cut him some slack for being salty @IreoluwaRaufu
@Coder100 I guess, yeah
@IreoluwaRaufu It should be
this is very beter than the other one!
@Cashewnoot Yes it really is
This one still has a lot of problems. It says none after everything I type, and I can't assign variables. Also, why would you use x == 1 when you can just use while True?