Programming with Python Class 3

My first program

In this first python program, we are going to display the text “Hello world” on the console.

With the IDLE we open the attached file primerprograma.py and execute it

# Python course firstprogram.py
print (“Hello world! \ n”)

If we compare it with the same program in C

/ * Course C – section 2 – first program.c * /

#include “pch.h”
#include <iostream>

int main ()
{
printf (“Hello world! \ n”);
}

We are already seeing some points of the python syntax.

Comments start with #

It is not necessary to put; at the end of each line

The program has no entry point (main)

You don’t have to compile it just run it directly for the python interpreter to start executing the program

Leave a Reply

Your email address will not be published. Required fields are marked *