This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Clone repo from https://github.com/aabdullin/stores | |
# 2. Install python, virtualenv | |
➜ stores git:(master) python --version | |
Python 2.7.16 | |
➜ stores git:(master) pip2.7 install virtualenv | |
➜ stores git:(master) virtualenv venv --python=python2.7 | |
# 3. Install Flask, Flask JWT, Flask-RESTful in venv | |
(venv) ➜ stores git:(master) ✗ pip install Flask | |
(venv) ➜ stores git:(master) ✗ pip install Flask-JWT | |
(venv) ➜ stores git:(master) ✗ pip install Flask-RESTful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#2 | |
function nameBreakdown (fullName) { | |
// split full name to array with first,middle,last name as elements | |
var fullNameArr = fullName.split(' ') | |
// create an object | |
var fullNameObj = {} | |
if (fullName === 'middle') { | |
return 'false' | |
} | |
if (fullNameArr[1].length === 2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Part 1 | |
// input - name Object | |
// output - first name and last initial | |
function abbreviate (name) { | |
var initial = name.last.split('') | |
return name.first + ' ' + initial[0] + '.' | |
// split last name to last_name array | |
// return first name and first element of last_name array | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//exercise 1 | |
function countBy(num) { | |
var arr = [] | |
var const_num = num | |
for (var i = 0; i < 5; i++) { | |
arr.push(num) | |
num += const_num | |
} | |
console.log ( arr ) | |
} |