Print()
- This is a function.
- Whatever you declare inside the print , it will be printed.
- Any number strings can be given inside.
Eg.,
- If there is a function then you can send n number of parameters.
- what is parameter here ? (a & b are the parameter ,its an example)
- sep ---> separator
- default value of sep is space , so you can see a space in the above screenshot result.
- printing to next line
- horizontal tab
String concatination
- 2 objects.
- what is objects ? CAR --> maruti , volvo ( these are objects )
End function
- when a sentence ends we can use that.
- Eg.,
Escape sequence
- see properly , these are used inside the double quotes.
Raw string
- slashes gets changed in windows , at that time you can use this.
- it will print whatever you give inside.
- see carefully the examples , the slash is missing in the first output so we are using "r".
Type Casting
- Trying to change the type of it so that it will work.
- Changed it.
Printing quotes inside the string
Triple quotes / Multi Line Strings
- it will print as its.
- eg.,
String Multiplication
Format
- variable assigment.
- Object & Methods.
- Object will have many methods.
- get all methods for the object , by using below.
- I used type casting here, but the usage of this will not be coding method but its not wrong.
- Using method we can get the output.
- Its taking care the typecasting on its own.
- Using positioning or indexing we can pass the value.
F string format
Notes
- In print statement we are using both numeric & also string --> the output will always be STRING. So in a nutshell , anything which is coming out of print statement is STRING.
- In other words , return type of print function is STRING.
- String will always be in double quotes.
Top comments (0)