101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    Intro to computers and programming

    Receive aemail containing the next unit.
    • Computer Basics
      • 1.1Overview of Computers
      • 1.2Understanding Operating Systems
      • 1.3Understanding Computer Networks
    • Introduction to Programming
      • 2.1What is Programming?
      • 2.2Basics of a Program
      • 2.3How a Program Runs on a Computer
    • Introduction to Coding
      • 3.1Writing your First Code
      • 3.2Language of Coding
      • 3.3Common Coding Practices
    • Scripting Basics
      • 4.1What is Scripting?
      • 4.2Difference Between Coding and Scripting
      • 4.3First Look at Shell Scripts
    • Basics of a Programming Language
      • 5.1Understanding Syntax
      • 5.2Basic Constructs – Loops & Conditionals
      • 5.3Functions and Procedures
    • Intermediate Programming
      • 6.1Arrays and Lists
      • 6.2File Handling
      • 6.3Error Handling
    • Introduction to Object Oriented Programming
      • 7.1Principles of Object Oriented Programming
      • 7.2Classes and Objects
      • 7.3Inheritance and Encapsulation
    • Practical Uses of Scripting
      • 8.1Process Automation with Scripts
      • 8.2Using Scripts for Data Manipulation
      • 8.3Web Scraping with Scripts
    • Algorithms and Data Structures
      • 9.1Basics of Algorithms
      • 9.2Introduction to Data Structures
      • 9.3Practical Uses of Data Structures
    • Code Efficiency
      • 10.1Writing Efficient Code
      • 10.2Debugging and Testing
      • 10.3Code Performance Analysis
    • Managing Code Project
      • 11.1Understanding Version Control
      • 11.2Use of GitHub for Project Management
      • 11.3Collaborative Coding Practices
    • Real World Coding Examples
      • 12.1Review and Analysis of Real World Code
      • 12.2Case Study—Use of Code in Solving Real World Problems
      • 12.3Building and Presenting a Mini Coding Project
    • Future Learning and Wrap Up
      • 13.1Essentials for Advanced Learning
      • 13.2Overview of Other Programming Languages
      • 13.3Course Wrap Up and Next Steps

    Introduction to Programming

    Basics of a Program

    classification of data in computer science

    Classification of data in computer science.

    Programming is a powerful tool that allows us to give instructions to a computer. But before we can start writing code, it's important to understand the basic structure of a program. In this article, we will cover the fundamental components of a program: variables, data types, operators, expressions, and control structures.

    Variables and Data Types

    In programming, a variable is a named space in the computer's memory where a programmer can store data. This data can be of different types, such as:

    • Integer: Whole numbers, like 7 or 42.
    • Float: Decimal numbers, like 3.14 or 0.99.
    • String: Text, like "Hello, world!".
    • Boolean: True or false values.

    The type of data that a variable holds is called its data type. Different programming languages have different data types, but the ones listed above are common to most languages.

    Operators and Expressions

    Operators are symbols that tell the computer to perform specific mathematical or logical manipulations. There are several types of operators, including:

    • Arithmetic operators: Perform mathematical operations like addition (+), subtraction (-), multiplication (*), and division (/).
    • Comparison operators: Compare two values and determine the relation between them. These include equals (==), not equals (!=), less than (<), and greater than (>).
    • Logical operators: Used to combine conditional statements. These include AND (&&), OR (||), and NOT (!).

    An expression is a combination of one or more values, variables, and operators that the programming language interprets and computes to produce another value.

    Control Structures

    Control structures determine the flow of a program's execution. There are three basic types of control structures: sequence, selection, and loop.

    • Sequence: This is the default control structure. Instructions are executed one after another in the order in which they appear.
    • Selection: Used for decisions, branching — choosing between 2 or more alternative paths. if is a common selection structure.
    • Loop: Used for looping, i.e., repeating a piece of code multiple times in a row. Common looping structures include for, while, and do while loops.

    Understanding these basics is the first step towards writing a program. In the next unit, we will look at how a program runs on a computer, and how to identify and fix common errors.

    Test me
    Practical exercise
    Further reading

    My dude, any questions for me?

    Sign in to chat
    Next up: How a Program Runs on a Computer