PRINT function in python

王林
Release: 2024-07-17 11:34:57
Original
1102 people have browsed it

PRINT function in python

13-07-2024

PRINT() function

print() function is a function that allows us to output to the screen

The print() function has three different uses;

  1. Single quotes (' ')
  2. Double quotes (" ")
  3. Three quotes (“”” “””)-----------for multi line

we can use anyone type quote, cannot use different quote in same line

print()---------------------------#create empty line
Copy after login
print("jothilingam")--------------#string should print with""
Copy after login
print(5)------------------------#number can print without ""
Copy after login
print("jo""jo")--------------print without space
print("jo"+"jo")--------------print without space
answer    jojo
print("jo","jo")--------------print with space
answer     jo jo
Copy after login

print with f-strings

name = "jothi"
print(f"Hello {name}")
# Output : Hello jothi
Copy after login

newline escape character n

print("jo\nthi")
jo
thi
Copy after login

Parameters of the print() Function:

sepparameter

print("jo","jo",sep="_")...................sep="" is default
answer    jo_jo
Copy after login
print("jo", "lingam", sep='thi')
answer     jothilingam
Copy after login

endparameter

print("jothi",end="lingam")
answer  jothilingam
Copy after login
print("jothi",end="")----------------without space
print("lingam")
answer  jothilingam
Copy after login
print("jothi",end=" ")----------------with space
print("lingam")
answer  jothi lingam
Copy after login

* parameter

print(*"jothilingam")
answer    j o t h i l i n g a m
Copy after login

fileand flushparameters, since these parameters are the parameters that allow us to process the files

The above is the detailed content of PRINT function in python. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!