Python comments

 Python Comments

# - This is comment symbol which is used for python. It means these lines will not execute as it is a comment.

Example:
# Going to print Hello World!

print("Hello World!")

Other ways to give a comments in python.

# Multi line comment
# second line
# Third line.

Same can be done by using 
"""
Any thing written under it will be considered as comments.
check it by yourself.
"""

Assignment as example:
Have $50 to purchase a thing and you have purchased an item of $15 and it has 3% tax on it. So now tell how much money is left with you?

#Code

"""
Writing this code to solve the problem. Please find complet question below:
Problem:
Have $50 to purchase a thing and you have purchased
an item of $15 and it has 3% tax on it. So now tell
how much money is left with you?
"""

amount = 50
cost = 15
tax_rate = 0.03
tax = cost * tax_rate
price = cost + tax
remaining_amount = amount - price
print("The remaining amount is", remaining_amount)
# print("The remaining amount is", amount - (cost + cost * tax_rate))


Comments

Popular posts from this blog

Path Parameter Data Validation | Query Parameter Data Validation

CRUD Assignment

Python Variables