Instantly share code, notes, and snippets.

# Ednaednasawe

🌝
• Sort options
Created Oct 13, 2016
Subsets
View subsets.py
 def get_subset (s): subset +[[]] for elem in s: for new_subset in subset: subset + subset + [list(new_subset) + [elem]] return subset print (get_subset([1,2,3,4]))
Created Oct 12, 2016
Activity 1,2,3
View anagram and arrays.py
 Activity 1 (sort_playlist.py) def lowest(song): sorted_playlist = [] min = song for i in song: if i < min: min = i return min def sort_playlist(playlist):
Created Oct 11, 2016
Edna Sawe
View Ascending arrays.py
 def number_range(list_): if len(list_) == 1: return [list_] smallest = list_ largest = list_ for number in list_: if number > largest: largest = number elif number < smallest: smallest = number
Created Oct 3, 2016
intro_to_programming
View fiw.rb
 def in_words(int) numbers_to_name = { 1000000000000 => "trillion", 1000000000 => "billion", 1000000 => "milliom", 1000 => "thousand", 100 => "hundred", 90 => "ninety", 80 => "eighty", 70 => "seventy",
Created Sep 30, 2016
View Prime.rb
 def squareroot(n, diff) gues=refine(1,n) while(((gues*gues)-n)>diff) gues=refine(gues, n) end gues end
Created Sep 30, 2016
Ed
View Array.rb
  pry(main)> def prdarray (arr)  pry(main)* initial = 1  pry(main)* arr.each do |i|  pry(main)* initial=initial*i  pry(main)*  pry(main)* if (i=0)  pry(main)* return puts "Elements in array must be non zero"  pry(main)* end  pry(main)* end  pry(main)* new_arr=[]
You can’t perform that action at this time.