Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

Basics of Python Programming

Beoordeling
-
Verkocht
-
Pagina's
11
Geüpload op
08-02-2022
Geschreven in
2021/2022

Complete Python basics.

Instelling
Vak

Voorbeeld van de inhoud

Python Basics
What is Python?
 Python is a General Purpose object-oriented programming language, which means that it can model real-
world entities. It is also dynamically-typed because it carries out type-checking at runtime.
 It does so to make sure that the type of construct matches what we expect it to be.
 The distinctive feature of Python is that it is an interpreted language.
 The Python IDLE (Integrated Development Environment) executes instructions one line at a time. This
also lets us use it as a calculator.
Why is it called Python?
 Guido van Rossum named it after the comedy group Monty Python. That is why the metasyntactic
variables (those we will often use to explain code syntax) used here are ‘spam’ and ‘eggs’ instead of
‘foo’ and ‘bar’.
Python Features
Let us now see various features of Python that make it so powerful and popular:
 Easy
o Python is very easy to learn and understand; any beginner can learn Python easily. When writing
code in Python, you need fewer lines of code compared to languages like Java.
 Interpreted
o It is interpreted(executed) line by line. This makes it easy to test and debug.
 Object-Oriented
o The Python programming language supports classes and objects and hence it is object-oriented.
 Free and Open Source
o The language and its source code are available to the public for free; there is no need to buy a
costly license.
 Portable
o Since Python is open-source, you can run it on Windows, Mac, Linux or any other platform.
Your programs will work without any need to change it for every machine.
 GUI Programming
o You can use it to develop a GUI (Graphical User Interface). One way to do this is through
Tkinter.
 Large Python Library
o Python provides you with a large standard library.
o You can use it to implement a variety of functions without the need to reinvent the wheel every
time. Just pick the code you need and continue.
Python Architecture and Working
Let’s now talk about Python architecture and its usual flow –
 Parser
o It uses the source code to generate an abstract syntax tree.
1|Page

,  Compiler
o It turns the abstract syntax tree into Python bytecode.
 Interpreter
o It executes the code line by line in a REPL (Read-Evaluate-Print-Loop) fashion.
Python Constructs
a. Functions in Python
 A function in Python is a collection of statements grouped under a name. You can use it whenever you
want to execute all those statements at a time.
 You can call it wherever you want and as many times as you want in a program. A function may return a
value.

b. Classes in Python
 As we discussed earlier, Python is an object-oriented language. It supports classes and objects.

 A class is an abstract data type. In other words, it is a blueprint for an object of a certain kind. It holds no
values.

 An object is a real-world entity and an instance of a class.

c. Modules in Python
 Python module is a collection of related classes and functions.

 We have modules for mathematical calculations, string manipulations, web programming, and many
more.

d. Packages in Python
 Python package is a collection of related modules. You can either import a package or create your own.


Features of Python
1. Easy
 When we say the word ‘easy’, we mean it in different contexts.
 Easy to Code
o Python is very easy to code as compared to other popular languages like Java and C++.
o Anyone can learn Basic Python syntax in just a few hours. Thus, it is programmer-friendly.
 Easy to Read
o Being a high-level language, Python code is quite like English. Looking at it, you can tell what
the code is supposed to do.
o Also, since it is dynamically-typed, it mandates indentation. This aids readability.
2. Expressive
 First, let’s learn what is expressiveness. Suppose we have two languages A and B, and all programs that
can be made in A can be made in B using local transformations.

2|Page

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
8 februari 2022
Aantal pagina's
11
Geschreven in
2021/2022
Type
College aantekeningen
Docent(en)
Na
Bevat
Alle colleges

Onderwerpen

$3.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
toulikmaitra

Maak kennis met de verkoper

Seller avatar
toulikmaitra Indian Institute of Technology (ISM) Dhanbad
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
4 jaar
Aantal volgers
0
Documenten
2
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen