What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-27 21:25:09
python odd or even
# Python program to check if the input number is odd or even. # A number is even if division by 2 gives a remainder of 0. # If the remainder is 1, it is an odd number. num = int(input("Enter a number: ")) if (num % 2) == 0: print("{0} i... Add solution -
Other 2022-03-27 06:20:31
smallest and largest number
# Python program to find largest # number in a list # list of numbers list1 = [10, 20, 4, 45, 99] # sorting the list list1.sort() # printing the last element print("Largest element is:", list1[-1]) Add solution -
Python 2022-03-27 01:50:04
how to reverse word order in python
## initializing the string string = "I am a python programmer" ## splitting the string on space words = string.split() ## reversing the words using reversed() function words = list(reversed(words)) ## joining the words and printing print(" ... Add solution -
Python 2022-03-13 07:05:06
second max from list python
# Python program to find largest # number in a list # list of numbers list1 = [10, 20, 4, 45, 99] # sorting the list list1.sort() # printing the second last element print("Second largest element is:", list1[-2]) Add solution -
Python 2022-03-06 11:10:04
python permutation
# A Python program to print all permutations using library function from itertools import permutations perm = permutations([1, 2, 3]) for i in list(perm): print (i) # (1, 2, 3) # (1, 3, 2) # (2, 1, 3) # (2, 3, 1) # (3, 1, 2) # (3, 2, 1) Add solution -
Python 2022-03-06 03:35:38
python find factors of a number
# Python Program to find the factors of a number # This function computes the factor of the argument passed def print_factors(x): print("The factors of",x,"are:") for i in range(1, x + 1): if x % i == 0: print(... Add solution
Best helpers
Ranking is empty