Last active
January 19, 2021 22:56
-
-
Save sojohnnysaid/ae2f621e25374f5865ebff36ee8572a4 to your computer and use it in GitHub Desktop.
python operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cs50 import get_int | |
# prompt the user for a number | |
x = get_int("Enter a number: ") | |
# perform arithmetic | |
#addition | |
print(f"{x} plus {x} is equal to {x + x}") | |
#subtraction | |
print(f"{x} minus {x} is equal to {x - x}") | |
#multiplication | |
print(f"{x} times {x} is equal to {x * x}") | |
#division | |
print(f"{x} divided by {x} is equal to {x / x}") | |
#floor-division | |
print(f"{x} floor-divided by {x} is equal to {x // x}") | |
#remainder | |
print(f"remainder of 100 divided by {x} is {100 % x}") | |
print(type(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment