764 · 计算圆周长和面积

描述
给定一个整数r代表一个圆的半径。
你的任务是返回一个数组。
其中数组的第一个元素代表圆的周长,数组的第二个元素代表圆的面积。

PI = 3.14

样例
样例 1:

输入 : r = 2
输出 : [12.56, 12.56]

class Solution:
    """
    @param r: a Integer represent radius
    @return: the circle's circumference nums[0] and area nums[1]
    """
    def calculate(self, r):
        return r*3.14*2,r*r*3.14

刷这种简单的题目真有意思~

原文地址:https://www.cnblogs.com/bernieloveslife/p/14629820.html