PYTHON FUNCTIONS

Python function



1. print()

        print feature of Python is similar as other languages. In Python to use print feature we writes the word/sentence with in bracket with "" .

 






Important Rules for print() feature


  • Python is a case sensitive programing language. Python differentiates between capital and small alphabet letters. 
  • While using print() feature it is must to remember that you can not write  print() as Print() 
 

Examples for print() feature 

Input:
print ("Hello World!")

Output:



Using print() as calculator:


Python follows the principal of BODMAS and uses:
+     Meaning- Adding
-      Meaning- Subtract 
*     Meaning- Multiple 
/      Meaning- Divide


Let us perform a simple calculation using Python:


Write the following code:

For addition-
x=1
y=1
print (x+y)



For Subtraction-

x=1
y=1
print (x-y)




Using type() feature:

Enter this Syntax:

a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33

x = type(a)
y = type(b)
z = type(c)

print(x)
print(y)
print(z)










Operation in a String:

1.)


x="Good"
y="Morning"
print(x+y)



2.)


x="Prakhar"
y="Doneria"
print (x+y)


3.)


print ("Python_" * 6)




Top Free programs:






1.Program to find area of rectangle-


l=enter the length 
b=enter the breath 
area=l*b
p=2*(l+b)
print("perimeter of a rectangle = " , p)
print("area of a rectangle = " , area)










Tap on Image



Promotion.

HTML tutorial

Comments

Popular posts from this blog

What is a Blogs? How to create account on Blog?

What is JAVASCRIPT?How to make a program using HTML and Java | "Hello World" | Prakhar Doneria

HOW TO ADD PIE CHART IN HTML | PRAKHAR DONERIA