Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

What is the difference between ++i and i++ in c?

What is the difference between ++i and i++ in c? please tell in detailed manner with a easy example
Answered on 24th Apr, 2018, 0 Views

In C, ++ and -- operators are called increment and decrement operators. They are unary operators needing only one operand. Hence ++ as well as -- operator can appear before or after the operand with same effect.  That means both i++ and ++i will be equivalent. , and  , both will make i=6. However, when increment expression is used along with assignment operator, then operator prec.....

Print a list in Python

What is the output of print list[2] if list = [343 , 22, 50, 100, 25] Please can someone help me with this
Answered on 24th Apr, 2018, 0 Views

List is a sequence of elements. Any element in the sequence is accessible by its position in sequence. The index starts with 0. Hence list[2] will return element at index 2, the third in the list i.e. 50.

Python: Cannot understand why the error - cannot concatenate 'str' and 'int' object ?

Hello Everyone, I am new to Python.  May I know why I am getting the error in the following piece of code (where I am trying to print a value 1 more than the value of num:- , , , Here in the TypeError, what is the 'int' object and what is the 'str' object that are being referred to ?? How can this error be corrected ?? Thanks & Regards, H.C.
Answered on 24th Apr, 2018, 0 Views

This can be corrected by putting n+1 in brackets i.e. (n+1) , Using %d casts the object following % to string. Since a string object can't be concatnated with a number (1 in this case) interpreter displays typeerror.

How to Find HCF or GCD using Python?

How to Find HCF or GCD using Python?                                
Answered on 7th Mar, 2018, 0 Views

Highest Common Factor or Greatest Common Divisor of two or more integers is the largest positive integer that evenly divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4. ,

How to create Ordered dictionaries in Python?

How to create Ordered dictionaries in Python?                                        
Answered on 7th Mar, 2018, 0 Views

An OrderedDict is a dictionary subclass that remembers the order in which its contents are added, It is defined in collections module of Python library. OrderDict remembers the order of addition of key-value pairs in a dictionary ,

What are Ordered dictionaries in Python?

What are Ordered dictionaries in Python?                                                    
Answered on 7th Mar, 2018, 0 Views

An OrderedDict is a dictionary subclass that remembers the order in which its contents are added, supporting the usual dict methods.If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end. ,

Where are operators mapped to magic methods in Python?

Where are operators mapped to magic methods in Python?                                     
Answered on 7th Mar, 2018, 0 Views

You can find the operators mapped to different magic methods here: link

What is the difference between operator and method on Python set?

What is the difference between operator and method on Python set?                                  
Answered on 7th Mar, 2018, 0 Views

Python's set object represents built-in set class. Different set operations such as union, intersection, difference and symmetric difference can be performed either by calling corresponding methods or by using operators. Union by method , , Intersection by method , Intersection & operator , Difference method , Difference - operator ,

How will you explain Python Operator Overloading?

How will you explain  Python Operator Overloading?                               
Answered on 6th Mar, 2018, 0 Views

Every class in Python, whether built-in or user defined is inherited from object class. The object class has a number of properties whose name is preceded and followed by double underscores (__). Each of these properties is a wrapper around a method of same name. Such methods are called special or magic methods. The magic methods __lt__(), __gt__(), __eq__(), __ne__(), etc. are overridden i.....

How to find the value closest to negative infinity in Python?

How to find the value closest to negative infinity in Python?                                             
Answered on 6th Mar, 2018, 0 Views

Although infinity doesn't have a concrete representation, the closest number to negative infinity is represented as return value of float() function with '-inf' as argument ,

1 2 3 4 5 6 7 ... 10 Next
loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.