Learn to code in 60 seconds
About this video
A one-minute whirlwind tour of core programming ideas: programs and data types, variables, lists and dictionaries, Boolean expressions with if statements, while and for loops, and functions with input arguments.
You'll be able to
- name the basic data types and say what a variable is for.
- tell the difference between a list and a dictionary.
- tell the difference between a while loop and a for loop.
Key words
- program
- A coded set of instructions for a computer to execute.
- variable
- A name that points to where a piece of data is stored so you can use it later.
- list
- A data structure that stores data in an ordered sequence, counted from index zero.
- dictionary
- A data structure that links each piece of data to a key for easy lookup.
- if statement
- Code that chooses which path to take based on a Boolean expression.
- function
- A named block of code for a smaller task, which you call to run, often with input arguments.
Transcript
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 to name its location and point 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. Phew! Did you catch all that? Take it at your own pace with Khan Academy's Intro to Computer Science course.
Video © Khan Academy, used under CC BY-NC-SA. Watch on Khan Academy. Puzzicle is not affiliated with Khan Academy.