Followers

Saturday, December 7, 2019

Question and Answers - Python

Question 

Q.1  Write a program to accept the length and the breadth of a                   rectangle and calculate its Area and Perimeter ?
Q.2  Write a program to accept the radius of a circle from user and          calculate the Area and Perimeter ? 
Q.3  Write a Program to swap two no.with using the third variable? 

⋕ To do these questions you should have the knowledge of:-

Answers

Ans.1     Length = int (input ( "enter the length"))
              Breadth = int (input ('enter the breadth"))
                 Area = Length*Breadth 
           Perimeter = 2*(Length+Breadth)
                print("Area :", Area )
                print("Perimeter :", Perimeter)

You can try this Program by your own just using the Online Compiler provided in our website or just CLICK HERE 

You can also take the variable name as 'L' or 'l' and 'B' or 'b' as both of them is correct, I have taken for better understanding. And also be careful  for using the upper case and lower case letters because Python is a case sensitive language. 

Ans.2   Radius = int (input (' enter the radius"))
             Area = (22/7)*Radius*Radius
             Perimeter = 2*(22/7)*Radius 
            print("Area :", Area)
            print("Perimeter :", Perimeter)

Just CLICK HERE to try this program by yourself. 

Ans.3  ⋕Let the first no. be 'a'  , second no. be 'b' and third no. be 'c'. Here 'c' is a temporary variable or a third variable. Now let see how to write this program.
           a = int ( input ("enter the value"))
           b = int ( input ("enter the value"))
           c = a 
           a = b
           b = c 
           print ("value of a :", a , "value of b :", b )

⋕ Just CLICK HERE to try this program by yourself. 

So with this we are end with this Q&A post. I will make these types post more in the future. And if you have any doubt about this post feel free to contact me through my Email given in the CONTACT US page or just comment down below or contact me through the Contact form. So Goodbye meet you in the next post. 
JAI HIND!!! 
VANDE MATARAM!!!!!     

2 comments:

  1. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... 统计作业代写

    ReplyDelete
  2. Thank you so much. I really appreciate you support for this Website. But Please help our Website by sharing this site with your friends and families.

    ReplyDelete

If you have any doubts, please do let me Know.