Guys, can anyone solve this question for me using python . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys, can anyone solve this question for me using python .

Write a Python program that displays a message as follows for a given number: If it is a multiple of 3, display "Zip" If it is a multiple of 5, display "Zap" If it is a multiple of both 3 and 5, display "Zoom" If it does not satisfy any of the above given conditions, display "Invalid"

27th Jan 2022, 5:22 AM
025-SAURAV SINGH
4 Answers
+ 5
It's just like FizzBuzz So I will request you to give us your try (atleast), so that we can see where you were wrong🙂. Without your try or attempt towards code problem we ain't gonna give you the solution 🙄. https://www.sololearn.com/discuss/1316935/?ref=app
27th Jan 2022, 6:00 AM
NEZ
NEZ - avatar
+ 2
Your logic is good and right but if you want the output as given in the description so you have to change the prompt while giving output like if the number is divisible by 3 and 5 so it will print 'Zoom' not 'zoom'...And so on Here is your corrected code (I just changed the prompts, nothing else) // a=int(input()) if a % 3 == 0 and a % 5 == 0: print ("Zoom") elif a % 3 == 0: print("Zip") elif a % 5 == 0: print("Zap") else: print("Invalid")
27th Jan 2022, 6:43 AM
NEZ
NEZ - avatar
+ 1
Thanks buddy, I will surely give a try🤗
27th Jan 2022, 6:04 AM
025-SAURAV SINGH
+ 1
a=int(input()) if a % 3 == 0 and a % 5 == 0: print ("zoom") elif a % 3 == 0: print("Zip") elif a % 5 == 0: print("zap") else: print(" Invalid number")
27th Jan 2022, 6:39 AM
025-SAURAV SINGH