by Pau Pavón

通过保罗·帕文(PauPavón)

为什么您不需要精通数学就可以学习编程 (Why you don’t need to excel at math to learn how to program)

This is probably one of the greatest misconceptions I’ve ever heard.

这可能是我听过的最大的误解之一。

If you want to program, you must be good at math. It’s totally fake. Let me explain.

如果要编程,您必须精通数学。 完全是假的。 让我解释。

您无需精通数学即可学习编码 (You don’t need to excel at math to learn to code)

I started coding when I was 12 years old. The math I knew was addition, subtraction, multiplication, and division. And it was more than enough to get me into the programming world. Even today, I don’t use anything more complex than powers or square roots.

我12岁开始学习编码。 我知道的数学是加法,减法,乘法和除法。 这足以让我进入编程世界。 即使在今天,我也不会使用除幂或平方根之外的任何复杂事物。

If you have ever programmed any line of code, you have hopefully realized it has almost nothing to do with math. If you know how to count, you are pretty much good to go.

如果您曾经编写过任何代码行,您都有望意识到它几乎与数学无关。 如果您知道该如何计数,那么您的工作就非常好。

神话的起源 (The origin of the myth)

I believe I’ve figured out where this ‘myth’ comes from. You know those old (or not so old) movies about hackers and programmers. They often show computers with lots of 0s and 1s in a greenish font, flowing vertically along the screen? That’s binary code (and it doesn’t normally move around the screen, it’s just static text).

我相信我已经弄清楚了这个“神话”的来历。 您知道那些关于黑客和程序员的古老(或不太古老)电影。 它们经常以绿色字体向计算机显示大量0和1,它们沿着屏幕垂直流动吗? 那是二进制代码(并且通常不会在屏幕上四处移动,而只是静态文本)。

Computers understand binary code, but that’s not what programming languages are about. It may sound quite obvious, because if you are reading this you probably have some kind of relationship with this world. But you’d be amazed to see how many people think it’s all about binary.

计算机可以理解二进制代码,但这不是编程语言的目的。 这听起来似乎很明显,因为如果您正在阅读本文,您可能与这个世界有某种关系。 但是您会惊讶地看到有这么多人认为二进制全都与二进制有关。

But besides this misconception, I think the other factor is the relation established between the words math and logic. Programming requires logical thinking, and math also does. But golf and basketball both require a ball to be played with, and that doesn’t mean you need to know how to play basketball to take up golf.

但是除了这种误解之外,我认为另一个因素是数学逻辑之间建立的关系。 编程需要逻辑思维,数学也需要逻辑思维。 但是高尔夫和篮球都需要玩球,这并不意味着您需要了解打篮球的方法。

让你相信我刚才说的 (Making you believe what I just said)

Let’s take a proper example. Imagine you want to build a function to print out the multiplication table of a number. So, for input 2, our function will return:

让我们举一个适当的例子。 假设您要构建一个函数来打印数字的乘法表。 因此,对于输入2,我们的函数将返回:

2 x 0 = 0

2 x 0 = 0

2 x 1 = 2

2 x 1 = 2

2 x 2= 4

2 x 2 = 4

2 x 3 = 6

2 x 3 = 6

And up to 2 x 10 = 20

最多2 x 10 = 20

You will see how little math is required to do this (even though we are calculating something ‘mathematical’). For the purpose of this example, we’ll be using JavaScript.

您将看到执行此操作所需的数学运算很少(即使我们正在计算“数学”运算)。 就本示例而言,我们将使用JavaScript。

First, we declare the function. We’ll call it tableOf(n), where n is the number we want to print the table of.

首先,我们声明函数 。 我们将其称为tableOf(n) ,其中n是我们要打印表格的数字。

function tableOf(n) {
//rest of the code
}

Pretty easy for the moment. Now we’ll implement something called a for loop. This is similar to a function except for the fact that, when it reaches the end, it goes back to the beginning until some condition is true

目前非常容易。 现在,我们将实现一个称为for循环的东西 这类似于一个函数,除了以下事实:当到达终点时,它将返回到起点,直到满足某些条件为止

We want to print n times some other value (let’s call it i) until that value reaches 10. We have to also take into account that i should start from 0, as we want n x 0 = 0 to be the first line printed. The code could be as following:

我们要打印n倍于其他值(称为i ),直到该值达到10。我们还必须考虑到应该从0开始,因为我们希望nx 0 = 0是打印的第一行。 代码可能如下:

for(i = 0; i < 11; i++) {
console.log(n, 'x', i, '=', n*i);
}

Let’s review what we just did. We started the for loop with i = 0, meaning that i starts from 0 (as we wanted). Then we say i < 11, meaning that we don’t want to exit the loop until i equals 11 or, in other words, we want the loop to continue if i is less than 11. Then we do i++, which means that we increase the value of i by 1 every time the loop starts again (so it eventually reaches 11 and exits the loop).

让我们回顾一下我们刚刚做了什么。 我们从i = 0开始for循环,这意味着从0开始(如我们所愿)。 然后我们说我<11,这意味着我们不希望退出循环UNT I L i等于11,或者换句话说,我们希望循环继续I F i小于11。然后我们我++,这意味着每次循环再次开始时,我们将o f i的值增加1(因此最终达到11并退出循环)。

Then we just output n (the number we entered), ‘x’ (for the times symbol), i(the number for which n is multiplied by), ‘=’ (for the equals symbol), and finally n*i (the actual operation, n times i).

然后我们只输出n (我们输入的数字),'x'(对于时间符号), i (与n乘以的数字),'='(对于等于符号),最后输出n * i (实际操作, n次i )。

The previous code, combined:

之前的代码结合在一起:

function tableOf(n) {
for(i = 0; i < 11; i++) {
console.log(n, 'x', i, '=', n*i);
}
}
tableOf(2);

And it works. Is this difficult math? The only math we did was increasing i by one (adding), and checking if i was less than 11. For this concrete example, we also multiplied n times i. Wow.

而且有效。 这算难吗? 我们所做的唯一数学运算是将i加1(加),并检查i是否小于11。对于这个具体示例,我们还乘以n乘以i

硬币的另一面 (The other side of the coin)

Learning to code will make you better at math.

学习编码将使您的数学更好。

As I said before, programming requires logical thinking just as math does. While writing your programs, you’ll encounter a lot of problems that need to be solved. Most of the time with logic (but let’s be honest, sometimes trial and error works just fine).

正如我之前所说,编程需要逻辑思维,就像数学一样。 在编写程序时,您会遇到很多需要解决的问题。 大多数时候都使用逻辑(但老实说,有时反复试验就可以了)。

Developing the skills to solve these problems is definitely going to help you with math — not only with the concepts, but with problem-solving. You can extend this to other disciplines as well, such as physics.

开发解决这些问题的技能肯定会帮助您数学—不仅是概念上的问题,还是解决问题的方法。 您也可以将其扩展到其他学科,例如物理。

I hope this article serves to encourage people that want to give coding a try to do it. Trust me, I knew little about math and less about English, and I was still able to learn a lot. Knowledge has no limits.

我希望本文能鼓励想要尝试编码的人们。 相信我,我对数学知之甚少,对英语的了解却很少,而我仍然能够学到很多东西。 知识无止境。

翻译自: https://www.freecodecamp.org/news/why-you-dont-need-to-excel-at-math-to-learn-how-to-program-90f9697f70d9/

为什么您不需要精通数学就可以学习编程相关推荐

  1. 零基础学习编程难不难?

    对于编程的学习,很多家长学生都很困惑,很纠结,编程到底是什么?零基础学习难吗?学编程有前途吗? 目前,编程离人们的生活越来越近,不少非专业人士也都大体懂一些编程的基础知识,在美国,很多非程序员人士也都 ...

  2. 不同语言编程能整合到一起吗_学习编程入门指南

    每天都看到很多对编程感兴趣的人在问是不是可以自学软件开发,或者应该怎么自学编程才能入门.在这篇文章里,我将尝试重现一个初学者在学习计算机编程时可能会碰到的问题,并尽量提供相应的解决思路,希望对初学者有 ...

  3. 小白学习编程最容易进入的六大误区,你中招了吗?

    很多编程初学者在选择学习编程时,顾虑重重,有人认为​‌‌自己英语不好,不适合编程,有人认为自己数学不好不适合编程,有些人认为编程是一个非常需要天赋的职业.本文主要针对初学者分析部分学习编程的误区与错误 ...

  4. 黑马程序员:从零基础到精通的前端学习路线

    黑马程序员:从零基础到精通的前端学习路线 随着互联网的深入发展,前端开发工程师一跃成为市场上非常抢手的人才.很多同学,包括以前做UI的.Java的.或者对于IT完全零基础的同学都想学习前端.下图是网上 ...

  5. parallels desktop big sur 网络_初中生数学网络学习哪个好

    初中生数学网络学习哪个好?去试听一下简单学习网课程,注册就可以免费学习7天了,语文李华老师,数学傲德老师.黄炜老师,英语麻雪玲老师,课程都讲得很好,还是封闭课堂听课,特别适合自制力没那么好的同学. 初 ...

  6. 从零基础到精通的Python学习路线(附教程)

    首先,我们先普及一下编程语言的基础知识.其实无论用任何编程语言来开发程序,都是为了让计算机干活,比如编写一篇文章,下载一首MP3等,而计算机干活的CPU只认识机器的指令,所以,尽管不同的编程语言差异极 ...

  7. 硬件工程师需要数学功底吗_您不需要数学就可以成为软件工程师

    硬件工程师需要数学功底吗 When people start looking into software engineering as a career path, a typical first q ...

  8. 虚幻引擎的数学知识学习教程 Math for Unreal Engine (Early Preview)

    通过做真实世界的 Unreal Engine项目来学习数学 你会学到什么 理解游戏开发对数学的基本需求 将数学直接应用到用例中,而不是钻研理论(用我们的示例项目进行实践) 正确编辑短视频,节省您的时间 ...

  9. 数学建模学习交流论文写作课件

    数学建模学习交流论文写作课件 参考资料:数学建模清风:论文写作方法课程 https://www.bilibili.com/video/BV1Na411w7c2

最新文章

  1. petshop4.0 详解之一(系统架构设计)
  2. 聊聊storm supervisor的启动
  3. 网络的概念与网络的基本分类
  4. s9 Linux 进程管理命令
  5. 关于Webview如何自动登录保存登录信息
  6. 国家开放大学2021春1127实用卫生统计学题目
  7. python 程序运行计时 动态,在python中运行计时器几分钟
  8. bzoj3238 [Ahoi2013]差异 后缀自动机
  9. 2012年8月20日 我单身了!
  10. import pymysql 没有模块_python模块与包
  11. JAVA操作串口有感
  12. c语言课程表代码,[计算机]c语言课程表源代码
  13. 将Excel表格数据导入SQL表格
  14. 微信小程序开发之——模板
  15. 使用 Python 的人脸识别系统
  16. 随机过程 - 马尔可夫链
  17. 生物信息学 之 序列比对
  18. 96PIN直插DIP千兆四口网络变压器 千兆交换机路由器网络滤波器
  19. 从python入门机器学习系列--2、Z 检验与 T 检验
  20. requests+正则表达式爬取猫眼电影TOP100!

热门文章

  1. linux 用户java_linux之用户管理
  2. 网上商城系统源代码_多用户系统商城授权有几种方式?
  3. python多变量非线性拟合_python实现多变量线性回归(Linear Regression with Multiple Variables)...
  4. promise 和 async await区别
  5. puppeteer爬虫的奇妙之旅
  6. 利用ZYNQ SOC快速打开算法验证通路(5)——system generator算法IP导入IP integrator
  7. 郭为:大数据时代的企业管理挑战
  8. [iOS]开发者证书和描述文件的作用
  9. 解决 apache 2.4.1 无法解析shtml中的expr指令问题
  10. 怎么样才能快速的把淘宝店铺推广出去