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
A Visit From The Hudson Bay Company | Barkskins
[door opening] [exhales] Francis, there is an Englishman waiting for you. These tables are no good. No good at all. He is from the Hudson Bay Company. I gave Lafarge exact measurements. A table that will not tilt or list. That is all I ask for, a proper t…
What was the Articles of Confederation? | US Government and Civics | Khan Academy
So John, people are always talking about the Constitution, but the Constitution was not the first founding document of the United States. What were the Articles of Confederation, and why did they need to get replaced? Well, the Articles of Confederation w…
Economic profit for a monopoly | Microeconomics | Khan Academy
In this video, we’re going to think about the economic profit of a monopoly firm. To do that, we’re going to draw our standard price and quantity axes. So, that’s quantity and this is price, and this is going to of course be in dollars. We can first thin…
The Mani Tribe's Blowgun | Primal Survivor
[music playing] HAZEN AUDEL: The Mani have an unrivaled knowledge of the local plants and trees, relying on them for almost everything they need. [non-english speech] Huh? [non-english speech] [non-english speech] That one right there. [non-english speec…
How Special Relativity Makes Magnets Work
Only a few elements can be permanent magnets - iron is one. Copper is not. But if you pass an electric current through any metal, it becomes a magnet - an electromagnet. But how does this work? Well, strangely enough, it’s a consequence of special relativ…
Personally Identifiable Information (PII) | Internet safety | Khan Academy
Hi everyone, Sal Khan here from Khan Academy. My social security number is eight five seven three two five five six seven. No, it’s not! I wouldn’t tell you my social security number like that, and that’s because it is personally identifiable information,…