Day: January 12, 2021

Python Examples for Beginners: Python Code to Sort Words in Alphabetic Order

(Python Tutorials for Citizen Data Scientist) Python Code to Sort Words in Alphabetic Order In this program, you’ll learn to sort the words in alphabetic order using for loop and display it. In this example, we illustrate how words can be sorted lexicographically (alphabetic order). Source Code # Program to sort alphabetically the words form …

Python Examples for Beginners: Python Code to Remove Punctuation From a String

(Python Tutorials for Citizen Data Scientist) Python Code to Remove Punctuation From a String This program removes all punctuation from a string. We will check each character of the string using for loop. If the character is a punctuation, empty string is assigned to it. Sometimes, we may wish to break a sentence into a …

Python Examples for Beginners: Python Program to Multiply Two Matrices

(Python Tutorials for Citizen Data Scientist) Python Code to Multiply Two Matrices In this example, we will learn to multiply matrices using two different ways: nested loop and, nested list comprehension. In Python, we can implement a matrix as nested list (list inside a list). We can treat each element as a row of the …

Python Examples for Beginners: Python Code to Add Two Matrices

(Python Tutorials for Citizen Data Scientist) Python Code to Add Two Matrices In this program, you’ll learn to add two matrices using Nested loop and Next list comprehension, and display it. In Python, we can implement a matrix as a nested list (list inside a list). We can treat each element as a row of …