0% found this document useful (0 votes)
85 views16 pages

Mooc Report

This document is a MOOC seminar report submitted by Sparsh Dhama to Dr. Chandan Singh on the topic of "Programming in Python". It includes a certificate signed by Dr. Chandan Singh certifying that Sparsh Dhama completed the MOOC seminar. It also includes an acknowledgment, table of contents, introduction to programming concepts in Python like data types, variables, functions, conditionals and loops.

Uploaded by

Sparsh Dhama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views16 pages

Mooc Report

This document is a MOOC seminar report submitted by Sparsh Dhama to Dr. Chandan Singh on the topic of "Programming in Python". It includes a certificate signed by Dr. Chandan Singh certifying that Sparsh Dhama completed the MOOC seminar. It also includes an acknowledgment, table of contents, introduction to programming concepts in Python like data types, variables, functions, conditionals and loops.

Uploaded by

Sparsh Dhama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

MOOC SEMINAR REPORT

on
Programming in Python
B.TECH CSE II SEM
2021-2022

Submittedto: Submittedby:

Dr. Chandan Singh Sparsh Dhama


(CC-SectionR) ID:21011318
Roll No. 66

DEPARTMENT OFCOMPUTERSCIENCEAND
ENGINEERING
GRAPHIC ERA HILL UNVERSITY,
DEHRADUN
CERTIFICATE

Certified that Sparsh Dhama (Student ID -21011318) has completed

MOOC Seminar on the topic “Programming in Python” for the


fulfillment of B.Tech CSE IISemester Seminar (SCS-201) in Graphic
Era Hill University, Dehradun.

Student has successfully completed this course as best of my


knowledge.

Date:15July2022

(Dr. Chandan Singh)

ClassCoordinator
CC-SectionR
ACKNOWLEDGMENT

I would like to express our gratitude to the Almighty , the most Beneficent and the
most Merciful, for Successful completion of MOOC Seminar. I wish tothank my
parents for their continuing support and encouragement. I also wish
tothankthemforprovidinguswiththeopportunitytoreachthisfarinourstudies. I would
like to thanks my friends for showing patience, support and encouragement
through out the completion of this Course . I also acknowledge to my
Classcoordinator Dr. Chandan Singh and Subject Teacher Mr . Anmol Kundlia
who help me to understand this course .At last but not the least I greatly in debted
to all other persons who directly or indirectly helped me during this course.

Sparsh Dhama
ID : 21011318
Btech CSE Sec R
GEHU DEHRADUN
TABLEOFCONTENTS

1. INTRODUCTION (Module-1ofCourse)
1.1 Introduction to programming
1.1.1 What is programming?
1.1.2 What is automation?
2. BasicPythonSyntax(Module-2ofCourse)
2.1 Expressions and Variables
2.1.1 DataTypes
2.1.2 Variables
2.1.3 Implicitvs.ExplicitConversion
2.2 Functions
2.2.1 DefiningFunctions
2.2.2 Returningvalues
2.3 Conditionals
2.3.1 ComparisonOperators
2.3.2 if, else and elif statements
3. Loops(Module-3 ofCourse)
3.1 WhileLoops
3.2 ForLoops
4. Strings,ListsandDictionaries(Module-4ofCourse)
4.1 Strings
4.2 Lists
4.3 Dictionaries
5. CONCLUSION
5.1 SUMMARY
REFERENCE
1. INTRODUCTION(Module-1ofCourse)
1.1 Introduction to programming
In this module we’ll learn about the basics of
programming languages and syntax. We’ll also
be introduced to the Python Programming
language. Last up , we’ll cover some basic
functions and keywords of the language , along
with some arithmetic operations.
1.1.1 What is programming?
At a basic level, a computer program is a recipe
of instructionsthattellsyourcomputerwhattodo.
When you write a program, you create a step by
step recipe of what needs to be done to complete
a task and when your computer executes the
program it reads what you wrote and follows
your instructions to the letter. The recipe is
written in a code called programming language.
The syntax is the rules for how each instruction
is written and these mantics is the effects the
instructions have.
1.1.2 Whatisautomation?
Automation is the process of replacing a manual
step with one that happens automatically.Take a
traffic light for example,which continuously
regulates the flow of vehicles at an intersection.
It can save time, reduce errors, increase
consistency, and providea way to centralized
solutions and mistakes making them easier to
fix.
1.2 Introduction to python
Programming in Python usually feels similar to
using a humanlanguage. This is because Python
makes it easy to express what we want to do
with syntax that’s easy to read and write.
In programming, an interpreter is the program
that reads and executes code.
1.2.1 Whatispython?
Python is an interpreted, object-oriented, high-level
programming
Language with dynamics emantics.
structures, combined with dynamic typing and dynamic binding,
Make it very attractive for Rapid Application Development, as
well as for use as a scripting or glue language to connectexisting
components together. Python's simple, easy to learn syntax
emphasizes read ability and therefore reduces the costofprogram
maintenance. Python supports modules and packages, which
encourages program modularity and coder use.The Python
interpreter and the extensive standard library are available in
source orbinary form without charge for all major platforms, and
canbefreelydistributed.
1.2.2 WhyisPython relevant toIT?
For many years, Python was considered a
beginner’s language and was mostly used for
teaching concepts or writing very small
simplescripts. One reason for this is that the
language has become more powerful. It’s also
because there’s more tools available in Python
for a growing range of applications.
You can use Python to calculate statistics, run
your e-commercesite, process images, interact
with web services, and do a wholehost of other
tasks. Python is perfect for automation. It lets
you automate everyday tasks by writing
simplescripts that are easy to understandand easy
to maintain. That's why Python is the language
of choice for lots of people working in IT
support,system administration, and web
development. Last but not least, Python is
available for download on a wide variety of
operatingsystems, like Windows, Linux, and
Mac OS. And what's more,Python is so popular
in the workplace that if you are currently
working in IT, you've most likely
encounteredital ready.
1.3 First programming
concepts
Functions and
Keywords
Functions and keywords are the building blocks of a
language’ssyntax. Functions are pieces of code that
perform a unit of work. Keywords are reserved words
that are used to construct instructions. We briefly
encountered for and in our first Python example, and
we'll use a bunch of other keywords as we gothrough
the course. For reference, these are all the reserved
keywords:

False class finally is return


None continue For lambda try
True def From nonlocal while
and del global not with
as elif If or yield
assert else import pass
break except In raise

Arithmeticoperators
Python can operate with numbers using the
usual mathematicaloperators, and some special
operators, too. These are all of
them(we'llexplorethelasttwoinlatervideos).
 a+ b=Adds aandb
 a-b=Subtractsbfroma
 a*b=Multiplies aandb
 a/b=Dividesabyb
 a ** b = Elevates a to the power of b. For non integer
values of b, thisbecomesaroot(i.e.a**(1/2)is
thesquarerootofa)
 a//b=Theintegerpartoftheintegerdivisionofabyb
 a%b =Theremainderpartoftheintegerdivisionofabyb

2. BASICPYTHONSYNTAX(Module-2ofCourse)
2.1 ExpressionsandVariables
One of the most powerful features of a programming
language is theability to manipulate variables. A
variable is a name that refers to avalue. An
expression is a combination of operators and
operands thatisinterpretedtoproducesomeothervalue.
2.1.1 DataTypes
Most programs need to manipulate
some kind of data, and that data can
come in a lot of different forums,
Or like we call them datatypes.
In Python, text in between quotes—either single or
Double we have the parameters, also called arguments, for
the function enclosed in parentheses. A function can haven
oparameters, orit can have multiple parameters.
Parameters allow us to call a function and pass it data,
with the data being available inside the function
asvariables with the same name as the parameters. Lastly,
we put acolonattheendoftheline.
After the colon, the function body starts. It’s
important to note that inPython the function body is
delimited by indentation. This means thatall code
indented to the right following a function definition is
part ofthe function body. The first line that’s no
longer indented is theboundary of the function body.
It’s up to you how many spaces youuse when
indenting -- just make sure to be consistent. So if
youchoose to indent with four spaces, you need to use
four spaceseverywhereinyourcode.

1.1.1 Returningvalues
We use the return keyword in a function, which tells
the function to pass data back. When we call the
function, we can store the returned value in a
variable. Return values allow our functions to be
moreflexible and powerful, so they can be reused
and called multipletimes.
Functions can even return multiple values. Just don't
forget to store all returned values in variables! You
could also have a function return nothing, in which
case the function simply exits.

3. Loops(Module-3ofCourse)
3.1 WhileLoops
While Loops instruct your computer to continuously
execute your code based on the value of a condition.
This works in a similar way to branching if
statements. The difference here is that the body of the
block can be executed multiple times instead of just
once. A while loop will continuously execute code
depending on thevalue of a condition. It begins with
the keyword while, followed by a comparison to
beevaluated, then a colon. On the next line is the code
block to be executed, indented to theright. Similar to
an if statement, the code in the body will only be
executed if the comparisonis evaluated to be true.
What sets a while loop apart, however, is that this
code block will keep executing as long as the
evaluation statement is true. Once the statement is no
longer true, the loop exits and the nextline of code
will be executed.
1.1 ForLoops
For loops allow you to iterate over a sequence
of values. The power of for loopscomes from
the fact that it can iterate over a sequence of
any kind of data, not just arange of numbers.
You can use for loops to iterate over a list of
strings, such asusernames or lines in a file. A
for loop works well when you want to iterate
over a sequence of elements.
2. Strings,ListsandDictionaries(Module-4of Course)
2.1 Strings
A string is a datatype in Python that's used to
represent a piece of text. It's written between quotes,
either double quotes or single quotes, your choice. It
doesn't matter which type of quotes you use as long
asthey match. If we mix up double and single quotes,
Python won't be too happy, and it'll return a syntax
error, telling us it couldn't find theend of the string. A
string can be as short as zero characters, usuallycalled
an empty string or really long. We also learned that
we can usestrings to build longer strings using the
plus sign and action called concatenating. A less
common operation is to multiply the string by a
number, which multiplies the content of the strength
at many times like this.

String indexing allows you to access individual


characters in a string. You can do thisby using square
brackets and the location, or index, of the character
you want toaccess. It's important to remember that
Python starts indexes at 0. So to access
thefirstcharacterinastring, youwould use theindex[0].
If you tryto accessanindex
that’s larger than the length of your string, you’ll get
an IndexError. This is becauseyou’re trying to access
something that doesn't exist! You can also access
indexesfrom the end of the string going towards the
start of the string by using negativevalues. The index
[-1] would access the last character of the string, and
the index [-2]wouldaccess the second-to-last
character.
when we first came across the list, in Python, we
use square brackets to indicatewherethe liststarts
andends.
ListsinPythonaredefinedusingsquarebrackets,withtheel
ementsstoredinthelistseparatedbycommas:list=
["This","is","a","list"].
strings and lists are both examples of sequences.
Strings are sequences ofcharacters, and are
immutable. Lists are sequences of elements of any
data type,and are mutable. The third sequence type
is the tuple. Tuples are like lists, sincethey can
contain elements of any data type. But unlike lists,
tuples are
immutable.They’respecifiedusingparenthesesinstea
dof squarebrackets.

1.1 Dictionaries
The data inside dictionaries take the form of pairs of
keys and values. To get adictionary value we use its
corresponding key. Another way these two vary is
while ina list the index must be a number, in a
dictionary you can use a bunch of differentdata types
as keys, like strings, integers, floats, tuples, and more.
The name dictionaries comes from how they work in a
similar way to human language dictionaries. These are
another data structure in Python. They’re similar toa
list in that they can be used to organize data into
collections. However, data in adictionary isn't
accessed based on its position. Data in a dictionary is
organized intopairs of keys and values. You use the
key to access the corresponding value. Wherea list
index is always a number, a dictionary key can be a
different data type, like a string, integer, float, or even
tuples.
REFERENCE

1. MartinC. Brown: Python: The complete reference.


2. YashwantKanetkarandAdityaKanetkar:LetusPython,3rdEdition
3. K. Kavitha, Dr. N. Satheesh and Dr. D.
Vijendra Babu: Python Crash Course, Cloud tail
India.

You might also like