IMPORTANT QUESTION PYTHON LAB 1
IMPORTANT QUESTION PYTHON LAB 1
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”
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:
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
Source code: create a text file as “input.txt” and write some date in it. This will be used in the
17. Write a program that inputs a text file. The program should print all of the unique words in the
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,
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.
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.
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
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