• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2022
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

5 Steps for Getting Started with Python 3 | Beginners Guide

Aniruddha Chaudhari/38895/17
CodePythonSoftware Installation

Python is one of the most popular computer languages. And if you are a beginner,  we have listed Python among the 5 best programming language for beginners. I must say, this is the right time for you to get started with Python.

Whether you want to write a script for automation or manipulation data for analytics or building websites; Python is one of the best choices.

Looking at the power of Python language of doing so many things, Python is widely accepted in the software industry in a wide range of projects.

Let’s see the best way to learn Python…

Note: There are two major Python versions- Python 2 and Python 3. Going forward, you should focus on Python 3 rather than Python 2.

Table of Contents

  • Getting Started with Python
    • 1. Downloading and Installing Python
    • 2. Setting Environment Variable in Python
    • 3. Check the Python Installation
    • 4. Installing Editor for Writing Python Program
    • 5. Running Python Program
  • Sample Python Programs to Start With…

Getting Started with Python

I am glad for your choice of learning Python. Myself being Python developer, I am going to give you steps to kick start learning Python.

1. Downloading and Installing Python

There are two versions of Python: Python 2.x and Python 3.x. Python 3.x is released long back but many still use Python 2.x. Python 2.x is very much comfortable and stable.

The code running on Python 2 is not necessary to work on Python 3. So it is difficult to move from Python 2 to Python 3. This is the main reason as many companies (even Google) still uses Python 2 version.

For more detail, you can read the difference between Python 2 and Python 3.

As you are a beginner, I would suggest you install the latest Python 3 version.

Download the Python from its official website.

Once the download completes, install it.

2. Setting Environment Variable in Python

  • After installing Python, you can check the installed Python path (By default, c:/python38).
  • Copy this Path.
  • Click on Start then right click on My Computer.
  • Click on Properties. Click Advance System Setting.
  • Click on Environment Variables.
  • Under System Variables search for variable Path. And click on edit.
  • Open Variable value.
  • Append ‘; ‘ at the end of the Variable value, followed by Python Path.

Now, it’s time to verify Python installation and configuration.

3. Check the Python Installation

Window:

Press Windows+R and then type python. Or you can open a command prompt and the execute command python.

Linux:

Open a terminal and execute the command python.

If the Python is installed properly, it will open a Python console. And then just test your first python code.

print("Hello, World!") 
#Hello, World!

You can try some basic arithmetic calculations using python commands.

ani:~$ python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23)
Type "help", "copyright", "credits" or "license" for more information.
>>> 3 + 6
9
>>> 56  - 2
54
>>> 56 *  7
392
>>> 55 / 8
6
>>> 67 % 9
4
>>>
>>> exit()

exit() is a command to terminate the Python console.

This is the basic calculator you can use if you ever been into accounting bills. I prefer it to the calculator software that comes with the system. 😛

Now we are just running Python commands. Let’s see how to write and run the Python program.

To write a python program you need an editor.

4. Installing Editor for Writing Python Program

Windows User:

If you are using Windows OS, you might have notepad installed on your system. Initially, you can use that. Notepad only shows basic text and doesn’t highlight syntax. But it is ok, initially.

To highlight syntax you can install Notepad++. It makes your programming easy. It is also open-source.

If you want to start building the project, I would recommend using a Sublime editor.

Later you can move to the PyCharm. It is a dedicated IDE for Python that needs to be configured before using it. I have already written a complete tutorial for PyCharm setup.

Linux User:

vim is the best editor you should use. I use it personally and I don’t want to move to any other editor. It is the standard editor for all the programming development.

Without getting much confusion; For beginners, I would recommend using Notepad++ on Windows and Vim on Linux based systems.

All the setup is ready for getting started with Python. Let’s start savoring Python skills.

5. Running Python Program

Open the editor and write a hello world program.

print("Hello, World!")

You don’t need to write any functions. You don’t need to write any classes or import any classes. This is just one line program that prints the output on the console.

Isn’t it simple?

Save the file with .py extension (says helloPro.py).

And run the Python program from the command prompt (terminal for Linux user).

Command to compile and to run the Python Program:

python helloPro.py

It will print “Hello, World” on the command prompt/ Python console.

That’s all. You are ready with the Python.

Sample Python Programs to Start With…

Here are some simple programs you can try to run.

Printing value of the variable:

a = 10
print("value of a is ", a)
#value of a is 10

Find the sum of two numbers:

a = 10
b = 29
print("Sum = ", a+b)
#Sum = 39

Comment in Python:

You can use the comment in Python code. A comment is followed by the character ‘#’.

a = 10 #a is first intger variable
b = 29 #b is second integer variable
#Calculating sum of two integer
print("Sum = ", a+b)
#Sum = 39

Exploring Python further…

In the above programs, we have hardcoded the values of a and b. You can take these values as user input. Read the next Python tutorial for taking user input.

Here is a sample program for the Swapping value of two variables in Python.

For your learning, you can try running Python programs we have shared in our Python tutorial.

For being a beginner, getting started with Python is not easy like all other programming languages. And I am sure you might have many doubts. Please write in a comment. I answer your question right back.

Happy Pythoning!

Python
Aniruddha Chaudhari
I am complete Python Nut, love Linux and vim as an editor. I hold a Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack.org portal.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Comments

  • Reply
    Aniket Patil
    July 4, 2017 at 4:48 pm

    Good to see CSEStack.org growing.. Thanks for Python article. It motivated me to start with Python.

    • Reply
      Aniruddha Chaudhari
      July 4, 2017 at 5:01 pm

      Thanks, Aniket! I am glad to see here and to find it useful. Will keep posting more such Python tutorials. Stay tuned!

      • Reply
        shankar
        April 19, 2018 at 2:33 pm

        can anybody explain call by value and call by reference in python?

  • Reply
    sukhpreet
    January 24, 2018 at 11:54 am

    Hi anirudha.
    I am linux admin and am very confused like what to do for my future..
    What language or scripting i should learn ..

    Kindly help.

    • Reply
      Aniruddha Chaudhari
      January 25, 2018 at 7:43 pm

      Hi sukhpreet,

      Being Linux admin, you must be good at bash scripting.

      I would recommend you to learn Python. It will help you in many ways. You can use it as scripting as well as the full fledged programming language.

      Python is most suitable for all the today’s growing technologies in IT industry such as ML, AL, Data science… Many of the automation scripts are written in Python. Moreover, it is easy to learn Python (at least to learn basics and to begin with…)

  • Reply
    ASMITA
    March 6, 2019 at 8:50 pm

    I AM NOT ABLE TO RUN MY FILE SAVED IN NOTEPAD++AS HELLP.PY IN THE CONSOLE. PLEASE HELP

    • Reply
      Aniruddha Chaudhari
      March 6, 2019 at 8:52 pm

      Asmita, please check if you have opened the console in the same directory where you have saved your Python file.

      • Reply
        Anonymous
        April 17, 2019 at 4:26 pm

        I AM JUST A BEGINNER. SO WILL U PLEASE TELL IN MORE DETAIL WHAT EXACTLY SHUD I DO?

        • Reply
          Aniruddha Chaudhari
          April 17, 2019 at 6:27 pm

          1. If you are new to the Python programming, follow the complete Python tutorial here – https://www.csestack.org/python/
          2. Try solving as many programming questions as you can. List of coding questions for practice.
          3. Join our Python programming community to discuss more Python.

      • Reply
        ASMITA
        April 17, 2019 at 4:28 pm

        ACTUALLY, THE PROBLEM IS THAT I AM ABLE TO PERFORM OTHER SIMPLE COMMANDS IN CMD AND PYTHON.EXE BUT THE COMMAND PYTHON HELLOPRO.PY IS SHOWING INVALID SYNTAX IN BOTH

        • Reply
          Aniruddha Chaudhari
          April 17, 2019 at 6:28 pm

          Hi Asmita, can you share the code or exact error you are getting while running Python code?

  • Reply
    Ushie John
    January 25, 2020 at 7:25 pm

    This helps, Many thanks to you.

    • Reply
      Aniruddha Chaudhari
      January 26, 2020 at 10:26 am

      You’re welcome, Ushie!

  • Reply
    Prabin
    February 17, 2020 at 10:03 am

    Hello!! In the second step of installing python Setting Environment Variable, I can’t find the open variable value part.

    • Reply
      Aniruddha Chaudhari
      February 17, 2020 at 6:16 pm

      Hi Prabin, if you are using the latest Windows versions (Windows 10), after “Path > Edit” click on “New” and add the path. This will work.

  • Reply
    Seth
    March 26, 2020 at 6:52 am

    Hey, I noticed you didn’t use parentheses around the print method. I thought you have to do that for python 3.

    • Reply
      Aniruddha Chaudhari
      March 26, 2020 at 9:55 am

      Hi Seth! Thanks for notifying us. Earlier this code was written for Python 2. Now, we have rewritten this tutorial for Python 3.

Leave a Reply Cancel reply

Basic Python Tutorial

  1. Python- Tutorial Overview
  2. Python- Applications
  3. Python- Setup on Linux
  4. Python- Setup on Windows
  5. Python- Basic Syntax
  6. Python- Variable Declaration
  7. Python- Numeric Data Types
  8. Python- NoneType
  9. Python- if-else/elif
  10. Python- for/while else
  11. Python- User Input
  12. Python- Multiline User Input
  13. Python- String Formatting
  14. Python- Find Substring in String
  15. Python- Bitwise Operators
  16. Python- Range Function
  17. Python- List
  18. Python- List Vs Tuple
  19. Python- Compare Two Lists
  20. Python- Sorting List
  21. Python- Delete Element from List
  22. Python- Dictionary
  23. Python- ‘is’ vs ‘==’
  24. Python- Mutable vs Immutable
  25. Python- Generator & Yield
  26. Python- Fibonacci Generator
  27. Python- Assert Statement
  28. Python- Exception Handling 
  29. Python- RegEx
  30. Python- Lambda Function
  31. Python- Installing Modules
  32. Python- Important Modules
  33. Python- Find all Installed Modules
  34. PyCharm- IDE setup
  35. Python- File Handling
  36. Python- Monkey Patching
  37. Python- Decorators
  38. Python- Instance vs Static vs Class Method
  39. Python- Name Mangling
  40. Python- Working with GUI
  41. Python- Read Data from Web URL
  42. Python- Memory Management
  43. Python- Virtual Environment
  44. Python- Calling C Function

Python Exercise

  1. Python- Tricky Questions
  2. Python- Interview Questions (60+)
  3. Python- Project Ideas (45+)
  4. Python- MCQ Test Online
  5. Python- Coding Questions (50+)
  6. Python- Competitive Coding Questions (20+)

Python String

  1. Reverse the String
  2. Permutations of String
  3. Padding Zeros to String/Number

Python List

  1. Randomly Select Item from List
  2. Find Unique Elements from List
  3. Are all Elements in List Same?

Python Dictionary

  1. Set Default Value in Dictionary
  2. Remove all 0 from a dictionary

File Handling

  1. Python- Read CSV File into List
  2. Check if the File Exist in Python
  3. Find Longest Line from File

Compilation & Byte Code

  1. Multiple Py Versions on System
  2. Convert .py file .pyc file
  3. Disassemble Python Bytecode

Algorithms

  1. Sorting- Selection Sort
  2. Sorting- Quick Sort

Other Python Articles

  1. Clear Py Interpreter Console
  2. Can I build Mobile App in Python?
  3. Extract all the Emails from File
  4. Python Shell Scripting

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard