Project GameOfChance without Codeacademy IDE

Hello there, i’m quite lost at the very start of this project : https://www.codecademy.com/practice/projects/games-of-chance

The project itself will probably not pose any sort of issue, but i’m having troubles in trying to do this outside of codeacademy environement.
The project let us choose to do it here or on our computer, and link a tutorial to install python & miniconda + jupyter.
I think i’ve done it right (while i need to run miniconda3 command prompt instead of basic cmd for it to recognize the “conda list” that the tutorial talk about, don’t know if that was supposed to be that way or not tbh)

Until the point where i have my localhost jupyter page, my game_starting file and no clue what to do with thoses.
Also, when i try to print some random numbers (like print random.randint(0, 5)) while having the “import random” statement at the beginning of my .py file, it throw me an error on the command prompt (invalid syntax).

All in all, what should i do with jupyter? Also, when i try to doubleclick on the file games.py, i doesn’t do anything is that normal? I need to right click and open it with something else (here notepad) to work in it.
Lot of questions, sorry, and thanks in advance !

Edit : Apprently random.randint(0,5) is the one in fault, i’ve tried :

myList = [2, 109, False, 10, “Lorem”, 482, “Ipsum”]
bub = random.choice(myList)
print(bub)

and it work fine. (came from https://www.pythonforbeginners.com/random/how-to-use-the-random-module-in-python)

I don’t think that miniconda is your IDE of choice if you are a beginner. Jupyter is great, but (IMHO) not the best platform on which to take your first steps.

I have experience with, and strongly recommend, Thonny, which is easy to install, easy to use, and enough of a step up from the Codecademy interface that you’ll find it worthwhile. No, it is definitely not a “toy”; you will need to be coding a very large project indeed (well beyond Codecademy level) for it to prove insufficient.

After you’ve used it for awhile, it would then be appropriate to go on to Anaconda (especially if you will be getting into Jupyter-centric data applications) or PyCharm.

3 Likes

When we have a data structure to choose an element from, randrange is a more suitable method since it matches the indices of the list. Better still is the random.choice method. It focuses on values, not indices and can see the entire data structure.

3 Likes

Probably shouldn’t be using tools more complicated than your own project, especially when it’s unclear whether they’re helpful in any way.

Text editor.
Python.

Write code to file. Run it.

https://asciinema.org/a/6ZblLDqiNJu6EK3UkTh4fyEUB

2 Likes

@mtf
Thanks, i’ve added randrange to my toolkit !
random.choice is convinient for mixed data list and randrange for numbers :slight_smile:

@ionatan

Well since the project itself offered me to try this outside codeacademy environment, I tried my best to do so, since at some point i’m gonna have to code outside ou here anyway.
At the end, I managed to figure some of it out, enough anyway to make it work, i’ll probably learn more with time, thanks for the advice :slight_smile:

@patrickd314

Thanks ! I’ll try that for the next project !

1 Like

Don’t get me wrong I love fancy tools.
But any tool that places itself between me and the thing I’m really interacting with (python in this case) is evil. And when learning something (python) you’ll probably want to interact as closely as possible with that, and with no other interference. Projects involving multiple people also can’t tie themselves to specific editors, people use different ones. The editor isn’t the environment! The OS is.