Monthly Archives: March 2020

Find Occurrences of Each Word in Text File Python Program

Topic: Write a Python Program to Find Occurrences of Each Word in Text File Python Program Source Code : Python Program using Text File # Python program to count # number of occurences / frequencies of words in a text # Input filename, open it in # read mode. display its cntents # count and… Read More »

Count Words in Each Line of Text File Python

Topic: Count Words in Each Line of Text File Python Program   # Python program to count # number of words in each line of a text file separately # Input filename, open it in # read mode. display its cntents # count and display number of words # www.EasyCodeBook.com file_name = input(“Enter file name:”)… Read More »

Python Count Words in Text File

Topic: Count Words in Text File Python Program # Python program to count # number of words in a text file # Input filename, open it in # read mode. display its cntents # count and display number of words # www.EasyCodeBook.com file_name = input(“Enter file name:”) file1 = open(file_name, “r”) word_count = 0 print(“Contents… Read More »

Count Lines in Text File Python Program

Topic: Count Lines in Text File Python Program # Python program to count # number of lines in a file # Input filename, open it in # read mode. display its cntents # count and display number of lines # www.EasyCodeBook.com file_name = input(“Enter file name:”) file1 = open(file_name, “r”) line_count = 0 print(“Contents of… Read More »

Python GUI Find Factorial by Recursive Function

Topic: Find Factorial by Recursive Function Python GUI Program   # Python GUI program Find Factorial # of a Number by Recursion # Input a number and show its factorial # using a user defined recursive factorial function # www.EasyCodeBook.com from tkinter import * def inputn(): n= int(entry.get()) # call recursive_factorial function fact= recursive_factorial(n) str1… Read More »

Python GUI Multiplication Table

Topic: Multiplication Table Python GUI Program Python GUI Multiplication Table # Python GUI program Multiplication Table # Input a number and show its multiplication table # from 1 to 10 # www.EasyCodeBook.com from tkinter import * def show_table(): num = int(entry.get()) str1=’ Table of ‘ + str(num) + ‘\n—————–\n’ for i in range(1,11): str1 =… Read More »

Python GUI Area of Triangle

Topic:Python GUI Program Area of Triangle with base and height # Python GUI Program to calculate # Area of a Triangle # When base and height given # www.EasyCodebook.com from tkinter import * def calculate_area(): base = float(entry1.get()) height = float(entry2.get()) area = 1 / 2 * base * height output_label.configure(text = ‘ Area of… Read More »

Python GUI Temperature Conversion Program C To F

Topic: Python GUI Temperature Conversion Program Celsius to Fahrenhiet # Python GUI program Temperature conversion # Celsius to Faherenheit # Input Celsius, Find Fahrenheit # www.EasyCodeBook.com from tkinter import * def convert_temperature(): temp = float(entry.get()) temp = 9/5 * temp+32 output_label.configure(text = ‘ Converted to Fahrenheit: {:.1f} ‘ .format(temp)) main_window = Tk() main_window.title(“www.EasyCodeBook.com”) message_label =… Read More »

Python GUI Program Temperature Conversion Fahrenheit to Celsius

Topic: Python GUI Program Temperature Conversion Fahrenheit to Celsius # Python GUI program Temperature conversion # Faherenheit to Celsius # Input Faherenheit Find Celsius # www.EasyCodeBook.com from tkinter import * def convert_temperature(): temp = float(entry.get()) temp = (temp – 32) * 5/9 output_label.configure(text = ‘ Converted to Celsius: {:.1f} ‘ .format(temp)) main_window = Tk() main_window.title(“www.EasyCodeBook.com”)… Read More »

Python Program To Print a to z using for loop and chr function

Topic: Python Program To Print a to z using for loop and chr() function We will use the built-in Python function chr() to print the small alphabets from a to z. We know that the Ascii code of ‘a’ is 97 and that of ‘z’ is 122. Therefore we will use a range() function in… Read More »