Code Studio: Letters and Vectors
Build on Practice: Vectors, Challenge 1.
- Make a vector
xwith the numbers 1 through 26. - Multiply it by 2.
- Name its elements A through Z using the built-in vector
LETTERS. - The program reads one capital letter from the Input tab. Print the value stored under that name, using
x[[letter]].
For an input of C, the output is 6.
Bonus to try with Run: what's the difference between x["C"] and x[["C"]] when you print them?
Build on Practice: Vectors, Challenge 1.
- Make a vector
xwith the numbers 1 through 26. - Multiply it by 2.
- Name its elements A through Z using the built-in vector
LETTERS. - The program reads one capital letter from the Input tab. Print the value stored under that name, using
x[[letter]].
For an input of C, the output is 6.
Bonus to try with Run: what's the difference between x["C"] and x[["C"]] when you print them?