13 Oct First Python Program (Interactive Mode)
In the previous lesson, we learned how to install Python. In this lesson, we will learn how to begin with Python and how to run first Python program with the Interactive Mode method. It’s easy to run a Python program.
Python 3 Syntax
As a demo program, we will learn how to print a text in Python 3. For this, print function is used, which outputs to the console window.
Go to command prompt and type the following, and press enter,
1 2 3 |
>>> print ("Studyopedia Python 3 Tutorial") |
Here’s the output,
Python 2 Syntax
In Python 2, you need to type the following.
The parentheses are not necessary,
1 2 3 |
>>> print "Studyopedia Python 3 Tutorial" |
In this lesson we learned how to run our first Python program. We also saw the syntax for Python 3 as well as Python 2 programs. In the next lesson, we will see how to work with scriptmode method to run Python 3 programs.
No Comments