Rohan P

@Roar123 (447) User Search
posted to Share

Very cool! What are some other uses for repltalk?

Snake in BASIC
posted to Share by AmazingMech2418

This is really smooth! Because the text is kind of buggy, why don't you have a click anywhere to start instead.

How to create multiple html pages (website)?
posted to Ask by agarner

Please don't post your questions twice and look at my response to the first one

Share a whole folder
posted to Ask by PaulLeger

Can you give your students the links to all of your code examples because you can share the link of a repl, not a folder.

Rock! Paper! Scissors!
posted to Share by Lost0Soul

The graphics are really good! Here's an idea: assign consecutive numbers to each option, example rock : 1,paper : 2, scissors : 3. To avoid using an if statement for each possibility, you can compare the numerical difference between your guess and the computer guess. If it is either 1 or -2, then you win (with this list). 0 is tie and the computer wins the rest. Try it out!

How do i install tensorflow?
posted to Ask by Huntler

I looked around and I don't think Python Tensorflow is supported. Check out these posts: & I also tried importing it and installing it through the package manager, but the Package operation failed. I recommend you ask the team through AMA about support for Tensorflow.

How to disable variable from running if a condition is meant?
posted to Ask by ChiPham1

Simple fix - just move the if statement on line 51 inside the elif. Also, it's good practice to have use else to cover the remaining possibilities rather than just if and elif.

When using functions in Python, what do [insert integer here] mean?
posted to Ask by TorranceNunn

First of all, I'm assuming function1 is a list, so this should probably be renamed. Or function1() returns a list, in that case use function1() instead of just the name. For your question, the numbers inside the bracket are indexes and list[index] gives you the value at that index in the list. A negative index starts from the end of the list rather than the beginning, so -1 is the last index and -2 is the 2nd to last index.

What is a variable?
posted to Ask by SixBeeps

variable = variable

Covid Site | Code JAM #9
posted to Share by blackcarter

Beautiful web design!

Python code that runs Python
posted to Share by aguy11

Very nice! What would be cool and not that hard to implement is syntax highlighting. You can keep of list of python keywords and builtin functions like print, for, if, etc and replace any instance with the word + color. For strings, you could replace anything inside of quotations. When someone enters the input, you can clear the last line with an ansi escape code and print the highlighted version. Note that this isn't live syntax highlighting because you would have to use a character based input like readchar.readkey() instead of line based input(). Tell me if this sounds interesting!

US Capitals Quiz
posted to Share by BlueComet

Great job - the code quality is very good for someone who just learned python! I like the use of a dictionary to store the states and capitals.

Announcing "Repl Customs"!!!
posted to Share by frissyn

This is so slick - I'm looking forward to seeing the finished product!

Login with
posted to Ask by mamamia5x

Use Repl Auth - check out this great tutorial

Snake in BASIC
posted to Share by AmazingMech2418

@AmazingMech2418 Ok I get it, but you should probably allow people the option to press enter or another key to start

I need to know something
posted to Ask by Jooselitz

@Jooselitz It basically moves the cursor back to the beginning of the line. To use it, put \r inside of quotes.


In this example, "Hi" will be printed but then the cursor will be moved back to the beginning so you will only see "Carriage" being printed. Note that the carriage return doesn't clear the line, but overwrites it so . . .


will output "Hirriage" because "Hi" overwrote the "Ca" in "Carriage".
To solve this problem, you can add padding (white spaces) to the end of your string with ljust().

# ljust adds a specified amount of white space to the end

This will output "Hi".
Using \r and padding when you need it, you can effectively clear one line.

A question
posted to Ask by kbadrinath_tcsp

I'm not exactly sure what your program does but if nothing is printing, then that means the while loop is not terminating. This is because you are not picking a new random integer to be assigned to format1. Think about it - you are only check against one random integer which does not get randomized again, leaving the while loop with no way to move forward or terminate. Just move the variable format1 into the while loop and it should work:

while count <= 5:
  randy = random.randrange(0,70)
  format1 = str(randy) + " "
  if format1 not in list2 and format1 not in list1:
    count += 1

Also to avoid None at the end of your slowprint function, add return '' to the end.

Cube Master
posted to Share by bossbrackets

Great work - I love the slick motion and the music!

i dont know what's wrong with my code
posted to Ask by ETHANLEE100

You need to source your css and js files so you can use them. Add <link href="style.css" rel="stylesheet" type="text/css" between the <head> tags and <script src="script.js"></script> between the <body> tags in your html file.

How can I align these asterisks?
posted to Ask by JordanCrespo

You need padding. Padding adds whitespace to the end of a string so it is a specified length. The notation is either ljust(number) or rjust(number). The number specifies the length of the overall string and the l or r determines whether the string inside of the padding is left or right aligned. If you add this code under the month list, month_padding = [m.ljust(30) for m in months] and you use month_padding instead of month, then the asterisks should align because the months are all the same length.

what did i do wrong here?
posted to Ask

If the program cannot get your secret variable from the .env file, then os.getenv("____") will be set to None. Make sure your .env file is named .env, not secret.env etc. A bug I noticed with is that your .env file does not work if you name it something else and rename it .env. I'd recommend deleting your current .env file, creating a new one and copying over the old info. Tell me if that works!

How to check if a word is an English word with Python?
posted to Ask by YuChuehWang

Good question! It turns out that there is a spellchecking library for Python called pyspellchecker. More info here!
Note: You have to install pyspellchecker with's package manager for the spellchecker library to work.

# Code Example
from spellchecker import SpellChecker

spell = SpellChecker()

def check(word):

    if word == spell.correction(word):
        return True
        return False

This function should answer your question. Thanks for asking it as I learned some cool things in the process!

[Python] whats the best thing to use for colored text in console
posted to Ask by xolyon

I would recommend using ANSI Escape Codes as they require no imports.
First, assign the escape codes to variables (you can find the full list of colors and attributes online).
Red = "\033[1;31m"
Reset = "\033[0m"
I like to use this technique with f-string formatting because it is really nice and efficient!
Ex. print(f"I am {Red}RED{Reset}")
When the console is evaluating your code, it will turn everything after the red escape red and reset the color back to white once it reads the reset escape code. So don't forget to reset or the rest of the text will be colored (unless that's what you want :).

can you do exponents in python?
posted to Ask

Use **.
Ex. 5 ** 3 = 125

(NOT REMOVING POST :P) Biggest Multiplayer Game! - Surviv3 TEASER
posted to Share by ChezCoder

Wow! I've said it before but it's true - the progress is amazing!
P.S. 10/10 for punching animation

How to work dis
posted to Ask by advaydhiraj

What is your technique for calculating primes? I wrote a quick program in Python3 to calculate this - you can use a similar technique.

# Python3
def prime_check(n):
    # Creates list with factors and measures length
    factor_len = len([i for i in range(1,n+1) if n % i == 0])
    # Number with 2 factors is prime
    if factor_len == 2:
        return "Prime"

prime_list = []
number = 2

while len(prime_list) < 25:
    prime = prime_check(number)
    if prime == "Prime":
        # Adding number to list if prime
    number += 1

EcoCode: Competitive Code Golfing Online
posted to Share by MrEconomical

Very cool! I'm impressed with the degree of functionality EcoCode has with login, leaderboard, and an IDE. There's only one thing that's missing - Python support!

posted to Share by Coder100

This is really progressing. Great job!

posted to Share by Roar123

@Powerpasta Try running the program

Python Login System With Encryption
posted to Share by devcar80

Very nice! How does the program store user information for use after it has ended?