Blog

python tutorials and learn python

Created with Sketch.

Python program to copy odd lines of one file to other

  Python program to copy odd lines of one file to other Write a python program to read the contents of a file and copy only the content of odd lines into a new file. Examples: Input : Hello World Python Language Output : Hello Python Input : Python Language Is Easy Output : Python…
Read more

Python program to check if a string contains all unique characters

Python program to check if a string contains all unique characters To implement an algorithm to determine if a string contains all unique characters. Examples: Input : s = “abcd” Output: True “abcd” doesn’t contain any duplicates. Hence the output is True. Input : s = “abbd” Output: False “abbd” contains duplicates. Hence the output…
Read more

Python Program for Legendre\’s Conjecture

Python Program for Legendre\’s Conjecture It says that there is always one prime number between any two consecutive natural number\’s(n = 1, 2, 3, 4, 5, …) square. This is called Legendre\’s Conjecture. Conjecture: A conjecture is a proposition or conclusion based upon incompleate information to which no proof has been found i.e it has…
Read more

Python Program for Number of solutions to Modular Equations

Python Program for Number of solutions to Modular Equations Given A and B, the task is to find the number of possible values that X can take such that the given modular equation (A mod X) = B holds good. Here, X is also called a solution of the modular equation. Examples: Input : A…
Read more

Python program to convert floating to binary

Python program to convert floating to binary Python doesn’t provide any inbuilt method to easily convert floating point decimal numbers to binary number. So, Let’s do this manually. Approach : To convert a floating point decimal number into binary, first convert the integer part into binary form and then fractional part into binary form and…
Read more