Skip to content

There is a need to design and code a python program that will take as input a text file having readable characters inside it and scramble the lines along with the words but keeping the original position of the start letter and ending letter of each word.

Notifications You must be signed in to change notification settings

devRG7/Python---Scrambling-of-words-in-a-Text-file

Repository files navigation

Python---Scrambling-of-words-in-a-Text-file

This assignment which was given for the Programming and Problem solving concept was really very challenging and tough. But after analyzing and understanding each function and what it required as parameters, it was then possible to design and make it. Still the main function scramble_word(word_str) was not successful as expected since I was not able to include punctuation inside the function. Time was very limited taking into consideration that as a working person in a much demanded company where my presence is utmost important for urgent problematic solving and analysis. But still I was able to present a program instead of nothing. The program required several python chapters understandings where the acquired knowledge was very important to be applied. Overall I am very pleased with the programing since I am at a very beginner level and I was able to present this program and its source code together with this document.

There is a need to design and code a python program that will take as input a text file having readable characters inside it and scramble the lines along with the words but keeping the original position of the start letter and ending letter of each word.

An Example of the input: The purpose of the program is to shuffle only the middle letters of each word in a sentence, leaving it still readable like this

An Example of the output: The psrpoue of the paogrrm is to sufhlfe only the mddlie lrettes of ecah wrod in a snceente, lianveg it sitll rbdlaeae like this

The programs should be coded by making use of: random, string, lists and files in python.

Program Design

image

PseudoCode

image

FlowCharts

image image

Description of Each Function

image image

Critical Appraisal

The main functions of the program was as follows:

 Take each line from a text

 Convert it into a list

 Take each word from the list

 If word<3 ignore the words else take the word and keep 1st and last alphabet from word unchanged

 From the remaining of the word, the middle part of it, a function implemented to shuffle the middle string and return back the shuffle string.

 From each shuffle string, join back the word with the 1st and last alphabet to re construct the word and assigned it to a list

 Word from list Is then joined to make the sentence back

 Same is written into an output text with the scrambled words in the sentences

image

About

There is a need to design and code a python program that will take as input a text file having readable characters inside it and scramble the lines along with the words but keeping the original position of the start letter and ending letter of each word.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages