A BRIEF INTRODUCTION

Python Programming Language

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built-in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.

Python's simple, easy to learn syntax emphasizes on readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms and can be freely distributed.

Top companies using Python:

  • Google
  • Facebook
  • Instagram
  • Spotify
  • Quora
  • Netflix
  • Dropbox
  • Reddit
PYTHON ONLINE COMPILER

Compiler Vs Interpreter

Python leads the faction of the fastest growing programming languages especially in the data science domain. It is an interpreted language and so is excuted line by line. You may be itching to know the difference between a compiler and interpreter, however it is important to know what they are

Compiler

A computer program that translates code written in one programming language into another. Primarily, compilers are programs that convert source code written in a high-level programming language to a lower-level programming language, such as machine code, for creating an executable program.

Interpreter

A computer program that directly executes the instructions of a high-level language. The interpreter transforms the high-level program into an intermediate language that it then executes, or it could parse the high-level source code and then performs the commands directly, which is done line by line.

The interpreter reads each line of code and then converts or directly executes it. An assembler or a compiler, on the other hand, converts high-level source code into native (compiled) code that can be executed directly by the operating system (e.g. by creating a .exe program). Both compilers and interpreters have advantages and disadvantages, and they are not mutually exclusive; thus, they can be used alongside each other, as most integrated development environments use both compilation and translation for some high-level languages. This is the case with the codedamn python online compiler too!

Try out the Python interpreter

To get started with the python interpreter, type the following code into the integrated terminal of the online python compiler above

damner@codedamn:~/code$ python3

Then try writing python code after the >>>. For example,

Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello World')

Gives the output:

>>> print("Hello World")
Hello World
>>> 

To exit the interactive interpreter call quit() or press control + d

>>> quit()

CODEDAMN ONLINE COMPILERS

Codedamn Python Compiler

The codedamn online compiler utilizes the power of cloud computing to give you a fast and reliable coding experience. When you boot the online python compiler, a docker container is started on a remote linux computer. This docker container is already setup to interpret your Python code and check for any errors or problems. As the python code is executed, the output / errors will show up on the integrated terminal of the online python compiler.

Try out the Python online compiler

To get started, type your pyhton code into the script.py file. For example,

# Python program to check if year is a leap year or not

# To get year (integer input) from the user
year = int(input("Enter a year: "))

# divided by 100 means century year (ending with 00)
# century year divided by 400 is leap year
if (year % 400 == 0) and (year % 100 == 0):
    print("{0} is a leap year".format(year))

# not divided by 100 means not a century year
# year divided by 4 is a leap year
elif (year % 4 ==0) and (year % 100 != 0):
    print("{0} is a leap year".format(year))

# if not divided by both 400 (century year) and 4 (not century year)
# year is not leap year
else:
    print("{0} is not a leap year".format(year))

You can now run your code using the terminal. Type in:

damner@codedamn:~/code$ python3 script.py

This will execute the code an show the output in the integrated terminal

damner@codedamn:~/code$ python3 script.py
Enter a year: 2000
2000 is a leap year

Frequently asked questions

Upgrade to codedamn Pro Plan and unlock more courses for accelerated learning. Unlimited courses, interactive learning and more.

Free

  • HD video content
  • Certificate of completion
  • Mentorship from codedamn staff
  • Full learning path unlocked
  • Unlimited playgrounds/compiler usage

Pro

  • HD video content
  • Certificate of completion
  • Mentorship from codedamn staff
  • All exclusive courses unlocked
  • Unlimited playground/compiler usage
Try codedamn Pro (14-day free refund)