Tags
python
Asked 3 years ago
30 Jul 2021
Views 316
Frederik

Frederik posted

How do I write a simple Python program ?

How do I write a simple Python program ?
shyam

shyam
answered Jul 30 '21 00:00

Python simple program is print some string by print() function
a.py

print("Hi this is a simple example for Python program")


run code at terminal by

python a.py


or


python3 a.py


it will print simple string at terminal which is Hi this is a simple example for Python program


FYI: single quote, double-quote or triple quote enclosed string with print() function give you the same string as output in the above example
single-quote enclosed string :
print('Hi this is a simple example for Python program')
double quote enclosed string :
print("Hi this is a simple example for Python program")
triple quote enclosed string :
print('''Hi this is a simple example for Python program''') or print("""Hi this is a simple example for Python program""")

all above codes have the same output:
Hi this is a simple example for Python program
Post Answer