Followers

Friday, March 6, 2020

Questions & Answers - Python

Questions & Answers 


Questions:-

Q1.  Program to obtain three numbers and print their sum.
Q2.  Program to obtain the length and breadth of a rectangle and              calculate its area.
Q3.  What will be the output produced by the following code?
                 x, y = 2, 6
                 x, y = y, x+2 
                 print(x, y)
Q4.  Predict the output of the following :-
                 x, y = 7, 2 
              x, y, x = x+1, y+3, x+10 
                 print (x, y)

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



Answers:-

Ans.1-      a = 5
                 b = 6 
                          c = 7 
            Sum = a + b + c 
            print("Sum of all the three No. :", Sum)
     

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


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

⋕You can try this program, just CLICK HERE.

Ans.3-           Output :-    
                                  x = 6
                                  y = 4 
⋕ You can try this program, just CLICK HERE.
⋕ The first line of code assigns 2 and 6 to variables x and y respectively. Next line (Second Line) of code first evaluates the right-hand side i.e., y, x+2 which is 6, 2+2 i.e., 6, 4: Third line prints x and y so the output is 6, 4.      

Ans.4-               Output :- 
                                   x = 17 
                                   y = 5 
  
⋕ You can try this program, just CLICK HERE.
⋕ Same Explanation as Answer No.3. 


So with this, we end with this Q&A post. I will make these types of posts more in the future. And if you have any doubts about this post feel free to contact me through my Email given in the CONTACT US page. You can get the latest updates of my new posts that I upload weekly, I will try my best to upload daily OR you can Sign up for Newsletters at the top of the Blog and that will give you E-mail updates of my New Post.
Jai Hind!!!!
Vande Mataram!!!

No comments:

Post a Comment

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