Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Python

Rating
-
Sold
-
Pages
13
Uploaded on
09-01-2024
Written in
2023/2024

it is the complete expaination fo the basics of the python in new trend for the new generations

Institution
Course

Content preview

INTRODUCTION TO PYTHON :



 Let me give you some ideas about what you can do with Python. That's a very common
question. Python is a multi-purpose programming language, so you can use it for a variety of
different tasks. You can use Python for machine learning and AI. In fact. Python is the
number one language for machine learning and data science projects. Python is also very
popular in web development. Using Python and a framework called Django, you can build
amazing websites. Here are five websites powered with Python and Django, youtube.
Instagram. Spotify. Dropbox, and Pinterest. You can also use Python in automation with
Python, you can save your time and increase your productivity by automating repetitive
tasks. So why are you learning Python? Are you learning it for automation? For data science
or web development? Let me know in the Comments section below.
 Alright the first thing I want you to do is to head over to Python to download the latest
version of Python. So you go to downloads and select the latest version of Python.
 Here in your downloads folder you should see this package simply double click it. You're
going to see this Python installer. If you're on Windows, you will see this checkbox over here.
Add Python to path. Make sure to check it. It's really important. Otherwise you're not going
to be able to follow this tutorial. Simply click on. Continue again one more time. Agree with
the terms and install the latest version of Python. Now here you need to enter the username
password of your computer, so let's do that real quick. Next you need to install a code editor.
We use a code editor to write our code and execute it. The most popular code editor for
Python is P. Charm. You can get it from jetbrains. Dot com, slash par. So on this page click on
download you should see two different editions. One is the Professional Edition which is
commercial and we also have this Community Edition which is free and open source. So
we're going to download the Community Edition.
 Now in your Downloads folder you should have this package. Let's double click it. If you're on
Windows, you're going to see an Installation Wizard, so simply click on the next button until
you install Pie Char. If you're on a Mac, you need to drag this Pie charm and drop it onto the
Applications folder.
 Now let's open it the first time you open. Pi Charm. You have to configure a few settings. We
don't want to spend time on this, so over here you're going to click on skip remaining and set
defaults. Now let's create a new project over here. We can specify the location and the name
of our Python project, so let's append hello World to this path. This is where our Python
project is going to be saved. So let's click on create.
 At this window you can see the content of our project, so here's our Hello Word project.
Currently we have only one folder inside this project that is VN, which is short for Virtual
Environment. We'll talk about virtual environments in the future, so currently we don't have
any Python files inside this project. A real application can consist of tens or 100 or even
thousands of Python files. So let's right click on the project name and go to new Python file.
We're going to call this file. App.
 Now we can collapse this project window by clicking on this icon. So now we have more
space. Let's write our first Python code. We're going to write print all in lowercase, then add
parenthesis, then add quotes either single quotes or double quotes. And inside this codes
we're going to write Hello world. So this is what we call a string. A string means a string or
sequence of characters in simple words that means textual data. So in Python and in many
other programming languages, whenever were dealing with textual data, we should always
surround our text with quotes. In Python we can use single or double quotes. Now this print

, you see here is a function built into Python, and we can use it to print a message on our
application window. So let me show you how to run this code on the top. We go to the run
menu and then select run. Note that there is a shortcut associated with this command. I
always use shortcuts because they increase my productivity.
 Let's click on this now select app. And over here you can see this little window. This is what
we call the terminal window, and it shows the output of our program. So here's the Hello
message printed in the terminal window. Now, as you learn more Python, you will learn how
to build applications that have a graphical user interface that's an advanced topic. So for
now, let's not worry about it.
 All right now, let's talk about variables. We use variables to temporarily store data in a
computer's memory. For example, we can store the price of a product or someone's name,
their email, their age, and so on. Let me show you so to declare a variable. We start by typing
a name for that variable. Let's say H. Then we add an equal sign, and then we type a value,
let's say 20. So with this, we're restoring the number 20 somewhere in our computer's
memory, and we are attaching this age as a label for that memory location. So now we can
read the value at this memory location and print it on the terminal. So instead of printing
Hello World, we want to print the value of the age variable. So I'm going to delete what we
have inside parenthesis.
 And type H. Note that I'm not adding quotes because if I run this program, we'll see the text
H on the terminal. We don't want that we want the value of the age variable, so let's remove
the quotes and print the value of the age variable. Now here on the toolbar, you can click on
this play icon to run your program, or you can use the shortcut that I showed you in the last
video. So the shortcut is over here on a Mac. Let's control shift and R. So.
 There you go. Now we can see the value of the H variable.
 Now we can also change the value of a variable. For example, on line two we can set eight to
30. Now when we run our program we see 30. So as you can see, our program gets executed
from top to bottom. So this is how we can declare and use a variable. Now let's look at a few
more examples, so I'm going to declare another variable called Price and set it to 19.9 five.
So in Python we can use numbers with a decimal point or whole numbers. We can also
declare available and assign it a string value. So let's say first underline name. So if you want
to use multiple words in the name of a variable, we should separate them using an
underscore. This makes our code more readable. See what would happen if I didn't use this
underlay.
 This is not easily readable so we always separate multiple words by an underscore. Now we
set this to a string so we can use single quotes or double quotes. Let's say mo. We also have
a special type of value called a Boolean value which can be true or False. That is like yes or no
in English. Let me show you, so I'm going to declare another variable called is online and set
it to true. We could also set it to False. What we have here is called a Boolean value now.
Note that Python is a case sensitive language, so it's sensitive to lowercase and uppercase
letters. In this case, if I use a lowercase f.
 You can see an error over here because this is not recognized in Python. So False with the
capital F is a special keyword in Python that represents the boolean false value. So this is
how we can declare and use variables in Python all right now. Here's a little exercise for you.
Imagine we want to write a program for a hospital, so we're going to check in a patient
named John Smith. He's 20 years old and is a new patient. I want you to declare a few
variables to store these values. Use the comment box below to share your code with others.
 In this tutorial I'm going to show you how to receive input from the user. In Python we have
another built-in function called input. We use this to read a value from the terminal window.

Written for

Course

Document information

Uploaded on
January 9, 2024
Number of pages
13
Written in
2023/2024
Type
SUMMARY

Subjects

$9.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
akash.m1

Get to know the seller

Seller avatar
akash.m1 dhanalakshmi college of engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions