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
Water potential worked example
A zucchini squash was peeled and cut into six identical cubes. After being weighed, each cube was soaked in a different sucrose solution for 24 hours in an open container and at a constant temperature of 21 degrees Celsius. The cubes were then removed fro…
7 Best Questions from the 2024 Berkshire Hathaway Annual Meeting (Must Watch)
I don’t regard Utah as, uh, being unfriendly to the idea of utilities being treated fairly. Charlie? [Laughter] [Applause] I had actually checked myself a couple of times already, but I’ll slip again. Each year, tens of thousands of Warren Buffett discip…
The Ice Thumpers | Continent 7: Antarctica
CHRISTIAN OHNEISER: I’m pretty certain that we’re going to lose the actual ice shelf itself and parts of the West Antarctic Ice Sheet at some point in the future. It will turn into water. But it’s where that water goes and how much of it turns actually in…
International Women's Day Livestream: Women In Technology For Good
Hello and welcome to Khan Academy’s International Women’s Day fireside chat! I am Rachel Cook, the Senior Communications Manager here at Khan Academy, and you are in for a treat today because we have an amazing conversation on deck with two badass tech ch…
The Second Inflation Wave is Coming... (Michael Burry's Big Bet for 2024)
Well, you might have seen recently that Michael Barry is back in the news, and that is because he has just released his latest 13F filing, giving us a peek behind the curtain as to what he’s doing with his own stock portfolio. While Michael Barry definite…
Her "Classroom" is an Environmental Theme Park | Best Job Ever
Imagine that you are a child. You are 10 years old and “environment” is a word that nobody understands. My job is to train the next explorers of Grandmother Earth to be teachers, to be environmental instructors. That’s why I wanted to create a special pla…