yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Learn to code in 60 seconds #programming #computerscience #python #khanacademy


less than 1m read
·Nov 10, 2024

Learn to code in 60 seconds. A program is a coded set of instructions for a computer to execute. Programs manipulate data, which come in several data types: integers, that's whole numbers; floats, have decimal points; booleans, true or false; and strings, of characters (don't forget the quotation marks).

Need to store a piece of data for later use? A variable names its location and points to it. Have a bunch of data? Organize it with a data structure. Lists store data in an ordered sequence, but we start counting at an index of zero. Dictionaries associate each piece of data with a key for easy lookup.

To make decisions in a program, ask a question with a Boolean expression. Then, choose which path to take with an if statement. To repeat a code routine, use a loop. A while loop repeats until the answer to your question becomes false. A for loop repeats a fixed number of times.

Have a lot of code? Break it down into smaller tasks with functions. Customize the function with input arguments and call the function to execute its task. Did you catch all that? Take it at your own pace with Khan Academy's intro to computer science course.

More Articles

View All
Ray Dalio: We're Already in Another Depression
So I was recently listening to a TED talk with Ray Dalio about the current state of the global economy, and I was really surprised that Ray was quite confident in the idea that we are in the start of another depression very similar to what we saw in 1929.…
The Absurdity of Detecting Gravitational Waves
1.3 billion years ago in a galaxy far, far away, two black holes merged. As they violently spiraled into each other, they created traveling distortions in the fabric of space-time: gravitational waves. In the last tenth of a second, the energy released in…
The Life of a Miner In Colombia | Mine Hunters
Meanwhile, outside, Fred is using his experience in large commercial gold mines to build a system that can protect the area around the mine. So basically, what’s happening here is we’ve got a lot of water drainage out of the mine, and with the water’s co…
Why Warren Buffett Doesn't Invest in Gold
If you will reach in your pocket, I don’t like to do this, but, uh, and pull out your wallet, this is you’re watching a historic event. If you look at this, and I might point out this is a one Charlie carries. On the back of it, it says, “In God we trust…
TIL: We Could Give Mars Our "Cooties" | Today I Learned
Human beings are really dangerous to the surface of Mars. Let’s say life did exist on the surface of Mars; would it be able to withstand the bacteria, the viruses, all of the bad things that we have on Earth, without having the protection? Because it’s ne…
Homeroom with Sal & Melinda Gates - Tuesday, January 12
Hi everyone, Sal here from Khan Academy. Welcome to the Homeroom live stream! Actually, I think this is the first of the year. Hopefully, everyone had a good New Year’s considering the circumstances and is enjoying 2021. Given the circumstances, we have a…