@MikeBoyd teaches me how to code in Python

preview_player
Показать описание
The master of learning himself – @MikeBoyd – teaches me how to code in Python by writing a simple algorithm to find a sum of 3 cubes equal to the first 100 positive integers.

Thanks to Kim Boyd for filming.

For more maths content check out Tom's website

You can also follow Tom on Facebook, Twitter and Instagram @tomrocksmaths.

Get your Tom Rocks Maths merchandise here:
Рекомендации по теме
Комментарии
Автор

In Python, functions can read global variables by default. The global keyword allows you to write global variables.

mxlexrd
Автор

This guy is the math friend we all needed but never had

Subzerowins
Автор

Around 25:00, the negative results (-100 to 100) are also OK, because you can simply reverse the sign of all three input values to find the positive version.

Автор

So glad you're doing this video. Thanks to you both. Really fascinating.

tsuchan
Автор

This has probably been pointed out before but the reason this code is so slow is because the draw function is only being called 30 times per second. The draw function is supposed to be drawing something on screen, it isn't supposed to be used as a while loop in the way you are using it. In a normal case you could probably run that function thousands if not tens of thousands of times per second.

martinshoosterman
Автор

I hope you get into more code, it's basically a playground for math, and may even give you a deeper appreciation for it.

ihavedigits
Автор

It ran at 12:07 because the variables were defined as global variables on the same level as draw() and setup().

IsYitzach
Автор

Very cool video! Currently learning Python built a program that runs Collatz Conjecture. I shared the process.
Hope you do more collaborations.

ryangatchel
Автор

I didn't know you could do Python in Processing, cool

CorvanEssen
Автор

As a software engineer, this put a smile to my face, well done!

oinSquares
Автор

To the folks complaining about globals, Processing doesn't allow the draw() function to take parameters, so you pretty much need to use globals.

Technically you can manage your own draw loop using noloop() but your code will probably be less readable in the pursuit of trying to avoid globals.

Globals can be bad code, and are often a sign of it. But there's nothing wrong with the way they're being used here.

go-away-
Автор

Watching you guys stumble on the xor/power syntax was funny. That's one of the silly gotchas. But on the bright side, Python actually has the ** operator rather than requiring you to call a function just to do simple exponentiation.

Bobbias
Автор

Slight problem with the code. On line 24 the variable r is being reset back down to 1 after finding any new cases. This causes the code to loop over the same set of numbers, and prevents it from finding any new ones. A simple removal of this line would fix it.

Chris-fysm
Автор

Hay Doc Tom, Here in the Oregon US we have video poker and slot games in adult areas. Would you consider putting together lesson on the reality of this type of public gambling, how it works in maths and how it effects communities? I truly enjoy this activity. Help me understand the probability of the reality of this activity. Love and respect. Thanks.🙂🇺🇸🐟

RandellP
Автор

Thing with coding of any sort is that you need to be doing it every day in your job or it all just goes or gets outdated very quickly. I worked in software dev before they off shored it all, now I would struggle to do anything. After 3 years away from that area it's all just gone.

enigma
Автор

theres some great numberphile videos about this problem, im pretty sure that numbers congruent to 4 and 5 mod 9 are impossible and its conjectured that every other number has infinitely many solutions, unproven though

yoyoyogames
Автор

28:15 - Behold. Either the power of while/for loops or the horrible scourge of If/Else statements, depending on your point of view.

See also: The Tsandere Simulator Conundrum.

ANunes
Автор

Real teenager who has smoked weed once teaching how to do it to friends who haven't energy in this video.

lilldiesel
Автор

I find it helps me a lot to pseudocode things prior to starting to write a script. Even Python can present some significant syntactic barriers to people who don't use it often!

tlniec
Автор

Good stuff, they both seem like lovely chaps, and one day because of Mike, I'm determined to do a wheelie. lol

turboelephant