python operators
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