Python: Perform an action if a condition is true
Python Basic: Exercise-89 with Solution
Write a Python program to perform an action if a condition is true.
Given a variable name, if the value is 1, display the string "First day of a Month!" and do nothing if the value is not equal.
Python Code :
n=1 if n == 1: print("\nFirst day of a month") print()
First day of a month
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.