Skip to main content

Posts

What Is Python Used For

 Python is an interpreted, object-oriented, high-level programming language with dynamic semantics developed by Guido van Rossum . It was originally released in 1991 . Designed to be easy as well as fun, the name "Python" is a nod to the British comedy group Monty Python. Python has a reputation as a beginner-friendly language, replacing Java as the most widely used introductory language because it handles much of the complexity for the user, allowing beginners to focus on fully grasping programming concepts rather than minute details. Python is used for server-side web development, software development, mathematics, and system scripting, and is popular for Rapid Application Development and as a scripting or glue language to tie existing components because of its high-level, built-in data structures, dynamic typing, and dynamic binding. Program maintenance costs are reduced with Python due to the easily learned syntax and emphasis on readability. Additionally, Python's s

Keywords in Python

Keywords are the reserved words in Python. We cannot use a keyword as a variable name, function name or any other identifier. Here's a list of all keywords in Python Programming Keywords in Python programming language   >>> import keyword  >>> print(keyword.kwlist)  ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']  Description of Keywords in Python with examples True, False True and False are truth values in Python. They are the results of compa

Exception Handling In Python With Example

  What is an Exception? An exception in Python is an incident that happens while executing a program that causes the regular course of the program's commands to be disrupted. When a Python code comes across a condition it can't handle, it raises an exception. An object in Python that describes an error is called an exception. When a Python code throws an exception, it has two options: handle the exception immediately or stop and quit. Exceptions VS Syntax Errors Syntax Error: As the name suggests this error is caused by the wrong syntax in the code. It leads to the termination of the program.When the interpreter identifies a statement that has an error, syntax errors occur. Exceptions : Exceptions are raised when the program is syntactically correct, but the code resulted in an error. This error does not stop the execution of the program, however, it changes the normal flow of the program. When syntactically valid Python code produces an error, this is the kind of error that ar

Python | Calendar Module

 Python | Calendar Module Python defines an inbuilt module calendar that handles operations related to the calendar. The calendar module allows output calendars like the program and provides additional useful functions related to the calendar. Functions and classes defined in the Calendar module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions. By default, these calendars have Monday as the first day of the week, and Sunday as the last (the European convention).  Example #1: Display the Calendar of a given month.  # Python program to display calendar of # given month of the year  # import module import calendar yy = 2017 mm = 11  # display the calendar print(calendar.month(yy, mm))  Output:  Example #2: Display calendar of the given year.  # Python code to demonstrate the working of  # calendar() function to print calendar # importing calendar module  # for calendar operations import calendar  # using calendar to print calendar of year