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?
Submitted by IncludeHelp, on August 06, 2019

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

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

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

# 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

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


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

Python Basic Programs »



Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.