Skip to content

Instantly share code, notes, and snippets.

View ECMessina's full-sized avatar

ECMessina

  • 01:12 (UTC -05:00)
View GitHub Profile
@ECMessina
ECMessina / main.dart
Last active July 16, 2023 21:25
Shift it in reverse
/*
Pass in a String into a function in main()
make a function that returns nothing (printing in function)
set the function to take in a string as a named parameter {}
need to separate the words within and then reverse them finally join them
make a list of the separated words
use . methods to see if any options look like what I need for all 3 actions
attach their action name one at a time and in order
*/
@ECMessina
ECMessina / main.dart
Last active July 16, 2023 21:32
Cha-Ching
/*
Compare a list of winning numbers to your own two tickets! How many matching numbers do you have?
---
Make a list of int above main()
within main() add the two tickets as lists and name them for reference
You're only comparing to one list so keep that name the same
That name will be the name of your void function (to print out at the end of it)
Set the parameter as a list of int
you need to compare ticket 1 to winning numbers and ticket 2 to winning numbers
since you're looking at two lists at the SAME TIME a nested for-in loop is needed
@ECMessina
ECMessina / main.dart
Last active July 16, 2023 21:41
Beer on the WALL
/*
Take the Beer on the Wall song and transition that to code.
Make the number of bottles and the beverage type able to change in main()
void function as you're printing in function
you're going through each step in the loooong song
so a for loop is needed
number of bottles is all you have so the integer to begin with must be the number of bottles
(which in the song goes up to 99) - so that's a parameter
Beverage type in the song is beer - so that's also a parameter
To change both the number of bottles and the beverage type - make them named {} - to easily tell what you're passing in
@ECMessina
ECMessina / main.dart
Last active July 16, 2023 21:56
Fibonacci Quiz
/*
Create a variable in main() and set its value to 50.
make a function outside main() that will return the nth value of the Fib Seq
- this function will take in a named parameter that is an int representing the seq num we wish to find
identify the first two known values of the sequence (0 & 1)
since you're going through all numbers up to that point a for loop is required
start at 3, as the next number to calculate is the third number in the sequence
identify the procedure of the formula to the function for that next number
-knowing the formula is: the next value is the sum of its previous 2
proceed to say how each number changes from there