python 定义文本_Python程序使用用户定义的方法打印给定的文本

python 定义文本

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.

在下面的程序中,我们定义了一个名为putMe()的方法,它将接受字符串/文本,并使用print() python在屏幕上打印该方法。

使用用户定义的方法打印文本/字符串的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
    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


翻译自: https://www.includehelp.com/python/print-given-text-using-a-user-defined-method.aspx

python 定义文本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值