×

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 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 »

Advertisement
Advertisement

Related Programs

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

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