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
>>> (l_s := len(l), l_r := list(reversed(l)), [(l_r[0:-l_s + i + 1][::-1], l[0:l_s - i - 1:]) for i in range(0, l_s - 1, 1)]) | |
(5, [5, 4, 3, 2, 1], [([5], [1, 2, 3, 4]), ([4, 5], [1, 2, 3]), ([3, 4, 5], [1, 2]), ([2, 3, 4, 5], [1])]) | |
# iteration using mod of list size | |
>>> [[l[5 - (r_i + i) % 5 - 1] for i in range(0, 5, 1)] for r_i in range(0, 5, 1)] | |
[[5, 4, 3, 2, 1], [4, 3, 2, 1, 5], [3, 2, 1, 5, 4], [2, 1, 5, 4, 3], [1, 5, 4, 3, 2]] | |
# counterclockwise | |
>>> [[l[(r_i + i) % 5] for i in range(0, 5, 1)] for r_i in range(0, 5, 1)] | |
[[1, 2, 3, 4, 5], [2, 3, 4, 5, 1], [3, 4, 5, 1, 2], [4, 5, 1, 2, 3], [5, 1, 2, 3, 4]] | |
# and clockwise |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#utf_8 U8, UTF, utf8 | |
"""read_from_json.py: | |
Example: | |
of Python's | |
web scraping |
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
#!/usr/bin/env python3.6 | |
# -*- coding: utf-8 -*- | |
import sys | |
from pprint import pprint, pformat | |
import logging | |
from collections import namedtuple | |
import random | |
from random import randint | |
from array import array | |
from enum import Enum#, unique |
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
//package ??? | |
//import java.time.LocalDateTime | |
// | |
//import scala.language.implicitConversions | |
import scala.PartialFunction._ | |
// | |
import akka.actor.{ Actor, ActorLogging, ActorRef, Props } |
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
#!/usr/bin/env python3 | |
#!/usr/bin/python | |
from collections import namedtuple | |
import psycopg2 | |
#from psycopg2 import sql | |
# note | |
# that we have to import the Psycopg2 extras library ! | |
#import psycopg2.extras | |
from psycopg2 import extras | |
from psycopg2.extras import NamedTupleConnection |
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
#!/usr/bin/env scala | |
// for The `bash` `shell script` './script.sh' | |
// but App main object warper must be disabled|excluded | |
import scala.io.AnsiColor._ | |
// it is imported twice in the same scope by | |
//import scala.Console._ | |
// | |
// | |
/*object digital_Circuit_Logic_Gates extends App */{ | |
/* A digital circuit is composed |
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
"use strict"; | |
// | |
var binary_Search_Tree_Name_Space = {}; | |
// | |
// Done: implement `get_UnBalanced_Sub_Tree` | |
// recursive, but not @tail recursive | stack safe | |
// traversal from top to bottom | |
/** it must return: | |
- [unBalanced_Sub_Tree object, balance_Factor] if any | |
- or [null, 0] if not found|search fails |
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
#!/usr/bin/env scala | |
// for The `bash` `shell script` './script.sh' | |
// | |
//import scala.math.{log, ceil} | |
import io.AnsiColor._ | |
// or | |
//import Console.{GREEN, RED, RESET, YELLOW_B, UNDERLINED} | |
// | |
// | |
// ? Is something wrong with: |
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
object Solution extends App{ | |
import scala.annotation.tailrec | |
import scala.io.StdIn | |
import scala.util.{Try, Success, Failure} | |
import scala.math.pow//{abs, pow, ceil, floor} | |
// as replacement of this Java styled code | |
/* |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#utf_8 U8, UTF, utf8 | |
"""Capitalize.py: | |
interactive Python sessions for doctest | |
must be in the `right` place | |
in order to be executed |
NewerOlder