Let’s talk about Python — Part1

  • Open Source: Python is, and will always be free, and its source code is available to everyone.
  • High Level and Interpreted: Python code has English-like syntax and is executed line by line at a time. We do not need to compile our code which in turn makes it a suitable language for quick prototypes.
  • Dynamically-typed: As the type of the variable is decided at the run-time, we do not need to specify the data type of a variable. We’ll discuss more on this later.
  • Extensive Standard Library: Python provides a large standard library which has a rich set of module and functions. We can simply import these libraries into our code.
  1. Open your terminal
  2. Type vim hello.py (.py is the file format for python scripts) and hit enter
  3. Go to insert mode by pressing i
print("Hello World")

Let’s discuss more on print() function

The print() is a built-in function in python i.e we do not need to import it from anywhere. The parenthesis at the end of the print function tells to execute the function. This will produce an invisible newline character due to which a blank line appears on our screen.

  • New line: It appears when we call print() without any arguments. It is a line comprised of a newline character. It is represented by '\n' in Python.
  • Empty line: It doesn’t contain any character at all, not even a new line. It is represented by '' in Python.
>>> 'Single line text.\n'.rstrip()
'Single line text.'
>>> print("Glad, you're getting better at Python")

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store