Type Conversions | Python Assignment

Type Conversion  |  Python Assignment





Assignment helps in increasing the student’s knowledge, his research skills, and his analysis power. It helps in judging one’s performance with others. There are some students who mug up the course work and at the time of the exam they just write down what they have mugged up.


It means you are provided with a topic or a case study with some information about it, you need to incorporate the information and explain the topic or solve the case study. Simply copy-pasting from outside sources are of no help until and unless you have understood what you are being asked to write.


From the beginning of the learning process, students are given certain assignments and homework, to develop their critical and analytical skills. In the initial stages, i.e. if we talk about the elementary schooling part, the complexity level of such assignments remains low, but as a student enters some college or university, the assignments turn into a more complicated and sophistical thing. Though, many of us might still question why we are given assignments, and what is the main purpose behind it? Well, there are many intentions behind giving assignments and homework to students.


With the help of assignments, students get to learn new techniques and specific writing tips that assist them in their academics. Continuous practice is required if you want to excel in this field. Practice leads to an improvement in one’s skills or grabbing a grip on some subject. Thus, assignment writing and homework is a means of this exercise. When students write assignments or do their homework, they come across new problems and equations and discover its relevant solutions on their own, which is why they are given this task to complete at home. The practice also benefits the students by getting them ready for certain unpredicted situations.


Assignment 2: Level: Easy


1. What is the O/P of the following codes:


             int(2.3) : 


             int(False) : 


             int(True) : 


             int(3+4j) : 



2. The following code will give an Error. Change this code according to you that this code will give you the output=16.

    

                            a=10

                            b="6"

                            c=a+b

                            print(c)


3. Predict the O/P of the following codes:


            float(25) : 

            float(False) : 

            float(True) : 

            float(3+4j) : 

            float("0B1010") : 


4. Predict the O/P of the following codes:


                complex(25) : 

                complex(2.5) : 

                complex(True) : 

                complex(False) : 

                complex(0B1010) : 



5. Predict the O/P of the following codes:


            bool(1) : 

            bool(5) : 

            bool(0) : 

            bool(0.0) : 

            bool(0.1) : 

            bool(0B101) : 

            bool(0B0000) : 

            bool(2+3j) : 


            bool('A') : 


6. Predict the O/P of the following codes:


                 str(15) : 


                 str(2.5) : 


                 str(True) : 


                 str(False) : 


                 str(2+3j) : 


                 str(OB101) :

 


7. WAP to concatenate a string and a complex value number.

 


8. By using type conversion  add a boolean to an integer.

 


9. WAP to add a complex number to a float number by using type conversion.

 


10. What does this code do?


        a="A"

        b=24

        c=a+b

        print(c)

 

If this code Error exception then modify this code that this code will concatenate the integer value as a string.

       


 




If You have any doubts about the above mention any question then please ask it in the comment section we will try to help you and solve it as soon as possible.



We hope these questions was helpful in making your concepts more clear. So make sure to share this post to help others and if these assignments really helped you a bit then also leave a comment below sharing your thoughts.



We Make IT Happen.



Copyright  ©  2020  Digital Community. All Rights Reserved

No comments:

Post a Comment

If you have any doubts, let me know.