This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require 'capybara/culerity' | |
=> true | |
irb(main):002:0> session = Capybara::Session.new(:culerity) | |
=> #<Capybara::Session> | |
irb(main):003:0> session.visit('http://www.vg.no') | |
Capybara::DriverNotFoundError: no driver called :culerity was found, available drivers: :rack_test, :selenium | |
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.5.0/lib/capybara/session.rb:82:in `driver' | |
from /Library/Ruby/Gems/2.0.0/gems/capybara-2.5.0/lib/capybara/session.rb:232:in `visit' | |
from (irb):3 | |
from /usr/bin/irb:12:in `<main>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def rand7(): | |
return random.randrange(1,8) | |
def rand5_mod(): | |
return rand7() % 5 + 1 | |
def rand5_recursive(): | |
roll = rand7() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"cells": {"1": "one", "2": "two"} | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main () { | |
System.err.println(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#return fitness of a path | |
def fitness(path): | |
pass | |
#swap two random indices | |
def random_swap(l): | |
i = randint(0,len(l) - 1) | |
j = randint(0,len(l) - 1) | |
l[i], l[j] = l[j], l[i] | |
return l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'terminal-table/import' | |
class SubsetSumMatrix | |
class << self | |
def create_empty_for(array) | |
matrix = [] | |
header = [nil] + build_header_from(array) | |
matrix << header | |
array.each_with_index do |element,i| | |
row = header.collect{|value| 'F'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Task 9.5 - Arnab Kumar Datta (arnabkd) | |
import operator,random | |
levels = {'B' : 10 , 'I': 25 , 'A':100} | |
func = {'add': operator.add, 'mul' : operator.mul, 'sub' : operator.sub} | |
ops = {func['add'] : '+' , func['mul'] : '*', func['sub'] : '-'} | |
messages = ['Please ask your math teacher for help!','You need more practice.',\ | |
'Well done!'] | |
def play(level,op): | |
operand1 = random.randint(1,level); operand2 = random.randint(1,level) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
players = ['Tie','Player','Computer'] | |
scores = [0,0,0] | |
choices = {'r':0 , 'p':1 , 's':2} | |
inv_choices = {0:'rock', 1:'paper', 2:'scissors'} | |
def main(): | |
try: | |
post = int(raw_input("Enter number of points required to win: ")) | |
except: |
NewerOlder