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
Isotopes | Atoms, isotopes, and ions | High school chemistry | Khan Academy
Every element is defined by the number of protons in its atoms, which is called its atomic number. So, for example, every atom of potassium has 19 protons, and every atom of cobalt has 27 protons. But what about neutrons? Well, an element doesn’t always …
McDonald v. Chicago | National Constitution Center | Khan Academy
Hi, this is Kim from Khan Academy, and today we’re learning more about McDonald v. Chicago, a 2010 Supreme Court case challenging a handgun ban in the city of Chicago. The question at issue was whether the Fourteenth Amendment’s Due Process or Immunities …
15 Things Millennials Spend Money On That Are Worth It
Millennials have been getting a bad rap for their spending habits for years now, and we’re here to bust some myths about it today. Now sure, we keep hearing that the avocado toast-loving, custom coffee-drinking generation are lagging behind when it comes …
Black Holes 101 | National Geographic
(Mysterious music) [Woman] Black holes are among the most fascinating objects in our universe, and also the most mysterious. A black hole is a region in space where the force of gravity is so strong, not even light, the fastest known entity in our univer…
The Trouble With Tumbleweed
Bouncing across a scene, tumbleweed established the Wild West as Western. But more than just prompts, tumbleweed are real, and tumbleweed are alive. Well, they were alive. Each tumbleweed starts as a tiny seed on the craggy landscape, putting down roots, …
The Solar System -- our home in space
The solar system, our home in space. We live in a peaceful part of the Milky Way. Our home is the solar system, a four and a half billion year old formation that races around the galactic center at 200,000 kilometers per hour and circles it once every 250…