Python Programing Lab EXERCISE - 1(b)


Aim: 

Write a program to purposefully raise Indentation Error and Correct it.


Description:

Most of the programming languages like C, C++, Java use braces { } to define a block of code. Python uses indentation. A code block (body of a function, loop etc.) starts with indentation and ends with the first unindented line. The amount of indentation is depends on our choice, but it must be consistent throughout that block. Generally, Four whitespaces are used for indentation and is preferred over tabs. The enforcement of indentation in Python makes the code look neat and clean. This results into Python programs that look similar and consistent. Incorrect indentation will result into Indentation Error.

Program that shows Indentation Error: 

                    a = 10 
                    b = 5 
                         c = a + b 
                     print c




Output:


                    

Program without Indentation Error:
     
      a = 10
      b = 5
      c = a + b
      print c

Conclusion:

I get the knowledge on installing and executing programs in Python and also how Indentation plays a vital role in Python.

8 comments

  1. PNY Trainings is a pioneer Digital Marketing Institute offering Digital Marketing Courses in Lahore.

    ReplyDelete
  2. Thanks for sharing this blog. The content is beneficial and useful.
    For More Information about Python Python Online Training

    ReplyDelete
  3. Correct indentation will result into Indentation Error. Weight Loss Hypnosis

    ReplyDelete
  4. Python web development is quite in demand and a very good option for Python developers. In over the span of 25 years, Python has managed to reach a level that is high above others making it the fastest growing language.

    Best Python Training Center in Delhi, India

    Advanced Python Training Institute in Delhi
    Advanced Python Training Institute in Noida

    ReplyDelete
  5. short courses in Lahore and other courses are a great way to learn and advance in career and I think more people should move towards it.

    ReplyDelete
  6. Post is really supportive to all of us. Eager that these kind of information you post in future also. Otherwise if anyone want to Learn Python, Data Science, Machine Learning Course Visit here- http://pythontrainingdelhi.com/

    python training center in delhi
    python training Course in delhi
    python training Institute in delhi

    ReplyDelete
  7. Hi, I read your whole blog. This is very nice. Good to know about the .net and is very demanding in future. We are also providing various Python Training & Certification Courses, anyone interested can Python Training for making their career in this field.

    ReplyDelete

File Uploading in PHP

  File Uploading in PHP PHP allow you to upload any type of a file i.e. image, binary or text files.etc..,PHP has one in built global variab...