Python Tutorial for Beginners - How to run Python in Terminal

preview_player
Показать описание

^Downloadable code & more!

Terminal Commands:
ls - list all files inside current folder
pwd - Current file path
cd folder - Change directory to folder
python .py file - Run python program

Now I’m going to show you how to run your python program.
On mac or linux, you can do this in your terminal. Just type the word terminal in the spotlight search and click enter. And if you are wondering why mine is green, that’s because you can customize your terminal to be how you want, and I chose green. On windows, you can do this by opening the anaconda navigator and clicking on jupyterlab then open the terminal there.

We need to learn 3 terminal commands. The terminal is like using your computer with plain text. In it we can write certain commands to navigate through folders. For example, if you have a document you want to open, you go to the place it’s located and click on it. Suppose that document is saved in a folder inside of your documents folder. Then you use your mouse to click documents, then the folder, then you click the file. Long story short, the 3 terminal commands I am going to show you will allow you to click through folders so we can open up a python file. Still not getting it? I think you will once we work through this example.

Do your best to remember those terminal commands. I have written all the terminal commands in the description, so if you can’t remember at any time, just look there for reference.

First is pwd. When you type pwd it will show you the file path and directory you are currently in.

Next is ls. this lists all of the files and folders inside of your current directory.

And our third and final terminal command we need is cd. Which stands for change directory. Not compact disk You type cd then the folder you want to enter into. (and side tip, if you ever want to cd backwards, or back out of a folder, type cd ..)

Okay, your mission is to use these commands to navigate to wherever you saved the python file. I saved mine in a folder called examples inside of documents. So I’ll type cd documents/examples.

Now that we are in the correct spot, we can execute or run this python code. I will clear the screen using cmd + k

And now we type the word python and then the name of our python file. And hit the enter key.

Our computer just read what we wrote in python, and obeyed what we had written. We wrote print hello world and now we see the words displayed right here. Isn’t that amazing! You are coding python!

Video Clips Use (Fair Use intended)

Bruce Banner Meets Tony Stark | The Avengers (2012) Movie Clip

Your mission, should you choose to accept it…

Taipei 101/Chiang Kai-shek Memorial 台北101/中正纪念堂 - Life in Taiwan #9

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Marathon playlist by Rylan Fowers.





#PythonMarathon #LearnPython #PythonTutorial Learn Python:

Video Equipment:

Other:
Рекомендации по теме
Комментарии
Автор

Exactly what I was looking for. Thanks

kobenichiiiyk
Автор

Thanks buddy😄❤️
Now I will flex this infront of my friends

betemojkardi
Автор

Thank you for the video but it is not quite what I was looking for a way to execute short codes directly in the terminal like:

print("Hello World")

teslakontrol
Автор

Its saying command not found: python.What do i do?

uzb_boss-brawlstars
Автор

If my file name has two words I need to use underscore instead of a space?

HPAN