2015-10-14

posted Oct 14, 2015, 7:37 AM by Samuel Konstantinovich   [ updated Oct 15, 2015, 2:31 PM ]
Some practice problems:
Remember lists? Try these 2 problems that use car and cdr

EDIT: the explode/implode typo is gone. There was no error other than the name, the descriptions and example matched. 

READ THE EXAMPLES HERE, don't just try the problem. Reading saves you time! 
1.
http://bert.stuy.edu/pbrooks/SchemingBat/scheming.py?group=6&ex=24&page=exercise 
Implode3 (Take a 3 element list, turn it into a 3 digit number.) You should be able to do this without new functions
(implode3 '(1 3 4))  results in 134.
(implode3 '(5 2 1))  results in 521.  


2. 
http://bert.stuy.edu/pbrooks/SchemingBat/scheming.py?group=6&ex=22&page=exercise
To help you do this use the list command:
(list 4 2 1) -> (4 2 1)
(list 3) -> (d3)
(define x 3)
(list (+ x 1) (+ 2 3) ) -> (4 5)  ;this is the only way to put results of expressions inside a list.


Comments