Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First Python Program
print("Hello, World!")

if 3 > 1:
 print("Three is greater than one!")
 These are the very very basic Python syntaxes.

In order to test your python programs / scripts you first need to download and install IDLE which will make it a lot easier for you to write and test your programs.

All Python script must end with the py extension, pretty much like windows executables .exe, JavaScript's extension js. PHP's extension php, and so on.. You get the idea.

If you are coming from a different programming language such as Java, Delphi, C++, C# or any other language the concept is pretty much the same, even if their syntaxes are different.

Python is not as complicated as some other scripting or programming languages, its syntaxes are straightforward.
So at your keyboards.

x = " is great "
y = " Python "
print(y + x)
Result Python is great
x = " is great "
print(" Python " + x)
Result Python is great
As you can see the above two examples, show that you can either concatenate two string variables or one variable and another string in the Python's print()  function.
I could a couple of syntaxes here
Python is perhaps one of the easiest programming languages around, Python is OOP driven PL.
But make no mistake it gets tougher as you dive into it, it's easier to start with but it can get very very complicated especially if you're coming from another programming language, such as C, C++, Java etc..

x = 3
y = "Mike"
You could also do this instead.

print(x, y) #The difference is that it will print the two results on the same line
The above snippet is very very basic.

Forum Jump:

Users browsing this thread: 1 Guest(s)