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
Electrolytic cells | Applications of thermodynamics | AP Chemistry | Khan Academy
Electrolytic cells use an electric current to drive a thermodynamically unfavorable reaction. Before we look at a diagram of an electrolytic cell, let’s look at the half reactions that will occur in the cell. In one half reaction, liquid sodium ions reac…
The global economy is a pyramid scheme | End of the Road (full documentary)
The strength of a nation’s currency is based on the strength of that nation’s economy, and the American economy is by far the strongest in the world. Accordingly, I have directed the Secretary of the Treasury to take the action necessary to defend the dol…
Why Should We Go to Mars? | MARS
[Music] The reason humans should go to Mars is because we’re human. I mean, we are an exploring species. It’s what’s made us the dominant species on this planet. If we only lived in one little plot of land on Earth and we never went anywhere, I would say,…
State of the aviation industry amidst war in Europe
Most of the globally aware and affected population were a bit shocked last week when Russia actually initiated its invasion of Ukraine. Of course, I’m not a political accommodator, but war is horrible no matter how you look at it. My heart goes out to all…
The Butterfly Effect
In 1952, an author named Ray Bradbury published a short story called “A Sound of Thunder.” In it, a hunter named Eckles pays $110,000 to travel with Time Safari, a time machine company that takes hunters back to the time of dinosaurs and allows them to hu…
Australia's Housing Crisis is Insane.
So we open the bidding, ladies and gentlemen, at 1,100,000. I’ve never seen a situation in housing like we’re seeing today. Australia’s housing crisis will likely get worse before it gets better. A system where it’s arguably easier to buy your second hous…