Is there a python shell on CodeAcademy?

When trying to figure out how something works, there are examples like this:

bool_three
True

bool_four
False

bool_five
True

Where can I do this on CA? Or do I need to download a Python compiler?

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Hello! What exactly do you mean? Do you mean when you assign a variable True or False? You can do that on CC:

some_var = True

Sorry, I kind of don’t know how to ask the question.

I guess what I am asking, is there a shell for me to run python in, within the course? I downloaded IDLE because a previous lesson told me to use the compiler?

Some lessons do have an interactive terminal, into which you could type Python commands; however, I think the majority of them do not.

Rather than relying on typing certain things in to the terminal to see what’s what, you could add calls to print() at appropriate points to monitor the state of your program instead.

Here’s a trivial example using print() to see state during a nested for loop:

alice_hobbies = ["running", "video games", "woodworking"]

bob_hobbies = ["cycling", "video games", "skiing"]

for alice_hobby in alice_hobbies:
    for bob_hobby in bob_hobbies:
        print("Alice's hobby: %s" % alice_hobby)
        print("Bob's hobby: %s" % bob_hobby)

        if alice_hobby == bob_hobby:
            print("\nShared hobby: %s\n" % alice_hobby)

The result:

Alice's hobby: running
Bob's hobby: cycling
Alice's hobby: running
Bob's hobby: video games
Alice's hobby: running
Bob's hobby: skiing
Alice's hobby: video games
Bob's hobby: cycling
Alice's hobby: video games
Bob's hobby: video games

Shared hobby: video games

Alice's hobby: video games
Bob's hobby: skiing
Alice's hobby: woodworking
Bob's hobby: cycling
Alice's hobby: woodworking
Bob's hobby: video games
Alice's hobby: woodworking
Bob's hobby: skiing

As Python executes our program, the terminal allows us to see what the state of the variables are as the program runs.

You could do similar:

print("Value of bool_three: ", bool_three)

Just an example.


Also, if you don’t understand the syntax I used in my example with the %s stuff, it’s here in the Python docs.

1 Like

Don’t mean to bother but this was the closest answer to a question i have. i try to enter some of the code we enter in CodeAcademy to the python shell but does not come out as it does in CA, is there a difference between the two? or am i doing something wrong

Welcome to the forums.

An example would be helpful in this case, to illustrate what you’re running which is seemingly behaving differently in two places. :slight_smile: