Skip to playerSkip to main content
  • 1 year ago
String concatenation refers to the process of combining two or more strings into a single string. It can be done by either appending one string to another or creating a new string that contains the original strings in sequence.

Category

📚
Learning
Transcript
00:00Welcome back and good morning guys and girls.
00:06Last few lectures in the last few lectures,
00:08we had a basic level of concepts
00:12and the tool we used was more than sufficient.
00:17Now we have a new tool to change the level of concepts.
00:21Let's go to a new tool
00:23which is called repl.it
00:25You can use it straight away.
00:27Click on start coding
00:29and here you choose your interpreter.
00:32Python coding programming
00:33and create repl
00:35and you will be good to go.
00:36Otherwise,
00:37you can create your account
00:39using sign up
00:41or sign up
00:43login
00:44and you will be good to go.
00:46This is a data science.university account
00:48Let's get started.
00:50First of all, we have a new repl.
00:52Let's create a new repl.
00:54It's totally easy peasy.
00:56You can choose random name
00:58and we will let it be like this.
01:00Okay guys.
01:01Now,
01:03let's talk about advanced concept.
01:06Advanced concept
01:07Not very advanced
01:09but let's start from the baby steps.
01:13The first thing we have discussed is
01:16string concatenation.
01:18Okay.
01:19Now, I will say
01:20string concatenation.
01:21Okay.
01:22Now,
01:23I will say
01:24string concatenation.
01:26Oh,
01:27catenation.
01:28Okay.
01:29Okay.
01:30Okay.
01:31Now,
01:32we have a concept
01:33and then,
01:34I will show you
01:35this example.
01:36String concatenation
01:37means that
01:38two strings
01:39together.
01:40Okay.
01:41And this is like
01:42glue with two pieces
01:43together.
01:45Okay.
01:46Then,
01:47weld and metal
01:48together.
01:49Now,
01:51Python
01:52concatenation
01:53string
01:54perform
01:55for
01:56addition
01:57which is
01:59which is
02:00plus
02:01sign.
02:02For example,
02:03let's say
02:04Hola.
02:05Hello.
02:06Plus
02:07and
02:09Watson.
02:10Now,
02:11this case
02:12which is
02:13basically
02:14string
02:15concatenation
02:16used
02:17and
02:18arithmetic
02:19operator
02:20use
02:21which is
02:23important
02:24point
02:25you have to
02:26ask.
02:27What is
02:28operator overloading?
02:29Operator overloading
02:30classical
02:31example
02:32string
02:33concatenation.
02:34Operator overloading
02:35means that
02:36one operator
02:37is more
02:38working.
02:39Now,
02:40plus
02:41normal
02:42is
02:43two
02:44things
02:45add.
02:46However,
02:47now,
02:48this
02:49is
02:50operator
02:51overloading.
02:52If you have
02:53asked me,
02:54you can tell me.
02:55Now,
02:56I will print it.
02:57Now,
02:58I will print it.
02:59Now,
03:00I will print it.
03:01So,
03:02we will get
03:03hello
03:05motion.
03:06We will run it.
03:08And
03:09we will get
03:10hello motion.
03:11This is so cool.
03:12We will run it.
03:13Now,
03:14we will run it.
03:15We will run it.
03:16Now,
03:17we will run it.
03:18the same.
03:19However,
03:20interesting enough,
03:21that
03:22I will run it.
03:23Now,
03:24I will remove it.
03:25Now,
03:26I will remove it.
03:27Now,
03:28I will write it.
03:29Now,
03:30I will write it.
03:31Now,
03:32I will write it.
03:33Name is equal to motion.
03:34Now,
03:35I will write it.
03:36However,
03:37I will write it.
03:38Now,
03:39I will run it.
03:40The result will be exactly the same.
03:41However,
03:42interesting enough,
03:43I will write it.
03:44Now,
03:45I will write it.
03:46Now,
03:47I will write it.
03:48Now,
03:49I will write it.
03:50Now,
03:51I will write it.
03:52Hello,
03:53John.
03:54Now,
03:55I will write it.
03:56Hello,
03:57Sally.
03:58This is totally fine.
03:59Cool.
04:00Now,
04:01I will write it.
04:02Now,
04:03I will write it.
04:04Now,
04:05let's say,
04:06you have a e-commerce store.
04:08And,
04:09you have a customer's greeting messages.
04:11And,
04:12let's say,
04:1310,000 customer.
04:15Now,
04:1610,000 customer's name
04:17you can't change.
04:19The best way will be?
04:21Now,
04:22why will be customer's name
04:23enter product
04:24during the time
04:25and send us the name
04:27to the user from input.
04:29Interesting.
04:30So,
04:31you will have input function
04:33to use input.
04:34It is just like that.
04:35However,
04:36this allows you to say
04:37that input function
04:38has prompted
04:39को कि बताना भी है एक guidance text भी देना है साथ में विसाल के तोर पे आप किसी conference में जाते हैं आप किसी नई building में जाते हैं तो वहाँ पे signs लगे होते हैं न वी toilet to the left, conference room to the right, ऐसे ही है न वो guidance post होती है तो यहाँ पर भी ऐसे आप guidance post देते हैं कहते हैं please enter your name, सही है यह देखिए, enter your name
05:09prompt होगा, enter your name, और जो value आप assign करेंगे, वो input function को use करते हुए name को assign हो जाएगी, make sense, अब जर आपने गवर करना है, अगर मैं इसको run करता हूँ, तो code आगे नहीं जाएगा, जब तक मैं उसको कोई value नहीं दे देता, अब देखिए, यहाँ पर कहता हूँ john, ठीक है, run किया, hello john,
05:39मुझे पता है, आपको पता है, क्योंकि आपने code देखा हुआ है, कि यहाँ पे तो मैंने input करना है name, however, एक user को idea नहीं है, कि यहार उसने क्या करना है यहाँ पे, एक नया बंदा, जो कि आया आपकी, let's say website के उपर और और इस तरह की screen देखी, what should he do, he have no clue, इसलिए, it's a very good idea, क
06:09अब आपने गवर करना है, कि अगर input पे, जैसे कि मैंने आपको example दी, कि concatenation ऐसा है, जैसे दो metals को आपस में weld करना, आप एक लकडी के फटे को और steel के rod को weld नहीं कर सकते, क्योंकि वो different materials हैं, make sense कभी आपने notice किया यह, कि आप एक लकडी को और एक लोहे को आपस में weld नहीं कर
06:39same way, आप एक number को और एक string को concatenate नहीं कर सकते, मिसाल के तोर पे आपने भी यह जरा गवर करना है, मैं run करता हूँ, और मैं कहता हूँ, मेरा नाम जो है, इस दफ़ा 5 है, ठीक है, 5 क्या है, एक number है, मैं इसको run करता हूँ, and you see, वो कह रहा है, hello 5, अब जरा आपने गवर करना ह
07:09और कहें, टाइप, टी वाई पी टाइप, टी वाई पी टाइप, ठीक है, और नेम की जो टाइप है, वो बताओ, ठीक है, अच्छा, अब जरा इंटर करते हैं, दोबारा, मैं कहता हूँ, 5 इंटर किया, ये क्या बात हुई, मैंने तो 5 as a number इंटर किया था, और जब मैं इस
07:39है, कि यहां पर type conversion हो रही है, यह जो input function है, यह मुझ से पूछे बगाएर 5 integer को लेता है, और उसको string में convert कर देता है, तो this is very important point, कि जब आप input लेंगे user से, या कोई game खेल रहे हैं, या कोई और application बना रहे हैं, तो user से जब आप input लेंगे, तो आपने make sure करना है, कि वो basically सही data type
08:09return कर रहा है, as a string 5, अब जरा आपने घौर करना है, अगर मैं यहां पर simple directly 5 लग देता हूँ, अब यहां पर तो number यह है, यह तो number है, यह तो convert होके नहीं आ रहा है, अच्छा, मैं इस तरह करता हूँ, कि इन दो को, इन तीनों को, ठीक है, इन दोनों को, मैं comment out कर देता हूँ,
08:39only can concatenate string not integer to string, यानि कि वो कह रहा है, कि मैं string को string के साथ जोड सकता हूँ, यानि कि मैं metal को metal के साथ जोड सकता हूँ, मैं लकडी और metal को नहीं जोड सकता आपस में, तो आपने इस चीज का ध्यान रखना है, however, जब यह आप गुजारते हैं input function से, तो यह integer जो है, वो automatically एक string मे
09:09from the

Recommended