Thursday 17 December 2020

Python: Comments

Comments are used to document your code. In python, any line that starts with # (hash symbol) is treated as comment.

 

comments.py


##############################
# Author: Krishna
# Date: 17-12-2020
# Description: Simple demo on usage of comments
##############################

# Person information
first_name = "Krishna"
last_name = "D"
age = 32

# Print person information
message1 = "Hi {} {}, you are {} years old".format(first_name, last_name, age)
print(message1)

 

Output

 

 

$python3 comments.py 
Hi Krishna D, you are 32 years old




Previous                                                    Next                                                    Home

No comments:

Post a Comment