Python program to print given text using a user-defined method

Printing text using a user-defined method: Here, we are going to learn how to define a user-defined method, we are implementing a method that will accept a text/string and print it through the method? By IncludeHelp Last updated : April 08, 2023

Print string using UDF

The task to create a user-defined method and we have to pass a text/string that should be printed on the screen.

Python program to print text/string using user-defined method

In this program, we are defining a method named putMe() it will accepts a string/text and print it on the screen using print() method in Python.

# Python code to print text/string using 
# user-defined method

# function defintion of "putMe()"
# it will accepts a string and print it on the screen
def putMe(text):
    # printing text on the screen
    print(text)

# main code
if __name__ == '__main__':
    putMe('Hello world!')
    putMe('Welcome @')
    putMe('IncludeHelp')
    putMe('The world of programming')
    putMe('A programming community for developer and students')

Output

Hello world!
Welcome @
IncludeHelp
The world of programming
A programming community for developer and students

Python Basic Programs »


Related Programs

Comments and Discussions!

Load comments ↻






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