This video is for beginners level Python programmers who just started to code in Python.
This video will show you different strategies to print in Python.
We all know about the print() function in Python. Using the print() function, we can print a message. For example, we can print using single quotation marks or double quotation marks-
print(“Python”) or
print(‘Python’)
However, there are several other things to consider when you are printing in Python.
Let's look at them one by one
1. Using double quotation when you have apostrophes to print
print(“X’s mission”)
2. Using single quotations when you have double quotations to print
print (‘“Run”, he said’)
3. Using concatenations (+)
4. Using print("your text", variable)
5. Using print(“your text”, end ="")
6. Using print(“your text”, end ="") (and variable converting to string or without converting to a string)
7. Using print("your text\n")
8. Using print()
9. Using print("text", variable+ variable)
Code Example:
print("Python")
print('Python')
print("X's mission")
print('"Run", he said')
a = 20
print("I am printing", a, end=". ")
print("I am printing this again")
price = 20
#price = str(price)
print("The price is $",end="")
print(price,"\n")
print()
print("1.Python\n2.Java\n3.C++\n4.JavaScript")
print("The price is",price+10)
En esta página del sitio puede ver el video en línea Various ways to use the print() function in Python de Duración hora minuto segunda en buena calidad , que subió el usuario KidzCode AI 09 octubre 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 100 veces y le gustó 4 a los espectadores. Disfruta viendo!