Friday, March 30, 2018

PYTHON COURSE 1a - BASIC INTRODUCTION TO PYTHON DEVELOPMENT

INSTALLING AND WORKING WITH PYTHON
1. DOWNLOAD VS CODE EDITOR

WHILE INSTALLING, BE SURE TO CLICK
  1. ADD TO PATH IF POSSIBLE
  2. ADD TO CONTEXT MENU FOR
    1. FOLDER
    2. FILE
VERSION 2.7.XX
select Add to Path option while installing.

2. NEXT,
  1. Open the command prompt by typing cmd in the Start application
  2. Then type python in Console Window to check if python is installed.
  3. If yes, the console should go into the python shell. LIKE SO

3. NEXT,
  1. Exit the shell by keying in “exit()” into python shell
  2. When in cmd console
    1. You should see the cmd root like
    2. “samar” is replaced by your username – THIS is your HOME folder.
    3. Common CMD line commands are
                                                       i.      Make Directory
        1. mkdir <space> <DIRECTORY_NAME>
                                                     ii.      Change Directory
        1. cd                        Current Directory
        2. cd <space> <DIRECTORY_NAME>  Goto DIRECTORY_NAME
        3. cd <space> <DOT DOT> (cd ..) Go One folder up or Back.
        4. Examples:
          1. cd ..
          2. cd Desktop
          3. cd Desktop/Some_Folder
          4. cd Desk*
                                                                                                                      i.      Autocompletes characters with * - 0 or more chars.
                                                                                                                    ii.      Autocompletes characters with + - 1 or more chars.
                                                   iii.      List Directories and files
        1. dir in Windows.
        2. ls in Linux.
                                                    iv.      Whatever you type here in cmd is a program
        1. If the program exists, it is opened
          1. If its console program, only console is shown.
          2. If its GUI – window based program, both console and window is shown
        2. If the program doesn’t exist, then the error command not found is shown.
4. NEXT,
  1. Download the program.
    DOWNLOAD HERE - test.py
  2. Open CMD C:\users\your_username> <ENTER CMD>
    1. Navigate to Desktop cd Desktop
  3. Create a folder using mkdir NEW_FOLDER_NAME (ex: mkdir test)
  4. Copy the test.py into the directory. Enable Show File extensions for known formats from View Options at the top
  5. AFTER making sure that the current directory is open by using cd
    1. cd should show you C:\Users\YouRs\Desktop\test
    2. else use cd test to enter the newly created folder housing the test.py file.
    3. To edit the file, use vs-code. Try Right-Click in folder and select Open with Code.
  6. Once the cmd is in test folder, we can try running the program.
  7. Just type python test.py to run the code. You should get this output
To learn more try


  1. Tutorials Point - python course

No comments:

Post a Comment