题目:

Complete the square sum function so that it squares each number passed into it and then sums the results together.

For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9.

解题方法:(再想想可能就出来了)

def square_sum(numbers):
return sum(map(lambda x: x**2,numbers))

还有其他的办法:

def square_sum(numbers):
return sum(x**2 for x in numbers)

【Kata Daily 190920】Square(n) Sum(平方加总)的更多相关文章

  1. 【Kata Daily 191010】Grasshopper - Summation(加总)

    题目: Summation Write a program that finds the summation of every number from 1 to num. The number wil ...

  2. 【leetcode】1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold

    题目如下: Given a m x n matrix mat and an integer threshold. Return the maximum side-length of a square ...

  3. leetcode_1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_[二维前缀和]

    题目链接 Given a m x n matrix mat and an integer threshold. Return the maximum side-length of a square w ...

  4. Project Euler 92:Square digit chains 平方数字链

    题目 Square digit chains A number chain is created by continuously adding the square of the digits in ...

  5. [LeetCode] Valid Word Square 验证单词平方

    Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a v ...

  6. LeetCode 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold

    题目 我是按照边进行二分的 class Solution { public: int sum[100005]; int a[305][305]; int maxSideLength(vector< ...

  7. 【Kata Daily 190929】Password Hashes(密码哈希)

    题目: When you sign up for an account somewhere, some websites do not actually store your password in ...

  8. 【Kata Daily 190927】Counting sheep...(数绵羊)

    题目: Consider an array of sheep where some sheep may be missing from their place. We need a function ...

  9. 【Kata Daily 190912】Alphabetical Addition(字母相加)

    题目: Your task is to add up letters to one letter. The function will be given a variable amount of ar ...

随机推荐

  1. Typore的简单用法

    1 无序列表使用方法 +号和空格一起按就可以写出这个点 2 有序列表使用方法 .先写1.然后打个空格就再回车 3 使用#和空格表示一级标题 一级标题 4 使用##和空格表示二级标题 5 二级标题 6 ...

  2. 022 01 Android 零基础入门 01 Java基础语法 03 Java运算符 02 算术运算符

    022 01 Android 零基础入门 01 Java基础语法 03 Java运算符 02 算术运算符 本文知识点:Java中的算术运算符 算术运算符介绍 算术运算符代码示例 注意字符串连接问题和整 ...

  3. Burp时间到期之复活

    Burp昨天到期了,找了好久终于找到可以用的了,分享给大家. https://pan.baidu.com/s/1hsEhUYS r6ls PS:https://github.com/mxcxvn/Bu ...

  4. Windows下安装VScode,并使用,以及中文配置

    转载:https://blog.csdn.net/x15011238662/article/details/85094006 首先明确一点,VScode是开发Go应用的基础编辑器,是Microsoft ...

  5. PADS Layout VX.2.3 灌铜之后没有显示整块铜皮的原因

    操作系统:Windows 10 x64 工具1:PADS Layout VX.2.3 灌铜之后没有显示整块铜皮,如下图所示: 点击菜单Tools > Options...(快捷键:Ctrl + ...

  6. 达梦产品技术支持-DM8-数据库安装

    (该文档只适合个人环境搭建,未涉及到数据库的各种参数配置,未涉及到数据库规划,若需要企业环境搭建请咨询专业人员) 基于Windows的安装 windows下安装是图形化界面,与linux下的图形化界面 ...

  7. RHSA-2017:2473-重要: 内核 安全和BUG修复更新(需要重启、存在EXP、本地提权)

    [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 修复命令: 使用root账号登陆She ...

  8. HttpReports 2.0 发布了 !!!

    前言介绍 HttpReports 是基于.Net Core 开发的APM监控系统,使用MIT开源协议,主要功能包括,统计, 分析, 可视化, 监控,追踪等,适合在微服务环境中使用. Github地址: ...

  9. shell-字符串及整数操作符讲解与多实践

    1. 字符串测试操作符 字符串测试操作符的作用:比较两个字符串是否相同.字符串长度是否为零,字符串是否为null(注:bash区分零长度字符串和空字符串)等. "="比较两个字符串 ...

  10. 实验三 HTML表格和表单的制作

    实验三 HTML表格和表单的制作 [实验目的] 1.掌握表格的创建.结构调整与美化方法: 2.熟悉表格与单元格的主要属性及其设置方法: 3.掌握通过表格来进行网页页面的布局方法. [实验环境] 连接互 ...