Control Flow and Composite Data Types in Python
1. Strings
1.1 Using the format() Method to Format Strings
Use the format() method to format strings with the following syntax:
string_to_format.format(real_data1, real_data2, ...)
Description:
The string to be formatted uses {} as placeholders for the actual data.
Example 1:
name = 'Alice'
template = 'Name: {}'
print(template.format(name))
...
Posted on Mon, 21 Sep 2026 16:13:14 +0000 by shmony
Core Python Data Types, String Manipulation, and Foundational Exercises
The in and not in Membership Operators
These operators verify weather a substring or element exists within a sequence. in returns True when the target is found, while not in returns True when the target is absent.
username = "alexander"
if "alex" in username:
print('Substring located')
else:
print('Substring missing' ...
Posted on Sun, 13 Sep 2026 16:06:09 +0000 by Unholy Prayer
Essential JavaScript String Methods for Text Manipulation
Locating Substrings
To find the position of a specific character or sequence within a string, use indexOf(). This method returns the index of the first occurrence or -1 if the value is not found.
const message = "Learn, build, and share";
// Finding the first occurrence of 'b'
const firstB = message.indexOf("b"); // returns ...
Posted on Tue, 25 Aug 2026 16:05:00 +0000 by feddie1984
Comprehensive Guide to JavaScript String Methods
Character Access
The charAt() method retrieves the character at a specific index position. Modern JavaScript also supports bracket notation for the same purpose.
const text = 'developer';
console.log(text.charAt(0)); // 'd'
console.log(text[0]); // 'd' (equivalent)
// charCodeAt() returns the Unicode code point
console.log(text.charCod ...
Posted on Sun, 14 Jun 2026 17:52:59 +0000 by jpraj