String - A string is a sequence of characters enclosed in single (' '), double (" "), or triple (''' or """) quotes. In Python, strings are used for text and can be manipulated in various ways., Indexing - Indexing refers to accessing individual characters in a string or elements in a sequence (e.g., a list) by their position. In Python, indexing starts at 0, String Concatenation - String concatenation is the process of combining two or more strings to create a new string. It can be done using the + operator., String Slicing - String slicing allows you to extract a portion of a string by specifying a range of indices. It is done using square brackets and colons, like string[start:end]., String Length - The length of a string is the number of characters it contains. You can find the length of a string using the len() function., String Functions - There are built-in functions in Python that allow you to perform various operations on strings, such as converting to uppercase, lowercasing, and searching for substrings., 1D Array (List) - A 1D array in Python is also known as a list. Unlike a Python List, an array is a collection of elements that are of the same data type. Arrays and Lists are stored in a linear sequence and accessed using indices., Array Indexing - Array indexing allows you to access individual elements in a list by their position. Similar to strings, list indexing starts at 0., Array Length - The length of an array is the number of elements it contains. You can find the length of a list using the len() function., Append - The append() function is used to add an element to the end of a list. It is commonly used to build lists dynamically., Iterating an array or string - Iteration is the process of looping through the elements of a string or a list. It allows you to perform actions on each element one at a time., String vs. List - Strings and lists are both sequences in Python, but strings contain characters, while lists can contain elements of various data types. Understanding the differences between them is important for effective programming.,
0%
N5 Revision - Strings and 1D arrays
共用
共用
共用
由
Mrscalderwood
編輯內容
列印
嵌入
更多
作業
排行榜
快閃記憶體卡
是一個開放式範本。它不會為排行榜生成分數。
需要登錄
視覺風格
字體
需要訂閱
選項
切換範本
顯示所有
播放活動時將顯示更多格式。
打開結果
複製連結
QR 代碼
刪除
恢復自動保存:
?