Greetings everyone, I am a student at Saint Leo University and this is my first time dealing with python, I have taken C++ and Java so far, I struggle with coding since I lack the key ingredient to success in this field with is practice. If anyone has any advice, hoping there’s a app out there that helps with basic python coding to further my knowledge.
Hi Daniel, and welcome!
You have identified the most important issue preventing you from
learning to program: “Practice”. Identifying the problem is the first
step to overcoming the problem.
Fortunately there is this one weird trick which will let you become an
expert that other programmers don’t want you to know. But I’m willing to
spill the beans! Are you ready? Listen carefully.
Seriously Daniel, there’s no shortcuts here. Intelligence and desire
will only take you so far, at the end of the day you’ve got to put in
the miles or you won’t get very far. Sad but true.
Here is one genuine trick that will help. Its not a secret, its not
“weird”, and it won’t make you an expert overnight, but it will help.
Python has an interactive interpreter, also called “REPL” (Read,
Evaluate, Print, Loop). Whenever you’re working on programming, make
sure that you have a separate window open with the Python interpreter
running. You should see a prompt like this:
Do you need help getting the interpreter started? Please ask!
Whenever you have a question about what something will do, try it at the
REPL. “What does
len(None) do?” you might ask. Try it by entering
len(None) at the prompt:
>>> len(None) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: object of type 'NoneType' has no len()
And now you know. I’ve been programming with Python for about 25 years
and I do this all the time. (Although its usually a little more
complicated examples than that one.)
Experiment, experiment, experiment. Write little functions. Try them and
see what they will do.
Just remember that you can’t save your work in the interactive
interpreter. Anything you write will disappear when you close the
window. Don’t use it for anything important that you want to keep. But
for little experiments, it’s great.
Another brilliant feature is Python’s built-in help function. Try it
now: open a terminal window, start the Python interpreter, and enter:
at the prompt. Or even just
If things get too hairy, with too much junk on the screen, you can close
the window and open a new one to start fresh.
Use the interpreter as a calculator! How many seconds in a year?
# seconds in a minute by minutes in an hour # by hours in a day by days in a year >>> 60*60*24*365 31536000
All this counts as practice! The more stuff you do with Python, the
easier you will find it becomes. You will get more comfortable with
reading error messages, and reading documentation, less worried about
making a mistake, better able to predict what a line of code will do.
This is all part of the process of becoming a programmer. Good luck and