Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
107 views

Learn Python - For Beginners

This document provides an introduction to learning Python for beginners. It discusses how Python is a beginner-friendly language with a simple syntax. It outlines how to install Python 3 and a text editor. It then demonstrates how to create a "Hello World" Python program and use print statements to draw shapes on the screen, such as a triangle.

Uploaded by

remoondhaka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views

Learn Python - For Beginners

This document provides an introduction to learning Python for beginners. It discusses how Python is a beginner-friendly language with a simple syntax. It outlines how to install Python 3 and a text editor. It then demonstrates how to create a "Hello World" Python program and use print statements to draw shapes on the screen, such as a triangle.

Uploaded by

remoondhaka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Learn Python - For Beginners

Version 1.1

1|Page
Contents
Learn Python - For Beginners .............................................................................................. 1
Learn Python - For Beginners .............................................................................................. 2
Introduction to Python Programming ........................................................................... 3
Python: The Beginner-Friendly Language .................................................................... 3
What You'll Learn .............................................................................................................. 3
Why Learn Python? ............................................................................................................... 3
How to Install Python .......................................................................................................... 3
Python 3: The Future of Python ....................................................................................... 4
Download Python 3 .......................................................................................................... 4
Setting Up Python and a Text Editor .............................................................................. 4
Installing Python 3 ............................................................................................................ 4
Choosing a Text Editor .................................................................................................... 5
Creating Our First Python Program ................................................................................ 5
Using Python to Draw Shapes on the Screen .............................................................. 6
Printing on the Screen ..................................................................................................... 6
Drawing a Triangle Shape............................................................................................... 6
Running the Code .............................................................................................................. 7

2|Page
Learn Python - For Beginners

Introduction to Python Programming


In this course, you will learn everything you need to know to start programming in
Python. Python is a highly popular programming language and is widely sought after
for various job roles. Whether you are looking to automate your tasks, write scripts
or pursue a career in programming, Python is the language for you. The language is
known for its simplicity, ease of use and powerful capabilities, which is why more
developers are switching to Python every day.

Python: The Beginner-Friendly Language


If you're new to programming, you may find that many programming languages are
not very beginner-friendly. They have complex syntax and small mistakes can cause
errors. However, Python is different. It's easy to learn and use. You simply type out
what you want to do, and Python does it. There's not much syntax to learn, so the
learning curve is nearly zero. You can start writing your first program within seconds
of starting to learn Python.

What You'll Learn


In this course, you'll learn everything you need to know to get started in Python. The
lessons are specifically designed with examples to help you along the way. Whet her
you're a complete beginner or have some programming experience, this course is
perfect for you.

Why Learn Python?


There's no reason not to learn Python! Many people might feel intimidated or think
it's too difficult, but don't worry, this course will guide you through all the core
concepts in Python so you can start programming confidently and writing awesome
scripts and programs.

I'm excited to be teaching you Python and can't wait for you to get started in this
course.

How to Install Python


In this tutorial, we'll show you how to install Python onto your computer and a text
editor to write your programs in.

First, head over to your web browser and go to www.python.org/downloads. On this


page, you'll see two buttons:

 Download Python 3.6.3 (the latest version of Python 3)

3|Page
 Download Python 2.7.14 (the latest version of Python 2)
There are two major versions of Python currently in use: Python 2 and Python 3.
Python 2 is a legacy version that's no longer officially maintained or supported, while
Python 3 is the newest version that's getting actively maintained and supported.

While Python 2 has been around longer and has more libraries and code written for
it, Python 3 is the future of Python and has many advantages. Ultimately, it's up to
you to decide which version to download.

Python 3: The Future of Python


In the next five or ten years, it is highly likely that Python 2 will no longer be in use.
The newest version, Python 3, is the future of Python and is being maintained going
forward. Therefore, this tutorial will focus on teaching Python 3.

Download Python 3
To get started, download Python 3. Although there are some differences between
Python 3 and Python 2 in terms of syntax and minor details, if you learn Python 3,
you will be able to code in Python 2 as well. Python 3 is the best version for beginners
to learn.

Click on the "Download Python 3" button and wait for the download to finish. Once
it's done, head over to your downloads folder and double-click on the downloaded
file. You will be prompted with a Python installer. Click through the installer to
complete the installation.

Setting Up Python and a Text Editor


In order to start writing Python code, we need to first install Python 3 on our
computer. Once installed, we can choose any text editor to write our code, but it is
recommended to use a special text editor designed for Python code called an
Integrated Development Environment (IDE). One popular IDE for Python is PyCharm.

Installing Python 3
To install Python 3 on your computer, follow these steps:

1. Download Python 3 from the official website.


2. Install the downloaded file.
3. Close the installation window.
Now you have Python 3 installed on your computer.

4|Page
Choosing a Text Editor
We recommend using an IDE to write Python code, and PyCharm is a great option.
Follow these steps to download and install PyCharm:

1. Go to the JetBrains website and download PyCharm.


2. Choose the free and open source Community version.
3. Install the downloaded file.
4. Open PyCharm and start programming in Python!
Now you have everything you need to start programming in Python.

Pi charm is an integrated development environment that we downloaded in the last


tutorial. To open it, search for it on your computer and then open it. When you first
open Pi charm, you will be prompted to create a project. To change the appearance
of Pi charm, go to "Configure" and then click on "Preferences". Under "Appearance
and Behavior Appearance", you can change the theme to a darker color if you pr efer.

 To create a new project, click on "Create New Project".


 Name your project. For example, "Graph".
 Under "Interpreter", select Python version 3. If you are on a Mac, Python version 2
is already installed by default. If you are on a Windows machine, mak e sure to
select Python version 3.
 Click "Create" to create your project.
Now you have your Python project up and running!

Creating Our First Python Program


In this tutorial, we will learn how to create our first Python program. We will start by
creating a new Python file and naming it "app".

1. Open the draft folder and right-click.


2. Select "New" and then click "Python File".
3. Name the file "app" and click "OK".
Now that we have our Python file open, we can start typing in some code. Let's start
with a very basic "Hello World" program to demonstrate the syntax:

print("Hello World")

5|Page
This program will simply print the words "Hello World" to the console when executed.

To write a basic Python program, we will use the print function to output "Hello
World" to the screen. Here's how:

print("Hello World")
When we run this program, it will print "Hello World" to the console. The print
statement is a built-in Python function that outputs text to the console.

Python programming involves giving the computer a set of instructions, which it will
execute. We can use a text editor to write Python code, and when we save the file
with a .py extension, we can execute it using a Python interpreter.

Using Python to Draw Shapes on the Screen


In this tutorial, we will be using Python code to draw a shape on the screen. We will
start by using the print statement to print something onto the screen. Then, we will
create a triangle shape using forward slashes, spaces, vertical bars, and underscores.

Printing on the Screen


To print something onto the screen, we use the print statement in Python. Inside the
parentheses, we can put whatever we want to print out onto the screen. For example:

print("Hello, world!")
This will print the text "Hello, world!" onto the screen.

Drawing a Triangle Shape


To draw a triangle shape, we can use forward slashes, spaces, vertical bars, and
underscores. Here is an example:

print("/
\ \
\ \\
\ \\\
\ \\\\
\_\\\_\\_
")
This will draw a triangle shape that looks like this:

6|Page
/ \ \ \ \ \_\_\_\
Running the Code
To run the code, we can either click the "Run App" button or the play button in
PyCharm. When the code is executed, it will output the result in the console. We can
use the print statement to output information to the console and see what our
program is doing.

By using Python code, we can draw any shape we want as long as we specify it inside
the print statements.

--------------------------------------------------- END------------------------------------------------------------------

7|Page

You might also like