Posts

Showing posts from 2021

python comment

Comments can be used to explain Python code. Comments can be used to make the code more readable. Comments can be used to prevent execution when testing code. Creating a Comment Comments starts with a  # , and Python will ignore them: Example #This is a comment print ( "Hello, World!" ) Comments can be placed at the end of a line, and Python will ignore the rest of the line: Example print ( "Hello, World!" )  #This is a comment A comment does not have to be text that explains the code, it can also be used to prevent Python from executing code: Example #print("Hello, World!") print ( "Cheers, Mate!" ) Multi Line Comments Python does not really have a syntax for multi line comments. To add a multiline comment you could insert a  #  for each line: Example #This is a comment #written in #more than just one line print ( "Hello, World!") "" " This is a comment written in more than just one line " "" print ( ...

python syntax and indentation

    Python syntax can be executed by writing directly in the Command Line: >>> print("Hello, World!") Hello, World! Or by creating a python file on the server, using the .py file extension, and running it in the Command Line: C:\Users\ Your Name >python myfile.py Python Indentation Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code. Example if   5  >  2 :    print ( "Five is greater than two!" ) Python will give you an error if you skip the indentation: Example Syntax Error: if   5  >  2 : print ( "Five is greater than two!" ) The number of spaces is up to you as a programmer, but it has to be at least one. Example if   5  >  2 :   print ( "Five is greater than two!" )  if   5  > ...

python introduction

                                                                What is Python? Python is an open source, object-oriented, high-level powerful programming language. Developed by Guido van Rossum in the early 1990s. Named after Monty Python Python runs on many Unix variants, on the Mac, and on Windows 2000 and later. It is used for: web development (server-side), software development, mathematics, system scripting. What can Python do? Python can be used on a server to create web applications. Python can be used alongside software to create workflows. Python can connect to database systems. It can also read and modify files. Python can be used to handle big data and perform complex mathematics. Python can be used for rapid prototyping, or for production-ready software development. Why Python? Python works on different platforms (Wi...