Python First Program “Hello World”

Python First Program “Hello World”

Code in python so let’s start code that gives your output “Hello World!”.

Code: print(“Hello World!”)

Python coding rules and naming conventions:

  • Python files have the
  • In python to show output use print (‘’) command.
  • Single quote and double quote work same
  • Python coding follow indentation format, does not use braces to indicate blocks of code for function and class
  • Python programming is case sensitive.
  • Class names start with an uppercase letter.
  • Starting an identifier name with a single leading underscore indicates that the identifier is private.
  • Starting an identifier name with two leading underscores indicates a strong private identifier.
  • Python Statement ends with a new line.
  • Multiline statement can be represent by continuation character (\) to show that the line is continues.

Code: sentence= first statement \

Second statment  \

Third statement

  • And In case of [], {}, or () brackets statement cannot need continuation ‘/’, we will explain it more in tuple, dict, list data type.

Code: weekday=[‘Monday’, ‘Tuesday’, ‘Wednesday’,

‘Thursday’, ‘Friday’, ‘Saturday’, ‘Sunday’]

  • Single quote ‘hello’, double quote “My name is jack”, triple quotes denote string literal.
  • The triple quotes work as span/multiline for example:-

Code: paragraph = “””This is a paragraph. It is

made up of multiple lines and sentences.”””

  • Comment in python with #
  • Waiting for user command

Code: input(“\n\nPress the enter key to exit.”)

  • “\n\n” is help to create two new lines before displaying the next line.
  • Multiline python statement in a single line can be separated by semicolon (;)

Code: import math; x = 19; y=20, z=(x + y)

  • Set of statement or code is call “suite” in python

Code: if expression :


else :



Python programming reversed keywords

All the Python keywords contain lowercase letters only. Reserved words we cannot use them as constants or variables or any other identifier names.

Leave a Reply

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