fb pixel

Comments

# Symbol is very special in Python. It shadows everything that comes after it on the same line. It basically tells Python to ignore everything that comes after the # symbol. It is especially useful for typing human-readable comments inside the code and explaining what each part does.
# This is a comment - this line will be ignored
name = input()   # Read the name
age = input()    # Read the age

# Now we will print everything
print(name, age, sep=' -- ')
# The end of the program
Python ignores all the blank lines. It also ignores all the lines that start with #. It also ignores all the text that comes after the # symbol.
 
# a = input()
print('hello')
This program will just print hello. It won’t get the input() as that line starts with a #, and therefore, is treated as a comment.
 

Challenge

Write a program that would print each day of the week on a separate line (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday) and write a comment next to each print statement indicating the number of that day (Monday - 1, Tuesday - 2, ... Sunday - 7).
 
To check your solution you need to sign in
Sign in to continue