Introduction to Fundamental Programming Concepts

  • Fundamental Concepts in Programming
  • Differences between low-level and high-level languages
  • Basic debugging techniques
  • Simple Calculation in Python

A computer bug is a defect in coding of a software program that makes the program operate incorrectly or fail. The process of eliminating problems or errors in a program is known as ‘debugging’.

The Python interpreter is a program that reads and executes Python code.

A prompt that indicates that the interpreter is ready for you to enter code. If you type a line of code and hit Enter, the interpreter displays the result

Python provides operators, which are special symbols that represent computations like addition and multiplication.

The operators +, -, and * perform addition, subtraction, and multiplication.

The operator / performs division.

The operator ** performs exponentiation; that is, it raises a number to a power. In some other languages, ^ is used for exponentiation, but in Python, it is a bitwise operator called XOR.

A value is one of the basic things a program works with, like a letter or a number.

Some values we have are 2, 42.0, and ‘Hello, World!’. These values belong to different types: 2 is an integer, 42.0 is a floating-point number, and ‘Hello, World!’ is a string, so-called because the letters it contains are strung together. If you are not sure what type a value has, the interpreter can tell you:

>>> type(2)
<class 'int'>
>>> type(42.0)
<class 'float'>
>>> type(‘Hello, World!’)
<class 'str'>

In these results, the word “class” is used in the sense of a category; a type is a category of values.

When you type a large integer, you might be tempted to use commas between groups of digits, as in 1,000,000. This is not a legal integer in Python, but it is legal:

>>> 1,000,000 
(1, 0, 0)

That’s not what we expected at all! Python interprets 1,000,000 as a comma-separated sequence of integers.

Natural languages are the languages people speak, such as English, Spanish, and French. They were not designed by people (although people try to impose some order on them); they evolved naturally.

Formal languages are languages that are designed by people for specific applications. For example, the notation that mathematicians use is a formal language that is particularly good at denoting relationships among numbers and symbols. Chemists use a formal language to represent the chemical structure of molecules. And most importantly:

Programming languages are formal languages that have been designed to express computations.

Formal languages tend to have strict syntax rules that govern the structure of statements. For example, in mathematics the statement 3 + 3 = 6 has correct syntax, but 3+ = 3$6 does not. In chemistry H2O is a syntactically correct formula, but 2Zz is not.

Syntax rules come in two flavors, pertaining to tokens and structure. Tokens are the basic elements of the language, such as words, numbers, and chemical elements.

This is @ well-structured Engli$h sentence with invalid t*kens in it. This sentence all valid tokens has, but invalid structure with. 

When you read a sentence in English or a statement in a formal language, you have to figure out the structure (although in a natural language you do this subconsciously). This process is called parsing.

  • ambiguity (ရှုပ်ထွေးမှု): Natural languages are full of ambiguity, which people deal with by using contextual clues and other information. Formal languages are designed to be nearly or completely unambiguous, which means that any statement has exactly one meaning, regardless of context.
  • redundancy (အသုံးမဝင်သော အပိုအလို): In order to make up for ambiguity and reduce misunderstandings, natural languages employ lots of redundancy. As a result, they are often verbose. Formal languages are less redundant and more concise.
  • literalness (တိကျမှု): Natural languages are full of idiom and metaphor. If I say, “The penny dropped”, there is probably no penny and nothing dropping (this idiom means that someone understood something after a period of confusion). Formal languages mean exactly what they say

Programmers make mistakes. For whimsical reasons, programming errors are called bugs and the process of tracking them down is called debugging.


  • problem-solving: The process of formulating a problem, finding a solution, and expressing it.
  • high-level language: A programming language like Python that is designed to be easy for humans to read and write. [လူအတွက် ဖတ်ရ၊ ရေးရလွယ်သော]
  • low-level language: A programming language that is designed to be easy for a computer to run; also called “machine language” or “assembly language”. [Computer အတွက် ဖတ်ရလွယ်သော]
  • portability: A property of a program that can run on more than one kind of computer. [ Platform မျိုစုံးမှာ run ပေးနိုင်စွမ်းရှိမှု]
  • interpreter: A program that reads another program and executes it. [ကျွန်ပျူတာ ဘာသာစကားကို ဘာသာပြန်ပြီး Run ပေးသူ]
  • prompt: Characters displayed by the interpreter to indicate that it is ready to take input from the user.
  • program: A set of instructions that specifies a computation.
  • print statement: An instruction that causes the Python interpreter to display a value on the screen.
  • operator: A special symbol that represents a simple computation like addition, multiplication, or string concatenation.
  • value: One of the basic units of data, like a number or string, that a program manipulates.
  • type: A category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str).
  • integer: A type that represents whole numbers.
  • floating-point: A type that represents numbers with fractional parts.
  • string: A type that represents sequences of characters.
  • natural language: Any one of the languages that people speak that evolved naturally
  • formal language: Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are formal languages.
  • token: One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.
  • syntax: The rules that govern the structure of a program.
  • parse: To examine a program and analyze the syntactic structure.
  • bug: An error in a program. debugging: The process of finding and correcting bugs.


  • Think Python (Second Edition)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store