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
Overig

Python Programming Notes for Beginners

Beoordeling
-
Verkocht
-
Pagina's
49
Geüpload op
04-11-2025
Geschreven in
2025/2026

This document contains complete and well-organized notes covering all key topics from the syllabus. It includes definitions, explanations, solved examples, and important questions for quick revision before exams. The notes are easy to understand and ideal for students preparing for assignments, tests, and final exams. Suitable for both beginners and advanced learners.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

Chapter-2
Python Comments
 Comments can be used to explain Python code.
 Comments can be used to make the code more readable.
 Comments can be used to prevent execution when testing code.


1. Creating a Comment
Comments starts with a #, and Python will ignore them:


Example
#This is a comment
print("Hello, World!")

Comments can be placed at the end of a line, and Python will ignore the rest
of the line:


Example
print("Hello, World!") #This is a comment




A comment does not have to be text that explains the code, it can also be
used to prevent Python from executing code:


Example
#print("Hello, World!")
print("Cheers, Mate!"




Multiline Comments

,Python does not really have a syntax for multiline comments.

To add a multiline comment you could insert a # for each line:


Example
#This is a comment
#written in
#more than just one line
print("Hello, World!")

Or, not quite as intended, you can use a multiline string.

Since Python will ignore string literals that are not assigned to a variable, you
can add a multiline string (triple quotes) in your code, and place your
comment inside it:


Example
"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")

As long as the string is not assigned to a variable, Python will read
the code, but then ignore it, and you have made a multiline comment.


Python keywords



Every language contains words and a set of rules that would make a
sentence meaningful. Similarly, in Python programming language,
there are a set of predefined words, called Keywords which along
with Identifiers will form meaningful sentences when used
together. Python keywords cannot be used as the names
of variables, functions, and classes.
In this article, we will learn about Python keywords and how to use
them to perform some tasks.
Python Keywords
Keywords in Python are reserved words that can not be used as a
variable name, function name, or any other identifier.
List of Keywords in Python

,Keywor Descriptio Keywor Descriptio Keywor Descriptio
d n d n d n

Represents an
expression It is a non-
and It is a Logical False nonlocal
that will local
Operator
result in not variable
being true.

It is used to It is a
as finally It is used with not
create an Logical
exceptions
alias name Operator

It is a
assert It is used for for It is used to or Logical
debugging create Loop
Operator

pass is used
when the
To import
break Break out a from pass user doesn’t
specific parts
Loop want any
of a module
code to
execute

It is used to raise is used
class It is used to global declare a raise to raise
define a class global exceptions or
variable errors.

continu Skip the next To create a return is
iteration of a if Conditional return used to end
e
loop Statement the execution

Represents
It is used to It is used to an
def define the import import a True expression
Function module that will
result in true.

It is used to
It is used to Try is used
del is test if two try
delete an to handle
variables are
object errors
equal

, Keywor Descriptio Keywor Descriptio Keywor Descriptio
d n d n d n

To check if a While Loop
Conditional
value is is used to
elif statements, in while
present in a execute a
same as else-
Tuple, List, block of
if
etc. statements

with
Used to
It is used in a statement is
else lambda create an with
conditional used in
anonymous
statement exception
function
handling

yield
try-except is keyword is
except used to None It represents a yield used to
handle these null value create a
errors generator
function


Getting the List of all Python keywords
We can also get all the keyword names using the below code.
 Python3


import keyword



# printing all keywords at once using "kwlist()"

print("The list of keywords is : ")

print(keyword.kwlist)


Output:
The list of keywords are:
['False', 'None', 'True', 'and', 'as', 'assert', 'async',
'await', 'break',
'class', 'continue', 'def', 'del', 'elif', 'else', 'except',
'finally', 'for', 'from', 'global', 'if',
'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or',
'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']

Geschreven voor

Vak

Documentinformatie

Geüpload op
4 november 2025
Aantal pagina's
49
Geschreven in
2025/2026
Type
OVERIG
Persoon
Onbekend

Onderwerpen

$40.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
archanasarangi

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
archanasarangi synergy institute of engineering and technology dhenkanal
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1
Lid sinds
7 maanden
Aantal volgers
0
Documenten
4
Laatst verkocht
7 maanden geleden

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

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