How to set the variable to a string of "python"

In the below code, how do I set the variable to a string of “python”?

Repl link:

code snippet
```language = # Write your code here

Hi there! I don’t have any of your code to go off of for this, and you forgot the Repl link, but I’ll show you how to do this anyways
There are two ways to do this.

import os
myvar = "python"
  1. str()
import os
myvar = python

good luck!


You don’t have to import os, those functions are already built into python

1 Like

Lol, I thought so. I just do for good measure, and in case I ever need them.

1 Like

well this is more of a question like a quick exercise in learning variables and strings in Python so its just what is written I have no specific code project up yet. jUst learning the basics. I appreciate this guys

ok can you do that with the snippet i left the,

language = #Write your code here

Ah, no problem man. We here at Replit are (usually) very nice folk. By the way, welcome to the forums!

1 Like


The left hand side of the equals sign is the variable name. @doomsdaybear has the variable named myvar and you have the variable named language.

The right hand side of the equals sign is the assignment of a value (usually). @doomsdaybear sets the variable myvar to hold the value "python". Your code has something called a comment (these begin with a # symbol) which is ignored by the Python interpreter.

You need to replace the section # Write your code here with something which assigns the value "python" to the variable named language.

If you try it here we can tell you if you are correct or on the right lines. We all had to do this at one point. Good luck!


Are you talking about an environment variable?
that would be:

# Environment Variable
import os
os.environ['language'] = "python"
# Normal Variable
language = "python"

Also, you need the three closing backticks for multiline code blocks in Markdown.

1 Like

You missed a closing quotation mark on the normal var.

1 Like

@Mike-CarterCart has this solved your query? If so please mark as solution.

1 Like

oops, changing that now

1 Like

The OP has ghosted us :confused:

1 Like

This topic was automatically closed after 6 days. New replies are no longer allowed.