Writing Your First Program

2 minutes
Share the link to this page
Copied
  Completed

Python’s interactive mode is useful as a simple calculator, but you can create programs for more extensive functionality.

A Python program is simply a plain text file script created with an editor, such as Windows’ Notepad, that has been saved with a “.py” file extension.

Python programs can be executed by stating the script file name after the python command at a terminal prompt. The traditional first program to create when learning any programming language simply prints out a specified greeting message.

In Python, the print() function is used to specify the message within its parentheses. This must be a string of characters enclosed between quote marks. These may be “ ” double quote marks or ‘ ’ single quote marks – but not a mixture of both.

  Download

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.