Skip to main content

Posts

Showing posts with the label Simple programs to Begin

Simple Programs to Begin With

use IDLE in linux/windows for the program development.Open a file and type the program .Save the file with extension '.py' eg: test.py. From the run menu click run module (F5) to run the program.If you are running the program from command prompt type $python test.py ************************************************************************* #Python Program to find Area and Circumference of a Circle #Standard formula to calculate the Area of a circle is: a=π r². #Circumference c=2 π r. r=input(“Enter radius”) a=3.14159 * r * r c=2* 3.14159 * r print “Area of the circle”,a print “Circumference of the circle”,c ************************************************************************** #Input a time in seconds and print the time in HH:MM:SS format ( university question) time=input("Enter time in seconds") timeinmin=time/60 timeinsec=time%60 timeinhr=timeinmin/60 timeinmin=timeinmin%60 print "HH:MM::SS----",timeinhr,":",timeinmin,":",tim...