''' Created on 7 Oct 2015 @author: Hugos ''' from random import randint, seed def main(): # List all even numbers in 'data' data = range(10) # Numbers 0 - 9 in a list even = [x*2 for x in data if x < 5] # Modify here print even # List all even numbers in 'data' that also aren't divisible by 8. data = range(100) # Numbers 0 - 99 in a list No8per100 = 100/8 Div8 = range(No8per100+1) Div8list = [x*8 for x in Div8] div28 = [] # Modify here print div28 # Uniqely list all numbers occuring ONLY 3 times in 'random_nbrs' #seed(10) #random_nbrs = [randint(0, 25) for x in range(100)] #triples = [] # Modify here #print triples # Test whether the following strings are palindromes. #str1 = 'sator arepo tenet opera rotas' #str2 = 'palindrome' #str3 = 'ni talar bra latin' # Also extract all unique vowels in each of the strings defined above. # Note: The vowels don't have to be listed in alphabetic order. #vow1 = None # Modify here #vow2 = None # Modify here #vow3 = None # Modify here #print vow1 # ['a', 'e', 'o'] #print vow2 # ['a', 'i', 'e', 'o'] #print vow3 # ['i', 'a'] # Following this comment are three numbers. The first is a pandigital happy # number, the two other form a prime twin (with 100 355 digits each!). # Develop some code to check whether any of these numbers are palindromic. #nbr1 = 1034567892987654301 #p1 = 65516468355 * 2**333333 + 1 #p2 = 65516468355 * 2**333333 - 1 if __name__ == '__main__': main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question