What do you want to save?
Add Code snippet
New code examples
-
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-11 18:00:01
run python script on heroku
Sure, you need to do a few things: Define a requirements.txt file in the root of your project that lists your dependencies. This is what Heroku will use to 'detect' you're using a Python app. In the Heroku scheduler addon, just define the command you ne... 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-05 09:35:20
tuples in python
# A tuple is a sequence of immutable Python objects. Tuples are # sequences, just like lists. The differences between tuples # and lists are, the tuples cannot be changed unlike lists and # tuples use parentheses, whereas lists use square brackets. tup1 =... Add solution -
Python 2022-02-18 04:15:19
python list pop equivalent
# Python list method pop() removes # and returns last object or obj from the list. # .pop() last element .pop(0) first element my_list = [123, 'Add', 'Grepper', 'Answer']; print "Pop default: ", my_list.pop() > Pop default: Answer # List up... Add solution -
Python 2022-01-31 05:15:37
python wikipedia
import wikipediaapi wiki = wikipediaapi.Wikipedia("en") page = wiki.page("Python (programming language)") print(page.summary) # Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy... Add solution -
Python 2022-01-31 01:46:40
tuple in python
# A tuple is a sequence of immutable Python objects. Tuples are # sequences, just like lists. The differences between tuples # and lists are, the tuples cannot be changed unlike lists and # tuples use parentheses, whereas lists use square brackets. tup1 =... Add solution