Write a program to capitalize first letter of every word in a file in Python

First, read each line from the file and then use the title() function to capitalize each word in the line. Example program to capitalize the first letter of every word in a file in Python Simple example code takes the content of the file as input and Prints it after altering it. Output: Inside File.txt Read More…


Write a Python program to swap comma and dot in a string | Example

You can Swap commas and dots in a String using replace() function or Using maketrans and translate() functions in Python. Python program to swap commas and dots in a string Example Simple example code to swap comma and dot in a string. Using maketrans and translate() It should swap commas and dots in the given Read More…


Write a program to read a character in Uppercase and print it in lowercase in Python

Python has many methods to convert a character or string entered by the user from uppercase to lowercase. The best way is to use the lower() method. Example Program to read a character in Uppercase and print it in lowercase in Python Simple example code Uppercase to Lowercase using lower(). Where input string taking from Read More…


Write a Python program to count number of lowercase characters in a string take input from the user

Use the Input method to take a string from the user. Then user for-loop and check every character lowercase or not. Python program to count the number of lowercase characters in a string Example Simple example code to count the number of lowercase characters in a string. The for loop is used to traverse through Read More…


Write a Python program to remove duplicate characters of a given string

Use OrderedDict from collections module and join method to remove duplicate characters of a given string in Python. Python program to remove duplicate characters of a given string Example Simple example code. Output: Do comment if you have any doubts and suggestions on this Python char string program. RohitDegree in Computer Science and Engineer: App Read More…


Write a python program to find the first repeated character in a given string

Use enumerate function, for loop and if statement to find the first repeated character in a given string. Python program to find the first repeated character in a given string Examples Simple example code finds the character which occurs more than once. If there is no repeating character “None“. Output: Do comment if you have Read More…


Write a Python program to find the repeated character in a given string

It’s easy in Python to find the repeated character in a given string. There are many ways to do it like using alphabets, for-loop, or collections. Python program to find the repeated character in a given string Example Simple example code. Basic ways scan the string 26 times Output: Another way is only to go Read More…