python开立方函数_Python | 编写函数以查找给定数字的平方和立方

本文介绍了如何在Python中编写用户定义的函数,用于计算给定数字的平方和立方。通过示例展示了具体实现,并给出了程序的输出结果。
摘要由CSDN通过智能技术生成

python开立方函数

Given a number, and we have to write user defined functions to find the square and cube of the number is Python.

给定一个数字,我们必须编写用户定义的函数来查找数字的平方和立方是Python。

Example:

例:

    Input:
    Enter an integer number: 6

    Output:
    Square of 6 is 36
    Cube of 6 is 216

Function to get square:

获得平方的函数:

def  square (num):
	return (num*num)

Function to get cube:

获取多维数据集的功能:

def  cube (num):
	return (num*num*num)

Program:

程序:

# python program to find square and cube
# of a given number

# User de
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值