You are on page 1of 39

INTRODUCTION TO PYTHON AND COMPUTER

PROGRAMMING
WHAT COMES TO MIND WHEN YOU HEAR
THE WORD PROGRAMMER?
Have you ever tried coding?
COMPUTER PROGRAMMING

•is a way to make computers do different tasks


•It is a process of writing a set of instructions (also known as code) that a machine can
understand and making the machine follow them
•requires technical skills and creative thinking
•we need to highlight two points in the definition: "make computers do tasks" and "writing a
set of instructions that a machine can understand"
WHAT ARE THE PROGRAMMING
LANGUAGES?

Computers understand only machine code. Programmers use compilers to translate source code that
they write to the machine code
POPULAR PROGRAMMING
LANGUAGES
HOW TO CHOOSE A COMPUTER LANGUAGE?
•Ask yourself what sort of work you would like to do
•Think about why you want to learn to code
•Every field comes with a set number of languages. Web development, for example,
differentiates between two main types of programming: front-end and back-end.
•So, it’s not really about choosing a language. It’s more about choosing a field. If you want to
create Android apps, choose Java; for iOS apps choose Swift, and if you want to develop
games, learn C, etc. And if your answer to the question "why" is "to make a lot of money,
idk", consider the most popular programming languages and start there.
WHAT SHOULD I EXPECT?

•A lot of it feels like a routine, and when it doesn’t, it’s more like hitting your head against
the brick wall in the middle of a desert.
•Programming isn’t just about languages and syntax and compilers, it’s the whole logical
thinking process that makes it so rewarding.
•It teaches you how to think differently.
•It teaches you patience.
•The bottom line is that programming is a skill.
REVIEW
TIME
WHAT IS THE MAIN REASON WHY WE HAVE
SO MANY PROGRAMMING LANGUAGES?
WHAT DO YOU ABSOLUTELY NEED TO
BECOME A PROGRAMMER?
WHAT IS PYTHON?

• Python is a modern general-purpose programming language initially


developed by a Dutch programmer named Guido van Rossum in the
late 1980s.
• The name comes from the popular Monty Python show, not the snake,
as you might think.
• This language has a clean, uniform, and well-readable syntax and is
designed to be easy to learn and use in practice.
• Nowadays, Python is one of the most popular programming languages
worldwide, according to the TIOBE index.
Python has a wide range of possible applications,
especially in:
• Web development;
WHAT IS • Data science (including machine learning);
PYTHON? • Scripting (task automation, such as text processing
or simulation of typical user actions).
• It is also used in desktop development, though less
commonly.
PYTHON IN DATA SCIENCE
What makes it better than other languages for this purpose?
 Its simple syntax allows people from non-programming backgrounds to use it for data processing
and model training without spending much time learning a new language.
 Python supports a very large number of third-party libraries for machine learning, neural
networks, statistics, and numeric calculations, which makes your job much easier.
 With Python, it is possible to collect, clean, and explore data, as well as train models and
visualize the results — all in one setting!
 Python ML developers' community is very large, so you can always find support for your tasks.
SHORT HISTORY

• Python 1.0 was released in 1994 and laid the basic principles of the language with emphasis
on simplicity.
• Python 2.0 was released in 2000. This version has become very popular among
programmers.
• Python 3.0 was the next major version released in 2008. It broke backward compatibility
with its predecessors in order to rid the language of historic clutter and make Python more
readable and consistent.
FIRST PROGRAM EXAMPLE

Here is a single line of Python code that prints Learn Python to be


great!.

print("Learn Python to be great!")
THE HELLO WORLD PROGRAM

• Our first example will be Hello, World! 


• It is traditionally used to introduce beginners to a new programming language.
print(“Hello, World!")
• You may run this code online  (just copy it and click on the triangle)
• You should get this result: Hello, World!
SHORT EXPLANATION

•Here, print is the name of a function.


•A function is a block of code that does some useful work for you.
•When the name of a function is followed by parentheses, it means that it was called to get the
result.
•"Hello, World!" is a Python string. All strings are surrounded by either single or double quotes,
so 'Hello, World!' is also a valid string.
•You may replace this string with another one, and the program will print the new string. For
example:
print('Python 3.x')
PRINTING QUOTES
• Now imagine that the string you want to print already contains some type of quotation mark. If you
would like to include quotes into a string, then enclose this string in quotes of another type, e.g.:
print("Yes, I'm ready to learn Python.")
• Part of the string with I'm is printed correctly, because you used double quotes "..." to enclose the
whole string:
Yes, I'm ready to learn Python.
• If you write it in the following wrong way:
print('Yes, I'm ready to learn Python.')
• your program won't know where the string starts and ends.
POSSIBLE ERRORS
putting extra indentation
•   print("Hello, World!")
calling the function by the wrong name
•pint("Hello, World!")
writing names in the wrong case
•PRINT("All caps")
•Print, print and PRINT are not the same. Names are case-sensitive in Python.
missing one or both quotes for a string
•print("Python)
missing one or more parentheses
•print("I have no end"
PYCHARM BASICS

•PyCharm – one of the most powerful Python IDE developed by JetBrains.


•It has a very user-friendly interface and provides a variety of useful features like automatic
code completion, project indexing, package management, etc.
•PyCharm Community Edition — it's free and is powerful enough to write fairly large
programs. If you want more information on PyCharm, you can visit the 
official PyCharm webpage. You can also find the guide to PyCharm installation.
FIRST PROJECT IN PYCHARM

1. When you open PyCharm for the first


time, you’ll be offered a few settings
options.
FIRST PROJECT IN PYCHARM

2. You will be offered a few plugins to


install. You do not really need them for
now, but you should know, that
PyCharm can easily be customized. You
can always install new plugins
in Settings | Plugins.
FIRST PROJECT IN PYCHARM

3. Once customization is done, you can


either create a new project, open an
existing one, or check out from any
version control system like Git or
Bitbucket. If you are just starting and
don’t have any existing projects, just
press the ‘Create New Project’ button.
FIRST PROJECT IN PYCHARM
4. Choose the path for your future project, where
all the project files will be stored. For educational
purposes, the name of the project will be
"FirstProject". It has a drop-down menu: Project
Interpreter: New Virtualenv environment. It means
that your project will be created with new default
settings. It means that it will be isolated from other
projects. Let’s get a bit deeper into it.
FIRST PROJECT IN PYCHARM
5. The first option is the path to a new virtual
environment. This is a virtual environment, an
isolated “quasi-” Python distribution with its own
available libraries and the Python built-in package
manager, which allows you to install external
libraries. The Base interpreter drop-down menu
indicates the path to the actual Python, which you
download and install to your computer. Each of these
projects will have its own dependencies – the
libraries available (or required) for a specific project.
FIRST PROJECT IN PYCHARM

6. By opening the root directory,


you will see another folder – your
new virtual environment, which
contains all Python settings for this
project. The settings include
libraries and the Python version.
PYCHARM CAPABILITIES

• To create a new Python file in your project, you can either go to File | New | Python file, or
right-click the FirstProject | New | Python file. Enter the name and hit OK.
PYCHARM CAPABILITIES

• This will create a new .py file in your project folder:


PYCHARM CAPABILITIES

•Now you can finally write the lines you desired :


print("Hello, world!")
•To run the program in PyCharm, you can right-
click on the .py file and press Run or use the
shortcuts. To know more about PyCharm shortcuts,
you can check the Shortcuts section on the official
website. You can choose your operating system in
the top right corner:
PYCHARM CAPABILITIES
• After running a specific file for the first time, PyCharm will remember it, so you can rerun the program by
clicking the green Play button in the top left corner:

•If you don't have the Play button, go to View → Appearance and check Toolbar.
•When the program is executed, the result will appear in the Run tool window at the bottom of the screen:

• The first line shows the path to the project interpreter and the path to the program which has been executed
by this interpreter. The result of your program execution will follow. If you need more detailed information
on PyCharm, you can always refer to the official tutorial.
PYCHARM SETTINGS

• PyCharm is a very customizable IDE. Try


going to File | Settings. There you will
notice are a lot of sections. To find the
specific settings, you can use the search
box, as shown :

• PyCharm is a very intuitive and powerful


IDE, and it also has a free community
edition.
OTHER IDES YOU CAN WORK WITH

In addition to the Community version, there are two other editions: Educational and Professional.


1) Professional edition supports many other programming languages like JavaScript and HTML for web
development, database support, and a lot of features you might need once you become a pro.
2) Educational edition is based on the Community Edition and includes all functionality but it has several
significant differences.
•Another way to work with Python is to install the IntelliJ IDEA plugin that copies all PyCharm capabilities.
If you already have the IDEA installed, it is the fastest way to start coding in Python. Bear in mind that IDEA
was initially developed for Java users, so some tools may be inconvenient for a person who is studying Python.
WHAT ARE THE SPECIFIC SETTINGS FOR EVERY
PROJECT PROVIDED BY THE VIRTUAL
ENVIRONMENT? (2 CORRECT ANSWER)
TO CHANGE THE UI THEME, YOU WOULD GO
TO…
A DEPENDENCY IS …
TAKE A LOOK AT THE TWO LIST BELOW AND
MATCH EACH PYCHARM EDITION WITH A
DESCRIPTION OF ITS FUNCTIONALITY
TOPIC:
Introduction to Python and Computer Programming

• 3-2-1: Write 3 things you have learned, 2 things you are


struggling with , 1 question you have for me

CLOSURE ACTIVITY

You might also like