What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-19 20:55:11
how to insert an element to the end of the list using insert in python
Syntax : list(index, item) >>> numbers = [1, 2, 3] >>> numbers [1, 2, 3] >>> numbers.insert(len(numbers), 4) #len(list) as index to insert item at the end of list >>> numbers [1, 2, 3, 4] >>> numbers.insert(4,... Add solution -
Python 2021-10-01 14:14:05
stack program in python 3
>>> myStack = [] >>> myStack.append('a') >>> myStack.append('b') >>> myStack.append('c') >>> myStack ['a', 'b', 'c'] >>> myStack.pop() 'c' >>> myStack.pop() 'b' >>> myStack.pop() '... Add solution -
Python 2021-09-22 19:58:03
prime number and fibonacci series in python
import math num = int(input()) def isPrime(num): if num == 2 or num == 3 or num == 5 or num == 7: prime = True elif num % 2 == 0 or num % 3 == 0 or num % 5 == 0 or num % 7 == 0: prime = False elif math.ceil(math.sqrt(num)) -... Add solution -
Python 2021-09-20 08:44:02
stack example in python
#using doubly linked list from collections import deque myStack = deque() myStack.append('a') myStack.append('b') myStack.append('c') myStack deque(['a', 'b', 'c']) myStack.pop() 'c' myStack.pop() 'b' myStack.pop() 'a' myStack.pop() #Traceback (most ... Add solution