Python and Bash

So you know a language now, right? Congratulations! The thing to remember is that all skills, if not used, will slowly atrophy. My recommendation is to constantly challenge yourself to maintain your skill level so when you have to write a program, you can whip something up immediately without having to relearn the syntax... or you can just ignore it completely and when the need arises, spend a half hour fumbling until you remember enough to get it working. Both of those are completely valid ways to maintain proficiency in a language. This course won't teach you any more languages, but if you continue in this pipeline you will learn C and some low level assembly.

For now, let's go back to running Python from the terminal.

Python from the Terminal

You did this before Codecademy, but let's go back to using the terminal real quick.

Do a few challenges from https://pythonbasics.org/exercises/ to get into the swing of things!

You can type these directly into the python interpreter, or make a .py file and run them with python. I recommend doing both to get the hang of things.

  1. Split
  2. Random
  3. Input
  4. Ranges
  5. Time

Take note of modules and how importing them works. When do you have to import modules, and what are the different ways you can use them?

Bash in Python

Learn how to a run bash command from within a python script here:

https://stackoverflow.com/questions/26236126/how-to-run-bash-command-inside-python-script

Assignments

  1. What is a python module? How do you use them?
  2. Submit the code for a python script that uses bash commands to print out the content of all files in the directory it is run from. Comment this program well.

Programming and scripting are different but share most of the same principles, and these principles will be shared between all languages. Once you can program well in one language, you can learn any language, it just will take a bit to learn.