Skip to content

A program to calculate the cost of converting a string either to consonants or to vowels. And the cost calculation is something like 1 Coin for one conversion.

Notifications You must be signed in to change notification settings

tejamaddimsetty/Python-String-Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Python-String-Manipulation-Example

Concepts involved are : Consonants, Vowels, Functions in Python, Lists in Python

Problem Statement:

Write a Python program to traverse a string to an consonant or an ovel by following the below instructions.

  • You need to start traversing from index k till end of string and then you can traverse back from end to beginning.
  • At index k you need to check if the character is vowel or consonant.
  • If it vowel you need to convert it into any consonant and vice versa and according you need to convert entire string into one kind of characters i.e vowels or consonants.
  • Now the cost of moving from one index to next index is 1 coin and cost of converting a character into another character is also 1 coin.
  • Output should be total cost to get desired output string.

Sample Input Information

Sample Input: aeioaaeiou.

image

Warning!

I picked another Input VIJAYAWADA. But process never stops because this string has Consonant, Vowel and so on. Now the program runs life time or may be breaks at a point 2^n with an error.
So if you want to look out possible output please enter the Sample Input Information.

About

A program to calculate the cost of converting a string either to consonants or to vowels. And the cost calculation is something like 1 Coin for one conversion.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages