Conversation
This file contains string operations encompasses fundamental concepts and methods essential for effective string manipulation in Python., including -Methods for iterating over strings -Repetition and concatenation operators -Strings as immutable objects -Slicing strings and testing strings -String methods- -Splitting a string
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
nikshepkulli
reviewed
Feb 9, 2024
| @@ -0,0 +1,360 @@ | |||
| { | |||
There was a problem hiding this comment.
Owner
Author
There was a problem hiding this comment.
Hello Professor,
Added another file with requested comments under the name of ClassWork 01.ipynb
This file contains string operations encompasses fundamental concepts and methods essential for effective string manipulation in Python., including -Methods for iterating over strings -Repetition and concatenation operators -Strings as immutable objects -Slicing strings and testing strings -String methods- -Splitting a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This file contains string operations encompasses fundamental concepts and methods essential for effective string manipulation in Python., including -Methods for iterating over strings
-Repetition and concatenation operators
-Strings as immutable objects
Repetition and concatenation operators are both used for manipulating strings in Python, but they serve different purposes:
Repetition Operator (*)
Function: Repeats a string a specified number of times.
-Slicing strings and testing strings
Slicing lets you grab specific parts of a string like picking from a slice of pie. You use square brackets with start and end positions to extract the portion you need.
Testing strings involves checking if a substring exists within another string. Imagine searching for a word in a sentence. Python's "in" operator acts like a detective, finding the presence (or absence) of the target word.
-String methods-
String methods are like tools in a text toolbox. They help you manipulate strings in Python. Slicing lets you cut out pieces, like taking a slice of bread. Concatenation joins strings, like building a sandwich. Iteration lets you loop through each letter, like examining each ingredient. Testing with "in" checks for words, like finding cheese on your sandwich. There are many more methods for searching, replacing, and formatting text, giving you ultimate control over your strings!
-Splitting a string - Splitting a string is like dividing a pizza into slices. You use the split() method with a separator (like a comma or space) to chop the string into a list of pieces. By default, it splits on whitespace, creating a list of words. You can customize the separator to target specific characters or patterns, allowing you to break the string down into exactly the pieces you need.