Skip to main content

Posts

Basic Concepts of Python

Basic Concepts of Pythons What is Python ? Python is high-level programming language. It has been used in numerous areas, including web programming , scripting , scientific computing , and artifical intelligence . There are three major versions of Python. They are Python1.x, Python2.x and Python3.x Let's start learning Python. You need to write yourself and run the code. NEVER EVER copy and paste the code. Your First Program Just like other programming languages, Let's start with "Hello World !" program. What is "Hello World Program"? It is the first program in nearly every programming language for every programmer. It displays the words, "Hello World". It doesn't really print anything on the paper. In Python, it looks like this: print("Hello World") After writing the code above in your program, click on run button.(click e...
Recent posts

Tutorial3: Data Types in Python

Revision In Tutorial 1:Hello World Program , we've learnt how to print the words. In Tutorial 2:Doule Quote or Single Quote , we've written two program that prints I'm Aung Aung. (one program using double quotes and one using double quotes) Review Exercise 1: What happens if you leave out both the quotation marks? Review Exercise 2 :Write a program that prints 5 (by using either single quotes or double quotes).  What happens if you leave out both the quotation marks? Review Exercise 3 : What function is used to display the words to the user? In Review exercise 1, you will get error message. But in Review Exercise 2, you won't. This is because 5 and "I'm Aung Aung" belong to different data types: 5 is an integer while "I'm Aung Aung" is a string. In Python, the print()  function doesn't need any quotes to print the integer value, but it needs either two single quotes or two double quotes to print the string value.  A value is one of the ba...

Tutorial 2:Double Quote or Single Quote

Revision In  lesson 1:Hello World Program , we've learnt how to print the words. To print the words, we use the  print() function and put the words we want to print between the quotes (either single quotes or double quotes is okay) inside the parenthesis. Review Exercise 1:Write a program that prints (actually displays) I am Aung Aung using single quotation marks. Review Exercise 2:Write a program that prints I am Aung Aung using double quotation marks. Review Exercise 3:Write a program that prints I'm Aung Aung using single quotation marks. Review Exercise 4:Write a program that prints I'm Aung Aung using double quotation marks.   Double quote  Single Quote   I am Aung Aung  okay okay   I'm Aung Aung  okay error   In Review Exercise 2 and  4, we don't get any error message. We use double quotes inside the parenthesis in Review Exercise 4 so that the computer doesn't confuse. But in Review Exercise 3, we use print('I'm Aung Aun...

Tutorial 1:Hello world Program

Let's start learning to write Python with "Hello World program". What is "Hello World Program"? It is the first program in nearly  every programming language  for  every programmer.   It displays the words, "Hello World".    It  doesn't really print anything on the paper. In  Python, it looks like this: >>>print('Hello World') After writing the code above in your program, click on run button.(click enter if you are using command promp). The result(which is called "output" in programming) is the words   Hello World Note that the single quotation marks don't appear in the output. The computer displays only the words between them. Exercise 1 :In this tutorial, we write a program that prints Hello World. In this program, there is only a function. In Python,  print() is the function which displays the words to the user. Now write a program that prints Please subcribe Python for everyone.   Exercise2  : Unlike the language...

Tutorial 4:Arithmetic Operators in Pythons

Revision In previous tutorial, we've known that  5  is an integer and  "5"  is string. 5   and "5"  are in different types. How about 2+3 and "2+3" Review Exercise 1  : Write the following input code in your Python program and run the program. What is the output? >>>print(2+3) What is the type of 2+3? Review Exercise 1  : Write the following input code in your Python program and run the program. What is the output? >>>print("2+3") What is the type of "2+3"? The output in Review Exercise 1 is  5 . The output in Review Exercise 2 is 2+3. This is because  2  and  3  are intergers. Python operates adding  2  and  3  . In this case,  2  and  3  are called operands and  +  is the operator. The type of 2+3 is integer while "2+3" is string. Different   Operator Name Example Output  + addition x+y  the value of x+y  - subtraction x-y ...