0% found this document useful (0 votes)
26 views24 pages

Comp117 Unit 01

Uploaded by

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

Comp117 Unit 01

Uploaded by

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

COMP 117

Python Programming

These slides are heavily influenced by MITOPENCOURSEWARE 6.0001


Unit 1 - Introduction

COMP 117 - UNIT 1 2


Contents

• Course info
• Programming basics?
• Programming Languages
• Compiler vs Interpreter
• Algorithm and Flowchart
• Python installation (python.org and Anaconda)
• Ways to run Python code
• Python basics

COMP 117 - UNIT 1 3


Course info

COMP 117 - UNIT 1 4


Course description

Python is a computer programming language. It is one of the most


popular programming languages suitable for almost any task from
developing general purpose applications to data analysis and high-end
computation. This course is an introduction to Python programming
language that covers topics like data types, control structures, loops,
functions, lists, tuples, dictionaries, file input and output, and classes
and objects.

COMP 117 - UNIT 1 5


Learning objectives

• Readily use python programming


• Use python statements
• Write and call simple functions
• Make use of high level data types like tuples, set, and dictionaries

COMP 117 - UNIT 1 6


Grading

• Mid term exam – 10 marks


• Assignments – 5 marks
• Quizzes – 10 marks
• Lab exercises – 10 marks
• Viva-voce – 5 marks
• Final lab exam – 10 marks

COMP 117 - UNIT 1 7


Programming basics

• Source code: The sequence of instructions in a program.


• Syntax: The set of legal structures and commands that can be used in
a particular programming language.
• Input: a data given to a program to process.
• Output: The messages printed to the user by a program.

COMP 117 - UNIT 1 8


Compiler vs Interpreter

Compiler Interpreter
• Faster development • Longer development
• Easier debugging • Harder to debug
• Takes less code to get things • Takes more code to get things
done done
• Slower programs • Faster
• Sometimes as fast as compiled, • Compiled code runs directly on
rarely faster CPU
• Less control over program • More control over program
behavior behavior

COMP 117 - UNIT 1 9


Algorithm vs Flowchart
start
Square root of a number x is y
such that y*y = x Guess g<<x

1. Start with a guess, g


2. If g*g is close enough to x, True
If g*g
stop and say g is the answer > x + e

3. Otherwise make a new guess


False
by averaging g and x/g
4. Using the new guess, repeat g = (g+x/g)2
process until close enough
Print g

stop

COMP 117 - UNIT 1 10


Python code

COMP 117 - UNIT 1 11


Python installation

COMP 117 - UNIT 1 12


Python installation – www.python.org

COMP 117 - UNIT 1 13


Python installation - Anaconda

COMP 117 - UNIT 1 14


Ways to run python code

COMP 117 - UNIT 1 15


Ways to run python code – Python Prompt

COMP 117 - UNIT 1 16


Ways to run python code – Command Prompt

COMP 117 - UNIT 1 17


Ways to run python code – IDE

COMP 117 - UNIT 1 18


Ways to run python code – IDE

COMP 117 - UNIT 1 19


Ways to run python code – Jupyter Notebook

COMP 117 - UNIT 1 20


Ways to run python code – Jupyter Notebook

COMP 117 - UNIT 1 21


Python basics

COMP 117 - UNIT 1 22


A sample code

COMP 117 - UNIT 1 23


The End

COMP 117 - UNIT 1 24

You might also like