0% found this document useful (0 votes)
1 views

sem12

The document outlines key concepts in Python programming for a B.Sc I Semester Data Science course at Osmania University, focusing on computing devices, algorithms, flowcharts, pseudocode, conditional and iteration statements, operator precedence, and type conversion. It emphasizes the importance of algorithms as structured problem-solving methods and provides guidelines for writing pseudocode. Additionally, it covers Python's features, including its dynamic and strong typing, and various operators used in programming.

Uploaded by

psaritha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

sem12

The document outlines key concepts in Python programming for a B.Sc I Semester Data Science course at Osmania University, focusing on computing devices, algorithms, flowcharts, pseudocode, conditional and iteration statements, operator precedence, and type conversion. It emphasizes the importance of algorithms as structured problem-solving methods and provides guidelines for writing pseudocode. Additionally, it covers Python's features, including its dynamic and strong typing, and various operators used in programming.

Uploaded by

psaritha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Expected Questions

Most Important

Problem Solving
with
Python Programming
Osmania University
B.Sc I Semester – Data Science
UNIT –I
Important Concepts
Computing Devices
 Computing devices are electronic systems designed to
process data and perform various computational tasks.
These devices include a wide range of technology, from
personal computers, smartphones, and tablets to
advanced systems like servers, supercomputers, and
embedded systems.
 Uses
 Communication
 Education
 Business Applications
 Entertainment
 Scientific Research
 Healthcare
 Everyday Tasks
Features of Python
 Easy-to-learn
 Easy-to-maintain
 Portable
 Interpreted
 Extensible
 Free and Open Source
 High Level Language
 Scalable
Algorithm
 Algorithm is an ordered sequence of finite,
well defined, unambiguous instructions for
completing a task.
 It is an English-like representation of the
logic which is used to solve the problem.
 It is a step- by-step procedure for solving a
task or a problem.
Characteristics of an
 Finiteness Algorithm
 Definiteness
 Input
 Output
 Effectiveness
 Generality
 Feasibility
 Independent
Building Blocks of an Algorithm

 Input
 Process
 Output
 Control Structures
 Sequence
 Decision/Selection
 Repetition/Iteration
 Modularity
Flowchart
Flow chart is defined as graphical or diagrammatic
representation of the logic for problem solving.
Pseudocode

 Pseudo” means initiation or false.


“Code” means the set of statements
or instructions written in a
programming language.

 Pseudocodeis also called as


“Program Design Language [PDL]”.
Rules for writing
Pseudocode
 Write one statement per line
 Capitalize
initial keyword(READ,
WRITE, IF, WHILE, UNTIL). 
 Indent to hierarchy
 End multiline structure
 Keepstatements language
independent
Common keywords used in
pseudocode
1. //: This keyword used to represent a comment.

2. BEGIN,END: Begin is the first statement and end is the last statement.

3. INPUT, GET, READ: The keyword is used to inputting data.

4. COMPUTE, CALCULATE: used for calculation of the result of the given


expression.

5. ADD, SUBTRACT, INITIALIZE used for addition, subtraction and


initialization. 

6. OUTPUT, PRINT, DISPLAY: It is used to display the output of the program.

7. IF, ELSE, ENDIF: used to make decision.

8. WHILE, ENDWHILE: used for iterative statements.

9. FOR, ENDFOR: Another iterative incremented/decremented tested


automatically.
Conditional Statements

 Conditionalstatements in Python are


used to execute a block of code based on
certain conditions.
 The primary conditional statements are
 if
 if ..else
 Chained if
 Nested if
if statement
if – else statement
Chained conditionals(if-elif-else)
Nested if
Iteration Statements

Iteration statements, also known as loops,


are used to repeatedly execute a block of code
as long as a condition is true.
Python supports the following iteration
statements

i. for in sequence
ii.for in loop
iii.while loop
for in sequence
for loop in range
While loop
Operator Precedence
 Parentheses () have the highest precedence.

 Exponentiation ** comes next.

 Multiplication *, Division /, Modulus %, and Floor


Division // follow.
 Addition + and Subtraction - come after.

 Bitwise Operators (&, |, ^) and Shift Operators (<<,


>>) have lower precedence.
 Comparison Operators (==, >, <, !=, etc.) are next.

 Logical Operators (not, and, or) are evaluated last.


Assignment Operators
 =: Simple assignment (e.g., x = 10).
 +=: Add and assign (e.g., x += 3 → x = x + 3).
 -=: Subtract and assign (e.g., x -= 2 → x = x - 2).
 *=: Multiply and assign (e.g., x *= 2 → x = x * 2).
 /=: Divide and assign (e.g., x /= 2 → x = x / 2).
 //=: Floor divide and assign (e.g., x //= 3 → x = x // 3).
 %=: Modulus and assign (e.g., x %= 3 → x = x % 3).
 **=: Exponentiate and assign (e.g., x **= 3 → x = x ** 3).
 &=, |=, ^=, <<=, >>=: Bitwise operations and
assignment (e.g., x &= 3).
Typed Language
Dynamic Typing
Strong Typing
Type conversion in Python

 Implicit Type Conversion (Coercion):


 Explicit
Type Conversion (Type
Casting):
Keywords in Python

You might also like