x=int("int" integer x=")
if x%5==0 and x%4==0: print ("multiple of 20") elif ~x%4==0 and x%5==0: print ("multiple of 5) elif ~x%5==0 and x%4==0: print ("multiple of 4") else: print("Bad Guys")
input()
If you type 5 here, you want the text to be multiples of 5 These guys are coming out. ㅠ 4 In the case of 4 or 20, it comes out accordingly, but in the case of 812, it doesn't print out properly. What's the problem...?
python
Hi, how are you?
I think you expressed the case where x is not divided by 4 as ~x%4 == 0
. Python's ~
is a bit operator, so you won't get the result you want.
I think if you fix the code a little bit like this, you'll get the desired result.
if x%5==0 and x%4==0:
print ("multiple of 20")
elif x%4!=0 and x%5==0:
print ("multiple of 5)
elif x%5!=0 and x%4==0:
print ("multiple of 4")
else:
print ("You guys, you guys, you guys are so weird")
© 2024 OneMinuteCode. All rights reserved.