PYTHON BASIC PROGRAMS
#1.Hello world program. print ( "Hello World" ) #2.Addition of two numbers. a= int ( input ( "Enter the first number" )) b= int ( input ( "Enter the second number" )) print (a+b) #3.To find the square root &$ check the program. a= float ( input ( "enter the number" ) # b= a ** 0.5 print (b) #4.To find area of triangle. a= float ( input ( "enter the base of triangle" )) b= float ( input ( "enter the height of triangle" )) c=( 1 / 2 )*a*b print ( "The area of triangle is" , c) OR a= float ( input ( "enter the base side of triangle" )) b= float ( input ( "enter the 2nd side of triangle" )) c= float ( input ( "enter the 3rd side of triangle" )) d=(a+b+c)/ 2 area=(d*(d-a)*(d-b)*(d-c))** 0.5 print (area) #5.Swapping 2 variables. a= int ( input ( "enter the number1" )) b=( int ( input ( "enter the second...
Comments