How are basic operators used in Python?

1) Basic operators always compare things. Here are some examples. A lot are just math problems. We use a double equals sign to check if 2 things are equal to one another.

2) More practically using these basic operators can make your program more intelligent. For instance in this example I want to check if we have less school days than days of the year. If I put in the school days and year days in a variable when I compare them and print, it will give me a True or False.

3) Even more practical. Lets write a progam that tells you how many days off from school. Look at my variables, I am telling the first two how many days of school there are and days off. I am then using the "DaysOff" variable to subtract DaysOfYear from schoolDays. The result allows us to print the value and determine how many days off from school there are.

© 2020 Farragut Technology Program