INSTALLING AND WORKING WITH PYTHON
1. DOWNLOAD VS CODE EDITOR
WHILE INSTALLING, BE SURE TO CLICK
- ADD TO PATH IF POSSIBLE
- ADD TO CONTEXT MENU FOR
- FOLDER
- FILE
INSTALL PYTHON here
VERSION 2.7.XX
select Add to Path option while installing.
2. NEXT,
- Open the command prompt by typing cmd in the Start application
- Then type python in Console Window to check if python is installed.
- If yes, the console should go into the python shell. LIKE SO
3. NEXT,
- Exit the shell by keying in “exit()” into python shell
- When in cmd console
i. Make Directory
- mkdir <space> <DIRECTORY_NAME>
ii. Change Directory
- cd Current Directory
- cd <space> <DIRECTORY_NAME> Goto DIRECTORY_NAME
- cd <space> <DOT DOT> (cd ..) Go One folder up or Back.
- Examples:
- cd ..
- cd Desktop
- cd Desktop/Some_Folder
- cd Desk*
i. Autocompletes characters with * - 0 or more chars.
ii. Autocompletes characters with + - 1 or more chars.
iii. List Directories and files
- dir in Windows.
- ls in Linux.
iv. Whatever you type here in cmd is a program
- If the program exists, it is opened
- If its console program, only console is shown.
- If its GUI – window based program, both console and window is shown
- If the program doesn’t exist, then the error command not found is shown.
4. NEXT,
- Download the program.
DOWNLOAD HERE - test.py - Open CMD C:\users\your_username> <ENTER CMD>
- Navigate to Desktop cd Desktop
- Create a folder using mkdir NEW_FOLDER_NAME (ex: mkdir test)
- Copy the test.py into the directory. Enable Show File extensions for known formats from View Options at the top
- AFTER making sure that the current directory is open by using cd
- cd should show you C:\Users\YouRs\Desktop\test
- else use cd test to enter the newly created folder housing the test.py file.
- To edit the file, use vs-code. Try Right-Click in folder and select Open with Code.
- Once the cmd is in test folder, we can try running the program.
- Just type python test.py to run the code. You should get this output
To learn more try
No comments:
Post a Comment