This document provides instructions for 54 Python programming exercises organized into 9 sections. The exercises cover a range of Python topics including conditional statements, iterative statements, data types, functions, datetime module, random module, regular expressions, and file handling. For each exercise, the student is instructed to write a Python program to implement the described task. The exercises are meant to teach students how to apply various Python concepts and complete programming challenges of varying difficulty.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0 ratings0% found this document useful (0 votes)
54 views5 pages
Python Index
This document provides instructions for 54 Python programming exercises organized into 9 sections. The exercises cover a range of Python topics including conditional statements, iterative statements, data types, functions, datetime module, random module, regular expressions, and file handling. For each exercise, the student is instructed to write a Python program to implement the described task. The exercises are meant to teach students how to apply various Python concepts and complete programming challenges of varying difficulty.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 5
S.No. Name of the Experiment Page.No.
Write a Python program to implement the following.
1. a) Write a python program to take a two digit number as an input
from user andspecify each digit number separately. b) Write a program to prompt the user for hours and rate per hour to compute gross pay using python c) Write a python program to take a string as an input from the user 1-6 and do the following 1.Print the string without the first character. 2.Print the string without last character. 3.Print the string in reverse. 4.Print alternate characters of the following.
d) ) Write a python program to covert the given string in upper case
and lower case. e) write a python program to ask the user to enter an integer(use an empty prompt)Print true if the number is add, print false otherwise f) write a python program to ask the user to enter a name (use an empty prompt)Print the name entered but in upper caseFor example, if the user enters ‘abc’, print’ ABC’. 2. Write a Python program to implement the following using Conditional Statements. a) Ask the user to enter an integer If the number is positive print “positive” 7-11 If the number is negative print “negative” b) write a python program to rewrite your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours c) Write a python program to find the greatest of two numbers and print the square of the greatest number if the numbers are same print square of either number. d) Write a python program to find the largest number of the given numbers. e) write a python program to find greatest among three given numbers. Write a Python program to implement the following using Iterative Statements. a) Write a python program to find the largest number of the given numbers. b) write a python program to count the elements in the list and print 12-14 3. count with the number (or) element c) Write a python to calculate the average of the given numbers. d) write a python program to use a while loop to generate the numbers from 1 to 10 if a number divisible by 3 is found print “***” .if a number is divisible by 5 is found print “*****” . other wise just print the number .
Write a Python program to implement the following using Data
Types. a) write a python program to ask the user to enter an integer ,n(z) Store the first n numbers of the fibonnaci series in a listPrint the list b) write a python program using string slicing c) write a python program using with range function. 4. d) write a python program to demonstrate searching a string. 15-44 e) write a python program to demonstrate built in function and lists
S.No Name of the Experiment Page.No.
f) write a python program using string and lists
g) write a python program to demonstrate lists in order.
h) Write a python program to add elements in a list using append.
i) write a python program on list can be sliced using string j) Write a python program to replace a word or letters in a particular string k) write a python program on stripping with spaces l)write a python program to enter an integer n Create a list of integer from 0 to n-1 Print the list m) write a python program to enter an integer nStore the square of all the add numbers less than n in a list Print the list n) write a python program to demonstrate the dictionaries o) write a python program to comparing lists and dictionaries p) write a python program using dictionaries q) write a python program to demonstrate string with spaces r) write a python program ask the user to enter a list of integer separated by spaces convert this into a list of integer but square each element Print the list s) write a python program to ask the user to enter a stringCheck if the substring ‘abc’ or ‘def’ exist in the stringIf it does print True else false t) write a python program for when we encounter a new name , we need to add a new entry in the dictionary u) write a python program to demonstrate counting pattern v) write a python program to demonstratedictionaryliterals(constants) w) write a python program to ask the user to enter a string Covert this to lower case Count the no.of occurrences of each character in the string Print the result in sorted order of character x) write a python program to read list of students details (registration number marks) and display it in dictionary y) write a python program ask the user for a list of integer separated by spaces each number of occurrence of each in the string version as the key and the square of the integers print the result with square of the given number z) write a python program on mapping using dictionaries Create a mapping from 3 character month name to month number Hint for example {‘jan’:1, ‘dec’:12} Ask the user for a 3 character month code lower /upper mixed Print the month number corresponding to month the user entered For example if the user enters ‘jul’, print 7 ) write a python program to un pair a tuple into several variables. ) write a python program to add an item to a tuple. ) write a python program to read list of integers from keyboard and display in tuple. ) Write a python program to reverse the tuple of strings. Write a Python program to implement the following using Functions. a) write a python program to add two numbers using recursion b) write a python program of the default arguments c) write a python program of the arbitrary arguments d) write a python program define a function called power2() which takes a single argument x but returns 2pow(x). e) write a python program to add two numbers using positional 45-50 arguments. f) write a python program to define a function call message which contain 2 positional 5.
Write a Python program to implement the following using
6. Datetime Module. a write a python program to print yesterday today tomorrow. 51-54 b) Write a python program to calculate the number of days between two given dates. c) Write a python program to print yesterday, today and tomorrow. d) Write a python program to convert given string into daytime object. S.No Page.No. Name of the Experiment Write a Python program to generate following using Random Module. a) write a python program to generate 5 random integers from given list of integers. b) write a python program to generate random integer between a. 5 to 50 excluding 50 7. b.-50 to 50 55-59 c. 5 to 50 with step of 3
c) write a python program to generate 6 digit random integers.
d) write a python program to generate a random password which means the following conditions. 1. Password length must be 10 characters long 2. It must contain 2 uppercase letters and one digit and one special symbol
e) Write a python program to shuffle the given elements in a list.
f)
g) h)
Write a Python program to implement following using Regular
Expression Module. a) write a python program to find all occurrence of a given string. b) write a python program to replace all occurrences of 5 with five for given string. c)write a python program to print all the elements that contain either 60-67 8. a or w. d) write a python program that matches the string has a followed by zero or more b’s. e) write a python program to replace all occurrences of spaces commas with underscore. f) write a python program to find all five character words in a given string. g) write a python program that matches the string with any no of occurrences of characters followed by s in a given string.
S.No. Name of the Experiment Page.No.
h) python program that matches the string with any characters by s in
a given string. i) write a python program that matches the string any no of i’s before s in a given string.
Write a Python program to implement the following using Files.
a) write a python program to create a file named bec.txt and write
some content into the file and display the content on the screen. b) write a python program to read the contents of file and display it 9. on the screen. 68-73 c) write a python program to create a file named bapatala.txt and write some content into to it then display no of words in a given file. d) write a python program to write some content on file bec.txt and count no of words start with s. e) write a python program to read and write from a text file bec.txt your function should find and display the occurrences of the word ‘the’. f) write a python program to count the number of lines from text file named bec.txt which is not starting with an alphabet ‘t’ or ‘T’. Write a Python program to implement the following using OOP Concepts. 10. a) write a python program to implement the stack using list 74-81 b) write a python program to implement the Queue using list