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
Energy graphs for simple harmonic motion | Simple harmonic motion | AP Physics 1 | Khan Academy
What I have drawn here is a mass sitting on a frictionless surface that is attached to a spring that is attached to the wall. What we’re going to do is we’re going to compress the spring; we’re going to get the mass to position A. Right now it’s at positi…
I Bought a Rain Forest, Part 2 | Nat Geo Live
Conservation is a bourgeois concept. What we do is we create a huge amount of carbon, and we expect poor people to look after our carbon sink for us. And they can’t because they haven’t got anything. I went to live with more illegal loggers. I wanted to …
Checkers Is the Heart and Soul of This Neighborhood | Short Film Showcase
[Music] Not only do you enjoy the camaraderie of it, but you make longtime friendships. We know the family, we know their friends, we know what they do and how they travel in life. When people are sick, we go by and check on them. When people go to jail, …
Why Don't We Shoot Nuclear Waste Into Space?
Here in the Kotart Labs, we test very important ideas to see what happens when you blow things up or play with black holes. Many of you suggested that we look into an idea that sounds reasonable: shooting nuclear waste into space. It’s one of those concep…
Later stages of the Civil War part 1
All right, so we’ve been talking about the later stages of the American Civil War. In the last videos, we talked about the Battle of Gettysburg and the Gettysburg Address, which happened in November of 1863, as Abraham Lincoln went to the site of the Batt…
Nihilism: Embracing the Void of Existence
As far as we can observe, being ‘alive’ means that, for a limited amount of time, we’re beings in a mysterious universe, doing whatever we do, seeing, hearing, smelling, touching, tasting, until we die. Animals and plants seem perfectly content with this …