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
error: module importing failed: ('invalid syntax', ('temp.py', 1, 27, 'import fruitstrap_00008020-001839583A98002E\n')) | |
backtrace unavailable |
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
class String | |
def word_count | |
freq = Hash.new(0) | |
downcase.scan(/\w+/) { |word| freq[word] += 1 } | |
return freq | |
end | |
end | |
puts %{Dogs dogs dog dog dogs.}.word_count |
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
triangular_numbers = Enumerator.new do |yielder| number = 0 | |
count = 1 | |
loop do | |
number += count | |
count += 1 | |
yielder.yield number | |
end | |
end | |
class Enumerator |
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() | |
{ | |
string s("chris sederqvist"); | |
if (s.begin() != s.end()) |