PYTHON TUTORIALS BEGINNERS

 LEARN2COD BY SATHVIK.M.S 

PLZ FOLLOW MY INSTAGRAM : @ig.sathvik.069

___________________________________________________________________________________

What is Python?

Python is an object-oriented programming language created by Guido Rossum in 1989. It is ideally designed for rapid prototyping of complex applications. It has interfaces to many OS system calls and libraries and is extensible to C or C++. Many large companies use the Python programming language include NASA, Google, YouTube, BitTorrent, etc.

Python programming is widely used in Artificial Intelligence, Natural Language Generation, Neural Networks and other advanced fields of Computer Science. Python had deep focus on code readability & this class will teach you python from basics.

Python tutorial


PyCharm is a cross-platform editor developed by JetBrains. Pycharm provides all the tools you need for productive Python development.
Below are the detailed steps for installing Python and PyCharm
Installing Python

Step 1) To download and install Python visit the official website of Python https://www.python.org/downloads/ and choose your version. We have chosen Python version 3.6.3

How to Install Python on Windows

Step 2) Once the download is complete, run the exe for install Python. Now click on Install Now.

How to Install Python on Windows

Step 3) You can see Python installing at this point.

How to Install Python on Windows

Step 4) When it finishes, you can see a screen that says the Setup was successful. Now click on "Close".

How to Install Python on Windows

Installing Pycharm

Step 1) To download PyCharm visit the website https://www.jetbrains.com/pycharm/download/ and Click the "DOWNLOAD" link under the Community Section.

How to Install Python on Windows with Pycharm IDE

Step 2) Once the download is complete, run the exe for install PyCharm. The setup wizard should have started. Click “Next”.

How to Install Python on Windows with Pycharm IDE

Step 3) On the next screen, Change the installation path if required. Click “Next”.

How to Install Python on Windows with Pycharm IDE

Step 4) On the next screen, you can create a desktop shortcut if you want and click on “Next”.

How to Install Python on Windows with Pycharm IDE

Step 5) Choose the start menu folder. Keep selected JetBrains and click on “Install”.

How to Install Python on Windows with Pycharm IDE

Step 6) Wait for the installation to finish.

How to Install Python on Windows with Pycharm IDE

Step 7) Once installation finished, you should receive a message screen that PyCharm is installed. If you want to go ahead and run it, click the “Run PyCharm Community Edition” box first and click “Finish”.

How to Install Python on Windows with Pycharm IDE

Step 8) After you click on "Finish," the Following screen will appear.

How to Install Python on Windows with Pycharm IDE


In the last tutorial, we completed our Python installation and setup. It's time to create your first program.

Creating First Program

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

Creating Your First Python Program

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.

Creating Your First Python Program

Step 3) Now Go up to the “File” menu and select “New”. Next, select “Python File”.

Creating Your First Python Program

Step 4) A new pop up will appear. Now type the name of the file you want (Here we give “HelloWorld”) and hit “OK”.

Creating Your First Python Program

Step 5) Now type a simple program - print (‘Hello World!’).

Creating Your First Python Program

Step 6) Now Go up to the “Run” menu and select “Run” to run your program.

Creating Your First Python Program

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

Creating Your First Python Program

Step 8) Don't worry if you don't have Pycharm Editor installed, you can still run the code from the command prompt. Enter the correct path of a file in command prompt to run the program.

Creating Your First Python Program

The output of the code would be

Creating Your First Python Program

Step 9) If you are still not able to run the program, we have Python Editor for you.


Please run the given code at Python Online Editor

print("Hello World")  

 


In this tutorial, you will learn-

How to print simple string?

More often then not you require to Print strings in your coding construct.

Here is how to do it in Python 3

Example: 1

To print the Welcome to SATHVIK99, use the print () function as follows:

print ("Welcome to SATHVIK99")

Output:

Welcome to SATHVIK99

In Python 2, same example will look like

print "Welcome to SATHVIK99"

Example 2:

If you want to print the name of five countries, you can write:

print("USA")
print("Canada")
print("Germany")
print("France")
print("Japan")

Output:

USA
Canada
Germany
France
Japan

How to print blank lines

Sometimes you need to print one blank line in your Python program. Following are an example to perform this task.

Example:

Let us print 8 blank lines. You can type:

print (8 * "\n")

or:

print ("\n\n\n\n\n\n\n\n\n")

Here is the code

print ("Welcome to SATHVIK99")
print (8 * "\n")
print ("Welcome to SATHVIK99")

Output

Welcome to SATHVIK99







Welcome to Guru99

Print end command

By default, python's print() function ends with a newline. This function comes with a parameter called 'end.' The default value of this parameter is '\n,' i.e., the new line character. You can end a print statement with any character or string using this parameter. This is available in only in Python 3+

Example 1:

print ("Welcome to", end = ' ') 
print ("SATHVIK99", end = '!')

Output:

Welcome to Guru99!

Example 2:

# ends the output with '@.'

print("Python" , end = '@')

Output:

Python@

Comments

Popular posts from this blog

Beginner's Guide to Discord !!!

HOW TO START CODING 💻 !!