Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Power of Motivation

Rating
-
Sold
-
Pages
2
Uploaded on
27-12-2023
Written in
2023/2024

Python is an easiest chapter if you understand every steps then it will be easy

Institution
Course

Content preview

Learning Python Programming Language

In the previous video, we discussed the print function and how to print something on the console. We
also did a coding exercise related to the print function. Now, we will learn how to concatenate strings in
Python.



Printing with One Print Function

Instead of using three print functions to print three lines, we can use one print function with the slash n
symbol to add a new line:



Print(“hello world\nhello world\nhello world”)

We can also print “hello world” three times in different lines:



Print(“hello world\nhello world\nhello world”)

Concatenating Strings

To concatenate two strings, we can use the plus symbol:



Print(“hello” + “jenny”)

If we want to add a space between the two strings, we can use any of the following methods:



Add a space after “hello”: print(“hello “ + “jenny”)

Add a space before “jenny”: print(“hello” + “ jenny”)

Add a space in between: print(“hello” + “ “ + “jenny”)

However, we need to be careful when using spaces in Python. Adding a space or tab before writing the
code can cause an indentation error.



Indentation Error

If we add a space or tab before writing the code, we will get an indentation error:



IndentationError: unexpected indent

Print(“hello”)

Written for

Course

Document information

Uploaded on
December 27, 2023
Number of pages
2
Written in
2023/2024
Type
Class notes
Professor(s)
Kavin
Contains
For python students

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
kavinprabhupalanisamy

Get to know the seller

Seller avatar
kavinprabhupalanisamy Kpr
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions