Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
19

Better Python3 Interpreter

SvenDeveloper
SvenDeveloper

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

3 years ago

Voters

Comments

TopNew
6
4
Coder100
Coder100

lol seems like you have some competition! @Andi_Chin

3 years ago
1

@Andi_Chin it really isn't

3 years ago
1
Coder100
Coder100

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

@IreoluwaRaufu

3 years ago
1

@Coder100
I guess, yeah

3 years ago
3
Cashewnoot
Cashewnoot

this is very beter than the other one!

3 years ago
2
Foster_Bryant
Foster_Bryant

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)

3 years ago
2
eighty
eighty

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.

3 years ago
2

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

3 years ago
1
SvenDeveloper
SvenDeveloper

@TaylorLiang
I will change it, thanks for your feedback

3 years ago
1
jawwson
jawwson

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?

3 years ago
1

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

3 years ago
Load more