Share your repls and programming experiences

← Back to all posts
Better Python3 Interpreter
SvenDeveloper (20)

I saw a repl from someone else who made a python Interpreter. That project is bad, so I made a better one :)

Commentshotnewtop
Coder100 (1200)

lol seems like you have some competition! @Andi_Chin

Coder100 (1200)

well, he was the creator of the original one so cut him some slack for being salty @IreoluwaRaufu

Cashewnoot (2)

this is very beter than the other one!

Foster_Bryant (91)

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)

eighty (2)

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.

TaylorLiang (773)

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

SvenDeveloper (20)

@TaylorLiang I will change it, thanks for your feedback

jawwson (8)

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?

TaylorLiang (773)

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

Coder100 (1200)

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()
      )
    )
  )
)
[deleted]

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.

SvenDeveloper (20)

@ganeshaTPC You just start python3 from shell haha