×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python program for Zip, Zap and Zoom game

Zip, zap and zoom python program: Here, we are going to implement a python program for zip, zap and zoom game.
Submitted by Ankit Rai, on June 05, 2019

Problem statement

Write a python program that displays a message as follows for a given number:

  • If it is a multiple of three, display "Zip".
  • If it is a multiple of five, display "Zap".
  • If it is a multiple of both three and five, display "Zoom".
  • If it does not satisfy any of the above given conditions, display "Invalid".

Example

Consider the below example with sample input and output:

Input:
Num  = 9
Output : Zip

Input:
Num = 10
Output : Zap

Input:
Num = 15
Output : Zoom

Input:
Num = 19
Output: Invalid

Python program for Zip, Zap and Zoom game

# Define a function for printing particular messages
def display(Num):
    
    if Num % 3 == 0 and Num % 5 == 0 :
        print("Zoom")
        
    elif Num % 3 == 0 :
        print("Zip")
    
    elif Num % 5 == 0 :
        print("Zap")
        
    else :
        print("Invalid")
        

# Main code
if __name__ == "__main__" :
    
    Num = 9

    # Function call
    display(Num)
    
    Num = 10
    display(Num)
    
    Num = 15
    display(Num)

    Num = 19
    display(Num)

Output

Zip
Zap
Zoom
Invalid

Python Basic Programs »

Advertisement
Advertisement

Related Programs

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.