python

Built-in and user defined functions in Python

# Built-in functions in Python [importing math package] import math x=int(input(“Enter any number:”)) print(“Square root of {0} is {1}”.format(x,math.sqrt(x))) print(“Square of {0} is {1}”.format(x, x*x)) print(“Cube of {0} is {1}”.format(x, x*x*x)) OutPut: Enter any number:5 Square root of 5 is 2.23606797749979 Square of 5 is 25 Cube of 5 is 125   User-defined functions  def …

Built-in and user defined functions in Python Read More »

Share

Python Programs for Beginners – Part2

Basic Python Programs for Beginners – Part 2 # program to display employee salary information name=input(“Enter Name:”) dept=input(“Enter Department:”) basic=int(input(“Enter Basic salary:”)) bonus=basic*(5/100) pf=basic*(10/100) net=basic+bonus-pf print(“Employee Details”) print(“—————————–“) print(“Name=”, name) print(“Basic=”, basic) print(“Bonus=”, bonus) print(“Provident Fund=”, pf) print(“Net salary=”, net) OUTPUT: Enter Name:Ganesh Enter Department:Finance Enter Basic salary:25000 Employee Details —————————– Name= Ganesh Basic= 25000 …

Python Programs for Beginners – Part2 Read More »

Share

Python Programs for Beginners – Part1

Basic Python Programs for Beginners – Part 1 Watch This Video session for How to Run your First Python Program # Sum of two numbers program on python a=int(input(“Enter Num1:”)) b=int(input(“Enter Num2:”)) c=a+b print “sum of {0} and {1} is {2}” .format(a,b,c) c=a-b print “subtraction of {0} from {1} is {2}”.format(a,b,c) c=a*b print “muliplication of …

Python Programs for Beginners – Part1 Read More »

Share

How to run python programs on wamp server

How to run python in wamp server and mysql connectivity using python program Steps: Create a simple python program file as following. #!C:/Python27/python.exe print “Content-type: text/html\n” print “<h1 align=center>Python programming</h1>” print “<hr>” print “<h2>Hello, world!</h2>” 2. Save above file as “test.py ” in wamp ->www directory 3. Start wamp server 4. Open browser and type …

How to run python programs on wamp server Read More »

Share
Share
Scroll to Top