0% found this document useful (0 votes)
5 views3 pages

Python Join and Replace Methods Explained

The document explains the Join() method, which is used to concatenate elements of an iterable with a specified separator, and provides examples of different iterables. It also describes the Replace() method for substituting a specified string with another in a given string, including its syntax and examples. Additionally, it includes homework questions related to the usage of these methods.

Uploaded by

rut3ndo05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Python Join and Replace Methods Explained

The document explains the Join() method, which is used to concatenate elements of an iterable with a specified separator, and provides examples of different iterables. It also describes the Replace() method for substituting a specified string with another in a given string, including its syntax and examples. Additionally, it includes homework questions related to the usage of these methods.

Uploaded by

rut3ndo05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Join() method

 Is used to join the elements of an iterable


 Syntax is [Link](iterable)
 An iterable is an object which is capable of returning it’s members one
at a time
 Example of iterables are list, dictionary, tuple ,set and string
 For example we have a list l1=[ f,a,s,t)

Example 2

l2=[ I, am , James]

Example 3

l3=[name, of, a, string]


Example 4

d=[name,: Adam, country ,:US]

Replace() method

 Is used to replace a specified string with another string


 Syntax is string. replace(oldstring,newstring,count)
 Example 1 “I love to eat bananas “

Example 2 a=” love to eat apples”


Homework

1. What is the output of “Neso3Academy3is3the3best3Academy”


[Link](3,””)

2. (1,2)

Can we use the join method without any space between them

Answer is YES

You might also like