Difference between revisions of "Print in Python"
Jump to navigation
Jump to search
(Created page with "-------------------------- source: https://www.w3schools.com/python/ref_func_print.asp") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Python print() Function | ||
+ | |||
+ | Print a message | ||
+ | |||
+ | print("Hello World") | ||
+ | |||
+ | Print more than one object: | ||
+ | |||
+ | print("Hello", "how are you?") | ||
+ | |||
+ | Print string and int in one line: | ||
+ | |||
+ | print("x:" + str(2)) | ||
+ | print("j:" + str(5)) | ||
+ | |||
+ | <syntaxhighlight lang="Python"> | ||
+ | |||
+ | import time | ||
+ | |||
+ | while True: | ||
+ | for x in range(6): | ||
+ | print("x = " + str(x)) | ||
+ | time.sleep(0.5) | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
-------------------------- | -------------------------- | ||
source: https://www.w3schools.com/python/ref_func_print.asp | source: https://www.w3schools.com/python/ref_func_print.asp |
Latest revision as of 14:13, 28 August 2024
Python print() Function
Print a message
print("Hello World")
Print more than one object:
print("Hello", "how are you?")
Print string and int in one line:
print("x:" + str(2)) print("j:" + str(5))
import time
while True:
for x in range(6):
print("x = " + str(x))
time.sleep(0.5)