Consider 'y' being a number chosen by a user.
Using python conditional statements:
Note that you have to show the value of y and R in your printed output not the alphabetic y and R!
code:
# Reading input from user
y = int(input("Choose a number: "))
# modulus operator(%) is used to find the
remainder
# If the remainder is 0 when we divide the number with 7 then it is
multiple of 7
if y%7 == 0:
print(str(y)+" is dividable by 7")
else:
R = y%7
print(str(y)+" divided by 7 has a remainder of
"+str(R))
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.