Python- The Loops

The while loop 

To test the while loop copy the code as below:

lv_counter = 0
while (lv_counter < 10):
print(“The counter value is: “,lv_counter)
lv_counter = lv_counter + 1


Make sure to ident the block as shown below


Once you run the program, you should get the output as shown below

The for loop

You can iterate over a range of number or strings or lists.

for number in range(1,10):
print (“Current number is : “,number)

for letter in ‘Tutorial’:
print(“Current letter is :”,letter)

places = [‘Dhaka’,’Islamabad’,’Thimpu’,’New Delhi’]
for place in places:
print(“You are in this city now :”,place)

In the same file created above, add the above lines as shown below”:


Once you’ve run the program, you should see the output as shown below:




Python- The Decisions


  1. We will start with the simple if..else statement in Python.
  2.  Create a new file and enter the below lines:num = 100
    if (num == 100) : print(“Value of the number is 100”)
    else :
    print (“Value of the number is not equal to 100”)print(“Exit”)                          
  3. Save the file and under Run menu, click on Run module. You should get the output as shown below:


All in One

  1. Next, we will see how to use the if, elif and else statements in one program.
  2. Type the code snippet as given below:


      3. Save the file and under Run menu, click on Run module. You should get the output as shown below:


Python- Using the IDLE to run your program

  1. Start up the IDLE. Then under File, select New Window or prss CTRL + N, which will open up an untitled window. This is where we will be writing our first program.python12
  2.  In the untitled window, write your first programpython13
  3. Give the file a name and save it ( in this case)
  4. Next, under Run, select Run Module
  5. Now in the main window (IDLE SHELL), you will see the output as shown below:python15
  6. The SHELL is restarted every time one runs a module in IDLE. We can now proceed to writing full length programs!

Python- Setting the PATH

So, after installation of python, we need to update the environment variable PATH in windows 10.

  1. Click Windows + Pause, to start the System Properties and update the value for PATH as shown below:

    2. Start your command prompt and type : PATH. This should now include the installation directory of Python.

The Start

So I have decided to learn two new languages in 2017, beginning 11th April 2017 . For quite a while I wanted to learn Python and ADF and this blog marks the beginning of the journey.

The first post was to install Python and write the Hello World program. I will write new posts as I learn more about these two languages.


Python- The Firsts

  1. Installing Python :  Visit   and click on Downloads–>Windows. python1
  2. Download the executale. Here I have downloaded python-3.5.2  python2.PNGpython3.PNG
  3. Once the executable is downloaded (python-3.5.2-amd64.exe), double click on the file which will lauch the setup.


  4. Once this is done, navigate to C:\Users\<yourusername>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.5, you should see the following :python6
  5.  Click on the IDLE (Python 3.5.64-bit) and the python shell is launched. python7.PNG
  6. And thats it! Takes less than 5 minutes to install python.
  7. Okey, Finish it up with the customary Hello World program. (The error to show that the parentheses are required from python 3 and above. Print has moved from being just a “statement” to being a “function”!)python8