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
Something Strange Happens When You Follow Einstein's Math
You can never see anything enter a black hole. (bell dings) Imagine you trap your nemesis in a rocket ship and blast him off towards a black hole. He looks back at you shaking his fist at a constant rate. As he zooms in, gravity gets stronger, so you woul…
Is It Possible to Run a Marathon in Under 2 Hours? | Breaking2
Ever since 490 BC, when Thea deputies ran the 26 miles from Marathon to Athens to declare victory over the Persians and promptly died, humans have been asking themselves, “How fast can we run this distance?” It’s a question that has motivated us for thou…
The BIGGEST Stimulus Check JUST RELEASED
What’s up you guys? It’s Graham here! So lately, I’ve had quite a few people bring this to my attention, so much so that I felt I should make a video about it explaining exactly what’s going on in the entire situation. Because when you see a title like th…
Average velocity and speed worked example | One-dimensional motion | AP Physics 1 | Khan Academy
We are told a pig runs rightward 20 meters to eat a juicy apple. It then walks leftward 5 meters to eat a nut. Finally, it walks leftward another 25 meters to eat another nut. The total time taken by the pig was 300 seconds. What was the pig’s average vel…
Don't Worry, Everything is Out of Control | Stoic Antidotes to Worry
Even though we can’t control the future, we’re worrying ourselves sick because of it. This could be because we don’t control the future. And this lack of control is the reason it frightens us. Or, we think we can control it by ‘thinking about it’ or perha…
The People Behind the Photography | Podcast | Overheard at National Geographic
Foreign [Music] To on my first visit to Indonesia in 1998. That’s John Stanmeier, a photographer at National Geographic. That year he was covering mass riots in the country triggered by economic collapse when he met someone who would change his life. I w…