Pages

Create your First Python Program on MAC OS

In the last tutorial, we completed our Python installation and setup. It's time to create your first program.
Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the "print" directive - it simply prints out a line (and also includes a newline, unlike in C).
follow this link to install python ops your machine.Python Installation

Python 3, print is a function, and must be invoked with parentheses.
Where in other programming languages the indentation in code is for readability only, in Python the indentation is very important.

Python uses indentation to indicate a block of code.Python will give you an error if you skip the indentation.Python uses indentation for blocks, instead of curly braces. Both tabs and spaces are supported, but the standard indentation requires standard Python code to use four spaces.

Use the "print" command to print the line "Hello, World!”. 
Creating First Program and follow the below steps

Step 1) Open PyCharm Editor. You can see the introductory screen for PyCharm. To create a new project, click on “Create New Project”.



Step 2) You will need to select a location.
  1. You can select the location where you want the project to be created. If you don’t want to change location than keep it as it is but at least change the name from “untitled” to something more meaningful, like “FirstProject”.
  2. PyCharm should have found the Python interpreter you installed earlier.
  3. Next Click the “Create” Button. 

Step 3) Now Go up to the Newly Created Project Folder and “PNPDEmo” menu and select “New”. Next, select “Python File”.  

Step 4) Now type a simple program - print (‘Hello Gowtham!’).
Step 5) Now Go up to the “Run” menu and select “Run” to run your program.

Step 6) You can see the output of your program at the bottom of the screen.





Gowtham

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.

No comments:

Post a Comment