Python – List of Lists to List of Strings. How?

Coding Challenge 💬 Coding Challenge: Given a nested Python list, i.e., a list of lists. How to convert it to a string list, so that each inner list becomes a single string? Consider the following examples: 1. Input: [[‘h’, ‘e’, ‘l’, ‘l’, ‘o’], [‘w’, ‘o’, ‘r’, ‘l’, ‘d’]] Output: [‘hello’, ‘world’] 2. Input: [[‘h’, ‘i’], … Read more

How to Print Spaces in Python

Problem Formulation and Solution Overview This article will show various ways to print a single or multiple spaces in Python. Let’s say you have strings and would like to print them out to the terminal by placing a single or multiple spaces between them. 💬 Question: How would we write code to print spaces? We … Read more

Python – How to Find the Longest Substring in Alphabetical Order?

Programming Challenge 💬 Challenge: Given a Python string. Find the longest substring for which holds that all of its characters are in alphabetical order so that the first character comes earlier in the alphabet than the second character, and so on. Here are three examples: string: ‘helloworld’, longest substring: ‘ellow’ string: ‘abcde’, longest substring: ‘abcde’ … Read more