Reverse Words of any string – Python Code

A program in python that accept on a string from the keyboard and print the whole string in reverse order. It should not reverse the words, it should only reverse the order of these words. 

Hangman Game- Python Code

Hangman Game is a letter guessing game. In the game of Hangman, a clue word is given by the program that the player has to guess, letter by letter. The player guesses one letter at a time until the entire word has been guessed. (In the actual game, the player can only guess 6 letters […]

Cows and Bulls Problem – Python Solution

lets us program a game to play the “cows and bulls” with the user. The game works like this: Randomly generate a 4-digit number. Ask the user to guess a 4-digit number. For every digit that the user guessed correctly in the correct place, they have a “cow”. For every digit the user guessed correctly in the […]

List comprehension Problem- with Python Solution

Lets say you have a list stored in a variable a = [ 12,3,45,6,6,45,123,345,67,78,43,23,567,87,9,23,8,4]. You are required to write only one line of python code that is able to generate a new list that contains only even numbers. The simple iterative solution is like this # Program to find and display all the even numbers […]

Palindrome Program – multiple Python solutions

Palindrome Program – multiple Python solutions using python indexs and simple looping methods.

Common elements of Two list- Python Code

You are required to take two lists, say for example these two: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] and write a program that returns a list that contains only the elements that are […]

Search a Word in Text File – Python Way

Search a word in text File python way is our attempt to search any word in text file nbot using old fashion way like we do in C/C++. Only 4 line code was able to perform the task.

Frequency of element in a list using Dictionary

Suppose a list of number is available to you. you are requested to find out the frequency of these elements available in this list using a dictionary. Dictionary is a data type available in python that can contain unsorted items using keys. The combination of key and value define a dictionary. After the execution of […]