- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Jayashree has Published 41 Articles
Jayashree
102 Views
This can be corrected by putting n+1 in brackets i.e. (n+1)for num in range(5): print ("%d" % (num+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.
Jayashree
365 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.>>> from collections import ... Read More
Jayashree
315 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>>> s1={1, 2, 3, 4, 5} >>> s2={4, 5, 6, 7, 8} >>> s1.union(s2) {1, 2, 3, 4, 5, ... Read More
Jayashree
86 Views
The method modf() returns the fractional and integer parts of x in a two-item tuple. Both parts have the same sign as x. The integer part is returned as a float. First item in tuple is fractional part>>> import math >>> math.modf(100.73) (0.730000000000004, 100.0) >>> math.modf(-5.55) (-0.5499999999999998, -5.0)
Jayashree
737 Views
Following program accepts a number and index from user. The recursive funcion rpower() uses these two as arguments. The function multiplies the number repeatedly and recursively to return power.Exampledef rpower(num, idx): if(idx==1): return(num) else: return(num*rpower(num, idx-1)) base=int(input("Enter number: ")) exp=int(input("Enter ... Read More
Jayashree
3K+ Views
Multiplication of two matrices is possible only when number of columns in first matrix equals number of rows in second matrix.Multiplication can be done using nested loops. Following program has two matrices x and y each with 3 rows and 3 columns. The resultant z matrix will also have 3X3 ... Read More
Jayashree
667 Views
Principle used in following solution to this problem is to divide given number with all from 3 its square root, a number's square root is largest possible factor beyond which it is not necessary to check if it is divisible by any other number to decide that it is prime ... Read More
Jayashree
2K+ Views
If a function calls itself, it is called a recursive function. In order to prevent it from falling in infinite loop, recursive call is place in a conditional statement.Following program accepts a number as input from user and sends it as argument to rsum() function. It recursively calls itself by ... Read More