Directory[]

SetDirectory["Desktop/today"]

Directory[]

Directory[]

SetDirectory[".."]

data = Import["survey.csv"];

SetDirectory["today"]

data // TableForm

How many 18 year old women are there ?

n = 0;   
Do[

,{i, start, 
        end}
]

Length[data]

Dimensions[data]

gender = 1;  age = 2;

data[[2, gender]]

data[[3, gender]]

data[[2, age]]

data[[3, age]]

n = 0;   
Do[
If[ 
        data[[i, gender]]  ==  "f"  &&  
          data[[i, age]] == 18,  
        n = n + 1]
, {i, 2, 
        87}
]

n

\(ageCounts = Table[0, {30}]; \  (*\ 
      how\ many\ people\ for\ each\ age\ *) 
Do[
If[\ 
        data[\([i, gender]\)]\  == \ "f"\ , \(ageCounts[\([\ 
              data[\([i, age]\)]\ \ ]\)]++\)\ ]
, {i, 2, 
        87}
]\)

?Table

ageCounts

<< Graphics`Graphics`

BarChart[ageCounts]

Options[BarChart]

?*Code*

ToCharacterCode["Hello"]

ToCharacterCode["A"]

ToCharacterCode["Z"]

ToCharacterCode["a"]

ToCharacterCode["z"]

isLetter[char_] := 
        Module[{}, 
num = ToCharacterCode[
                char][[1]]; 
If[ 
            num ≥  97  &&  num ≤ 122,  
            Return[True]]; 
If[
            num ≥  65  &&  num ≤  90,  
            Return[True]]; 
Return[
            False];
];

isLetter["a"]

isLetter[" "]

text = Import["Ishmael.txt"]

StringTake[text, {1, 1}]

StringTake[text, {2, 2}]

\(\(\( (*\ 
      look\ for\ a\ word\ starting\ at\ index\ i . 
This\ doesn' t\ handle\ the\ end\ of\ the\ text\ string\ well\ \(\(yet\)\(.\)\)
\ *) \)\(
\)\(findWord[\ text_] := 
        Module[{word, char}, 
 (*\ 
            move\ the\ index\ ahead\ until\ we\ find\ the\ start\ of\ a\ word\ *) 
While[\ ¬ isLetter[\ 
                StringTake[
                  text, {i, 
                    i}]], \ \(i++\)]; 
word = ""; 
char = 
            StringTake[text, {i, i}]; 
While[\ \ isLetter[\ 
              char], 
word = 
              word <> char; 
\ 
            i = i + 1; 
char = 
              StringTake[
                text, {i, 
                  i}]
\ ]; 
Return[
            word];
];\)\)\)

i = 1;
findWord[text]

findWord[text]

¬  isLetter[ StringTake[text, {5, 5}]]

?!

¬

i = 1;
Do[Print[findWord[text]], {10}]

?Import

ToCharacterCode["fish"]

Total[%]

?Mod

Prime[1000]

hashFunction[word_] := 
        Module[{first, second}, 
first = 
            ToCharacterCode[word]; 
second = 
            Table[(10^i), {i, 1, 
                StringLength[word]}]; 
Return[
            Mod[Total[ first  second ], 
              7919]];
];

a = ToCharacterCode["fish"]

b = Table[(10^i), {i, 1, StringLength["fish"]}]

a * b

hashFunction["fish"]

hashFunction["George"]

hashFunction["evil"]

hashFunction["live"]