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.
How to Install Python on Windows [Pycharm IDE]
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 PythonStep 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
Step 2) Once the download is complete, run the exe for install Python. Now click on Install Now.
Step 3) You can see Python installing at this point.
Step 4) When it finishes, you can see a screen that says the Setup was successful. Now click on "Close".
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.
Step 2) Once the download is complete, run the exe for install PyCharm. The setup wizard should have started. Click “Next”.
Step 3) On the next screen, Change the installation path if required. Click “Next”.
Step 4) On the next screen, you can create a desktop shortcut if you want and click on “Next”.
Step 5) Choose the start menu folder. Keep selected JetBrains and click on “Install”.
Step 6) Wait for the installation to finish.
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”.
Step 8) After you click on "Finish," the Following screen will appear.
Hello World: Create your First Python Program
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”.
Step 2) You will need to select a location.
- 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”.
- PyCharm should have found the Python interpreter you installed earlier.
- Next Click the “Create” Button.
Step 3) Now Go up to the “File” menu and select “New”. Next, select “Python File”.
Step 4) A new pop up will appear. Now type the name of the file you want (Here we give “HelloWorld”) and hit “OK”.
Step 5) Now type a simple program - print (‘Hello World!’).
Step 6) Now Go up to the “Run” menu and select “Run” to run your program.
Step 7) You can see the output of your program at the bottom of the screen.
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.
The output of the code would be
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")
How to Print in Python with Examples
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
Post a Comment