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
Other

Python Programming Notes for Beginners

Rating
-
Sold
-
Pages
49
Uploaded on
04-11-2025
Written 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.

Show more Read less
Institution
Course

Content preview

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']

Written for

Course

Document information

Uploaded on
November 4, 2025
Number of pages
49
Written in
2025/2026
Type
OTHER
Person
Unknown

Subjects

$40.99
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
archanasarangi

Also available in package deal

Get to know the seller

Seller avatar
archanasarangi synergy institute of engineering and technology dhenkanal
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
6 months
Number of followers
0
Documents
4
Last sold
6 months ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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