Professional Documents
Culture Documents
Comp m2
Comp m2
India is the fastest-growing economy. India is looking for more investments around
the globe. The whole world is looking at India as a great market. Most of the Indians
can foresee the heights that India is capable of reaching.
Program (count-word.py)
def count_word():
file = open('india.txt','r')
count = 0
file.close()
>>> random.seed(100)
...
>>> actual_value
96.45273913513529
>>> truncated_value
0.239
24. Write a program to create a triangle of stars using nested loop.
size = 7
m = (2 * size) - 2
print(end=" ")
m=m-1
print(" ")
1. Write a function DISPLAYWORDS () in python to read lines from a
text file STORY. TXT (), and display those words which are less
than 4 characters.
Remove all the lines that contain the character ‘a’ in a file and write it to
another file
1. Create a binary file with roll number, name and marks. Input a roll
no. and update the marks.
1. Write a random number generator that generates random numbers
between 1 and 6 (simulates a dice).
1. Create a CSV file by entering user-id and password, read and search
the password for the given user-id.
1. Write a program that display first ten Mersenne numbers.