[go: up one dir, main page]

0% found this document useful (0 votes)
41 views4 pages

IMPORTANT QUESTION PYTHON LAB 1

Good for all college students

Uploaded by

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

IMPORTANT QUESTION PYTHON LAB 1

Good for all college students

Uploaded by

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

IMPORTANT QUESTION PYTHON LAB

1. Write a program to demonstrate different number data types in python

2. Write a program to perform different arithmetic operations on numbers in python.

3. Write a program to create, concatenate and print a string and accessing substring from a given

string.

4. Write a python script to print the current date in following format “Sun May 29 02:26:23 IST

2017”

5. Write a python program to create, append and remove lists in python

6. Write a program to demonstrate working with tuples in python

7. Write a program to demonstrate working with dictionaries in python

8. Write a python program to find largest of three numbers

9. Write a python program to convert temperature to and from Celsius to fahrenheit.

10. Write a python program to construct the following pattern using nested for loop: *

**

***

****

*****

*****

****

***
**

11. Write a python program to print prim numbers less than 20:

12. Write a python program to find factorial of a number using recursion:

13. Write a python program to that accepts length of three sides of a triangle as inputs. The

program should indicate whether or not the triangle is a rightangled triangle (use Pythagorean

theorem):

14. Write a python program to define a module to find Fibonacci Numbers and import the module to

another program

15. Write a python program to define a module and import a specific function in that module to

another program.

16. Write a script named copyfile.py. This script should prompt the user for the names of two text

files. The contents of the first the second file.

Source code: create a text file as “input.txt” and write some date in it. This will be used in the

program. with open("input.txt") as input:

with open("output.txt","w") as for line in input: output.

write(line) print("JOB DONE!!")

17. Write a program that inputs a text file. The program should print all of the unique words in the

file in alphabetical order

18. Write a Python class to convert an integer to a roman numeral

19. Implementing programs using Strings. (reverse, palindrome,)

20. Implementing programs using written modules and Python Standard Libraries (pandas, numpy.)

1. a) Write a Python program to generate Electricity Bill and develop a flow chart for the

same.

b) Develop a Python program to find the Biggest of 3 numbers using nested if...else

statement.

2. a) An integer, n, is said to be perfect when the sum of all of the proper divisors of n is

equal to n. For example, 28 is a perfect number because its proper divisors are 1, 2, 4,

7 and 14, and 1 + 2 + 4 + 7 + 14 = 28.


b) Develop a Python program to find whether the given number is Positive or Negative

using if statement.

3. a) Develop a Python program to read two numbers as input and Swap the Two

Numbers (using three variables). b) Develop a Python Program to read numerator and denominator
and print their

quotient and remainder. 4. a) write a program that accepts the lengths of three sides of a triangle as
input the

program output should indicate whether or not the triangle ,is right triangle(recall from

the Pythagorean theorem that in a right triangle ,the square of one side equals the sum

of the squares of the other two sides). b) Develop a Python program to find the sum of odd and even
numbers using for

statement.

5. a) Write a python program to get the 5 subjects marks and display the grade for the

same. b) Develop a Python program to swap two numbers (using two variables).

6. a) To write a python program to find the sum of first ‘n’ natural number.

b) Write a Python program to select a random element from a list, set, dictionary (value)

and a file from a directory. Use random.choice(). 7. a) write a program to create, concatenate and
print a string and accessing sub-string

from given string. b) Develop a Python program to check if the given string is palindrome or not.

8. a) Write a Python program to get a single string from two given strings, separated by a

space and swap the first two characters of each string. Sample input: 'abc', 'xyz'.

Expected Result : 'xyc abz'. b) Develop a Python program to find the biggest of 3 numbers using
nested if...else

statement

9. a) Code a Python program create a list from given list having number and its cube in

each tuple. b) Read two strings. Print the common characters in both the strings and the count of

them. 10. a) Write a Python program to Find the Duplicate Element from a List. b) Code a Program to
Python Find the 1st,2nd Largest Element in a List. 11. a) Write a Python program to unpack a tuple in
several variables and use + operations. b) Write a Python program to add an item in a tuple using
looping.

12. a) Code a Python Program to Find the Factorial of a Given Number Using Recursion.

b) Write a Python program to find the first repeated word in a given string.

13. a) Write a python program to remove duplicates from a list.

b) Write a python program to perform linear search


14. a) Code a Python program to accept a String , Reverse the String ,Check whether the

string is a Palindrome and print the result. b) Write a Python program to Count the number of Vowels
in a string. 15. a) Write a Python program to Find Most Frequent Words in a Text read from a File.

b) Write a Python program to find the Area of Shape.

Page 3 of 3

16. a) Write a program that Input a Text File. The program should print all of the unique

words in the file in Alphabetical order. b) Develop a Python program to find the average of Three
Numbers.

17. a) Write a script named copyfile.py. This script should prompt the user for the names

of two text files. the contents of the first file should be input and written to the second

file.

b) Develop a Python program to find the Sum of Digits in an Integer using While

Statement by getting the input from the user. 18. a) Develop a program for Voter’s age validity.
Validate using Exceptional handling

feature in python. ( Ex: age of the voter is > 18 or not).

b) Write a Python program to convert a tuple to a string.

19. a) Write a python class to reverse a string word by word.

b) A prime number is an integer greater than one that is only divisible by one and itself.

Write a function that determines whether or not its parameter is prime, returning True if

it is, and False otherwise.

20. a) Simulate Bouncing Ball Using Pygame

b) Write a Python program to remove Duplicates from a list.

You might also like