PRESENTATION 1 - GLOBAL SUSTAINABILITY CHALLENGES.pptx
Exp 6.2 d-422 (1)
1. Name of Students Omkar Rane
Roll No D422
Batch D1
Experiment No EX-6-2
Title of Experiment
EX-6.2: Choose the words from the file, store in the list
and sort the list is ascending order.
Write An Algorithm:
Step1) start
Step2) let word =[] # empty list
Step3) use open(“h.txt”,”r”)
Step4) use a=h.read()
Step5) word=a.split() # splitting function
Step6) display word
Step7) word.sort() # sorting function
Step8) Display word
Step9)stop
Paste Your Python Program ( Python Code):
word=[] # define empty list
h=open("h.txt","r") # open function
a=h.read() # read function
word=a.split() # split
2. print word,"Unsorted list"
word.sort() # sorting
print word,"this is required sorted list"
Paste Your Program OUTPUT :
>>>
['C++', 'C', 'C#', 'Ruby', 'perl', 'Basic', 'pascal', 'cobol', 'python', 'Assembly'] Unsorted
list
['Assembly', 'Basic', 'C', 'C#', 'C++', 'Ruby', 'cobol', 'pascal', 'perl', 'python'] this is
required sorted list
>>>