First/Simple program in Python Language

This is a simple program, But I recommend you to install some python development environment like Anaconda or Pycharm and start learning the basics of python, like data types, control structures and functions, Then moving on to more advanced topics such as object-oriented programming, file input and output, and modules. This is a good way to get a strong foundation in Python and be able to write more complex programs.

This program demonstrates some of the basic concepts in Python such as:

  • Comments: Lines that start with a # character are ignored by the Python interpreter and are used to provide explanations or notes in the code.
  • Variables: Variables are used to store data in the program. In this case, we have two variables name and age which we are storing data as string and integer respectively.
  • Printing: The print function is used to display text or variables on the console. In this case, we are using the print function to print a string with the value of the name variable and also a string with the value of the age variable.
  • Conditional statements: Conditional statements are used to make decisions in the program. Here, we are using an if-else statement to check if the value of the age variable is greater than or equal to 18. If it is, the program will print "I am an adult." otherwise it will print "I am a minor."


You can run this program by saving it in a file with a .py extension and then running it using the python interpreter. On the command line, you can navigate to the directory where you saved the file and then run the following command:



This will execute the code in the file and the output of the program will be:


This is just a simple example program, but it demonstrates some of the fundamental concepts in Python such as variables, printing, and conditional statements, which are the building blocks of any program.


No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.