q = int(input("How many numbers do you need to check? "))
dt = 0
ndt = 0
for i in range(q):
w = int(input("Enter number: "))
if w % 3 == 0:
print("{} is divisible by 3.".format(w))
dt = dt + 1
else:
print("{} is not divisible by 3.".format(w))
ndt = ndt + 1
print("You entered {} number(s) that are divisible by 3".format(dt))
print("You entered {} number(s) that are not divisible by 3".format(ndt))
I'd like my ask the user to "Enter number" and then after it'll subsequently answer if it divisible by three or not.
Ex:
"Enter number: 6"
"6 is divisible by 3"
"Enter number: 9"
"9 is divisible by 3"
"Enter number: 11"
"11 is not divisible by 3"
"You entered 2 number(s) that are divisible by 3"
"You entered 1 number(s) that are not divisible by 3"
I truly haven't really tried anything.
if/elseblock so that it is in theforloop. Right now you are only running it after theforloop finishes.