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

Python - Practical Manual SYIT

This document outlines programming exercises for a Python course. It includes exercises to: 1) ask a user for their name and age and print the year they will turn 100; 2) check if a user-input number is even or odd; 3) generate the Fibonacci series for a given number. Later exercises include writing functions to: reverse a value, check for Armstrong and palindrome numbers, compute a factorial recursively, check if a character is a vowel, find the length of a list or string, and print a histogram of integers in a list. Further exercises involve checking if a sentence is a pangram and printing elements in a list that are less than 5.

Uploaded by

Jayashree Borkar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
460 views

Python - Practical Manual SYIT

This document outlines programming exercises for a Python course. It includes exercises to: 1) ask a user for their name and age and print the year they will turn 100; 2) check if a user-input number is even or odd; 3) generate the Fibonacci series for a given number. Later exercises include writing functions to: reverse a value, check for Armstrong and palindrome numbers, compute a factorial recursively, check if a character is a vowel, find the length of a list or string, and print a histogram of integers in a list. Further exercises involve checking if a sentence is a pangram and printing elements in a list that are less than 5.

Uploaded by

Jayashree Borkar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

2020

Programming with
Python – practical book
SYBSC(IT) SEM III
PRACTICAL 1
a) Create a program that asks the user to enter their name
and their age. Print out a message addressed to them that
tells them the year that they will turn 100 years old.

OUTPUT:
b) Enter the number from the user and depending on
whether the number is even or odd, print out an
appropriate message to the user.

OUTPUT:
c) Write a program to generate the Fibonacci series.

OUTPUT:
d) Write a function that reverses the user defined value.

OUTPUT:
e) Write a function to check the input value is Armstrong
and also write the function for Palindrome.

OUTPUT:
f) Write a recursive function to print the factorial for a
given number.

OUTPUT:
PRACTICAL 2
a) Write a function that takes a character (i.e. a string of
length 1) and returns True if it is a vowel, False otherwise.

OUTPUT:
b) Define a function that computes the length of a given
list or string.

OUTPUT:
c)Define a procedure histogram () that takes a list of
integers and prints a histogram to the screen. For example,
histogram ([4, 9, 7]) should print the following:
****
*********
*******

OUTPUT:
PRACTICAL 3
a) A pangram is a sentence that contains all the letters of
the English alphabet at least once, for example: The quick
brown fox jumps over the lazy dog. Your task here is to
write a function to check a sentence to see if it is a
pangram or not.
OUTPUT:
b) Take a list, say for example this one:
a= [8,3,5] and write a program that prints out all the
elements of the list that are less than 5.
OUTPUT:

You might also like