Saturday, 3 August 2019

Assignment No: 16 Character Conversion UPPER to lower and lower to UPPER case

'''
Assignment No: 16
To copy contents of one file to other. While copying a) all full stops are to be
replaced with commas b) lower case are to be replaced with upper case c) upper case
are to be replaced with lower case.
'''

try:
fin = open("input.txt",'r') # file opening in read mode
fout = open("output.txt",'w') # file is created 

for line in fin:
line = line.swapcase() #Replace lower case with upper and upper with lower
line = line.replace(".","*") #Replace full stops with *
fout.write(line)
except:
print("File error occured")


54 comments:

  1. Very nice program and easy to understand

    ReplyDelete
  2. Easy to understand and explain easily in practical session

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. 🚩 सोपे आहे प्रात्यकशिक 🚩

    ReplyDelete
  5. I know where this file operation is used

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Program is showing indentation error in line 2

    ReplyDelete

Microsoft’s latest Surface Pro X is now available in India

  Microsoft Surface Pro X 2020 is now available in India at a starting price of Rs 1,49,999.  Here's everything you would like to unders...