0% found this document useful (0 votes)
10 views18 pages

2.1

The document outlines the syllabus for a Python programming course, focusing on flow control and conditional blocks. It includes various programming exercises such as finding even or odd numbers, calculating the largest number among three, and simulating a calculator. Additionally, it covers loops, nested if-else statements, and basic programming tasks involving lists and strings.

Uploaded by

Mr Raosahab
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)
10 views18 pages

2.1

The document outlines the syllabus for a Python programming course, focusing on flow control and conditional blocks. It includes various programming exercises such as finding even or odd numbers, calculating the largest number among three, and simulating a calculator. Additionally, it covers loops, nested if-else statements, and basic programming tasks involving lists and strings.

Uploaded by

Mr Raosahab
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/ 18

PYTHON PROGRAMMING

(BCC302 / BCC402/ BCC302H / BCC402H)


SYLLABUS
UNIT 2 :Python Program Flow Control Conditional blocks

if, else and else if, Simple for loops in python, For loop using ranges, string, list and
dictionaries. Use of while loops in python, Loop manipulation using pass, continue,
break and else. Programming using Python conditional and loop blocks

1
PYTHON PROGRAMMING
UNIT 2
Python Program Flow Control Conditional blocks
LEC-1
By
Pragya Rajvanshi
M.Tech(CSE)

2
If-else statement Write a program to find out whether a number
Syntax
is even or odd
if condition:
#block of statements
else:
#another block of statements (else-block)

3
 elif statement Write a program to find out the largest number
among three
if expression 1:
# block of statements
elif expression 2:
# block of statements
elif expression 3:
# block of statement
else:
#statement

4
Write a program to simulate the calculator

5
 Nested if else Write a program to find out the largest number among
if condition 1:
three using nested –if else
if condition2:
#nested if code
else:
#nested else code
else:
#else code

6
Write a program to find out whether a year is Write a program to find out the roots of
leap year or not
quadratic equation

7
SOME BASIC QUESTIONS
Write a Python program that accepts the user's first
and last name and prints them in reverse order with a
space between them

8
Write a Python program that accepts a Write a Python program to display the first and
sequence of comma-separated numbers from last colors and middle element from the list
the user and generates a list and a tuple of
those numbers.

9
Write a Python program that Write a Python program to count the number 4 in a
accepts an integer (n) and given list.
computes the value of
n+nn+nnn.

Write a Python program to calculate the number of days


between two dates. Sample dates : (2014, 7, 2), (2014, 7, 11)

10
Python program that takes a Write a Python program to test whether a passed letter is a
string and a non-negative integer vowel or not
n, then returns n copies of the
first two characters of the given
string:

Write a Python program that concatenates all elements


in a list into a string and returns it.

11
Write a Python program to sum three given integers. Write a Python program to sum two
However, if two values are equal, the sum will be given integers. However, if the sum is
zero between 15 and 20 it will return 20

12
Write a Python program to add two objects if both Write a Python program to sum two
objects are integers. given integers. However, if the sum is
between 15 and 20 it will return 20

13
Write a Python program to parse a string to float or Write a Python program to count the number
integer of occurrences of a specific character in a
string.

Calculate the hypotenuse of a right angled triangle

14
Write a Python program to remove the Write a Python program to test whether all
first item from a specified list numbers in a list are greater than a certain number.

15
Write a Python program to sum all the Write a Python program to multiply all the items in a
items in a list list.

Write a Python program to get the largest number


from a list

16
Write a Python program to count the Write a Python program to get the smallest number
number of strings from a given list of from a list
strings. The string length is 2 or more
and the first and last characters are the
same

17
18

You might also like