You are on page 1of 1

Creating a Comment

Comments starts with a #, and Python will ignore them:

In [ ]:
#print("Hello, World!")

print("Good Morning")

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:

In [ ]:
#This is a comment

#written in
#more than just one line

print("Hello, World!")

Semicolon (;) is optional at the end of the statement in Python


In [ ]:
a = 5

print(a)

b = 19;

print(b)

The semicolon in python is used to denote separation rather than termination.


In [ ]:
print("hii");print("hello");print("good morning")

The print () function, we display output on the screen in python


In [ ]:
print("Good Night")

The input () function, we take input from a user


In [ ]:
name = input("enter your name")

print(name)

Indentation in Python
Indentation means white spaces are used to delimit a block.Python uses a combination of colon (:) and indentation to indicate a block

In [ ]:
if 5>2:

print("Five is greater than two")

In [3]:
if 5>2:#proper spacing is not given.o it throws error

print("Five is greater than two")

File "C:\Users\Lenovo\AppData\Local\Temp/ipykernel_29820/1392400328.py", line 2

print("Five is greater than two")

^
IndentationError: expected an indented block

Python is casesensitive
It means it treats Uppercase and lowercase differently

In [2]:
print("Hello World")

Print("hello")#Print is in Uppercase,so it throws error

Hello World

---------------------------------------------------------------------------

NameError Traceback (most recent call last)

~\AppData\Local\Temp/ipykernel_29820/3335447303.py in <module>

1 print("Hello World")

----> 2 Print("hello")

NameError: name 'Print' is not defined

In [ ]:

You might also like