Languages & Syntax
Spoken and programming languages treated as the same kind of system: Python and Ruby syntax alongside Spanish and Italian cognate patterns.
-
Using Spanish as a Cheat Code for Italian: Cognate Patterns That Actually Work
Learning a third or fourth language gets easier — not because you get smarter, but because you stop starting from zero. I’m fluent in Spanish, conversational in French, and currently building Italian. Every time, the fastest gains come from hunting for overlap before I even open a vocab list. This is that overlap, laid out the way I wish someone had handed it to me on day one. A working map of where these languages line up, and where they don’t. Why Spanish helps with Italian at all Spanish, French, Italian, Portuguese, and Romanian all descend from Latin, specifically Vulgar Latin, with the word “vulgar” coming from vulgaris, meaning “of…
-
What is a program?–Notes…
What is a program? A program is a sequence of instructions that specifies how to perform a computation. A few basic instructions appear in just about every language: input–get data from a keyboard, a file, or some other device. output–display data on the screen or send data to a file or other device. maths–perform basic mathematical operations like addition & multiplication. conditional execution–check for certain conditions and execute the appropriate sequence of statements. repetition–perform some action repeatedly, usually with some variation. That’s pretty much all there is to it! Every program is made up of instructions that look more or less like these! We can describe programming as the process…
-
Phonetic Alphabet
A–> Alpha B–> Bravo C–> Charlie D–> Delta E–> Echo F–> Foxtrot G–> Golf H–> Hotel I–> India J–> Juliett K–> Kilo L–> Lima M–> Mike N–> November O–> Oscar P–> Papa Q–> Quebec R–> Romeo S–> Sierra T–> Tango U–> Uniform V–> Victor W–> Whiskey Y–> Yankee Z–> Zulu
-
What is GIT? GIT–Version Control System
What is GIT? Git is a popular Version Control System. The aim of Git is to manage software development projects, and its files, as they are changing over time. Git stores this information in a data structure called a repository! A git repository is a central place where developers store, share, test and collaborate on web projects. A repository is kind of like an enhanced Unix directory, or folder, but with the additional ability to track changes to every file and subdirectory. The way to create a new repository with Git is with the “init” command (short for “initialize”_, which creates a special hidden directory called “.git”, where Git stores…
-
More Notes!!! [Ruby Programming Language Notes]
Global Variables–Variable References Lecture $–Use this sign to create a global variable in Ruby. Ex: def say_hello $message = “hello globe” end say_hello p $message # => “hello globe” More Methods! object_id can be used to see what memory location a particular variable points to . ex: variable.object_id => 7018903, or whatever number the computer assigned. Initializing an Array! *(Variable References Lecture) So we know that ‘arr = [ ]‘ will create a new empty array. We can use ‘arr = Array.new()‘ to initialize an array of a certain length by passing the length we want into the parameter (argument). ex: Array.new(3) #a new array with 3 elements => [nil,…
-
Sorting &Swapping Elements, & Bubble Sort Algorithms!!! [Ruby Programming Language Notes]
Sorting & Swapping Elements, & Bubble Sort Algorithms!!! Algorithm a sequence of actions to take! Sorting Algorithms Swapping Elements Operation: array = [“a”, “b”, “c”, “d”] #let’s swap “a” & “b” temp = array[0]; #save a copy of the first ele array[0] = array[1]; #overwrite the 1st ele with the 2nd ele array[1] = temp; #overwrite the 2nd ele with the 1st ele copy p array # => [“b”, “a”, “c”, “d”] This works but is a bit messy. Ruby has a clean shortcut (that also works in Python!)! array = [“a”, “b”, “c”, “d”] #let’s swap “a” & “b” array[0], array[1] = array[1], array[0] p array # => [“b”,…
-
Symbols!!! [Ruby Programming Language Notes]
Symbols in Ruby Symbols are an additional data type, similar to strings, but different. str = ” “ strings are wrapped in quotes. Symbol = : symbols begin with a colon. Ex: str = “hello # the string sym = :hello # the symbol p str.length # => 5 p sym.length # => 5 p str[1] # => “e” p sym[1] # => “e” p str == sym # => false #Lesson…A string is DIFFERENT from a symbol! Strings are mutable (can be changed, or mutated). Symbols are immutable (can never be changed, or mutated). Because strings are mutable, they are always stored in a new memory location (even if…
-
More Common Enumerable Methods!!! [Ruby Programming Language Notes]
More Common Enumerable’s .all?–return ‘true’ when all elements result in true when passed into the block. Ex: p [2,4,6].all? { |el| el.even? } # =>(returns) true Ex: p [2,3,6].all? { |el| el.even? } # => false .any?–return ‘true’ when at least one element results in true when passed into the block Ex: p [3,4,7].any? { |el| el.even? } # => true Ex: p [3,5,7].any? { |el| el.even? } # => false .none?–return ‘true’ when no elements result in true when passed into the block. Ex: p[1,3,5].none? { |el| el.even? } # => true Ex: p[1,4,5].none? { |el| el.even? } # => false .one?–return ‘true’ when exactly one element results in…
-
Array-Giving Enumerables!!! [Ruby Programming Language Notes]
array.map–allows us to take in an array and modify it a certain way. (Returns a new array!) (This can let us skip the step of shoveling a desired result into a new array[].) arr = [“a”, “b”, “c”, “d”] Old way: new_arr = [ ] arr.each { |ele| new_arr << ele.upcase + “!” } print new_arr puts Output: [“A!”, “B!”, “C!”, “D!”] New way with .map: arr = [“a”, “b”, “c”, “d”] #(.map is still an enumerable, so when we call it we have to pass in a block.) #This block accepts the element as well, like .each. new_arr = arr.map { |ele| ele.upcase + “!” } #In the block…
-
Hashes–Another Data Structure!!! [Ruby Programming Language Notes]
Hashes! (Another data structure) An array allows us to have a single variable, or location, to store & group a lot of data. (Allows for organization!) An array was the first data structure we learned about. [ ]–An array is made up of elements, organized by indices. But sometimes we may need a different organization when building a program. That’s why we have HASHES!!! A hash is made up of values stored by keys. (A key “unlocks” the corresponding value.) { }–curly braces are used to represent a hash in Ruby. (This can be assigned to a variable.) In a hash, data comes in a pair, (a ‘key value’ pair).…



