What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-18 12:42:02
print even numbers in python
# Print even numbers python lower_limit = 0 max_limit = 100 for i in range(lower_limit, max_limit): if i%2 == 0: # even numbers are divisible by 2. i%2 will give the remainder when i is divided by 2. if i is even, the remainder will always be 2. pr... Add solution -
Python 2021-09-17 17:21:03
split list into list of lists python on every n element
big_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] x = 4 list_of_lists = [big_list[i:i+x] for i in range(0, len(big_list), x)] # [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] Add solution -
Python 2021-09-17 01:54:03
dynamic matrix in python
# A basic code for matrix input from user R = int(input("Enter the number of rows:")) C = int(input("Enter the number of columns:")) # Initialize matrix matrix = [] print("Enter the entries rowwise:") # For use... Add solution -
Python 2021-09-16 19:31:02
python program to print prime numbers in an interval
lower = 800 upper = 900 print("Print the number's from ",lower," and ",upper,".") for num in range(lower,upper + 1): if num > 1: for i in range(2, num): if (num % i) == 0: break else: print(nu... Add solution -
Python 2021-09-16 17:14:01
python vernam cipher
vernam_dict = dict((i, chr(i + 96)) for i in range(1, 27)) # Vernam by replacing char of plain by char(ord(sum of plain and key)) def vernam_encrypt(plain, key): plain = plain.lower() ckey = ''.join([(key[i % len(key)]) for i in range(len(list(pla... Add solution
Best helpers
Ranking is empty