code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
comment write a program to comment provide layers of abstraction for a car rental system. comment Your program should perform the following: comment 1. Hatchback, Sedan, SUV should be type of cars that are comment being provided for rent comment 2. Cost per day: comment Hatchback - $30 comment Sedan - $50 comment SUV -...
# write a program to # provide layers of abstraction for a car rental system. # Your program should perform the following: # 1. Hatchback, Sedan, SUV should be type of cars that are # being provided for rent # 2. Cost per day: # Hatchback - $30 # Sedan - $50 # SUV - $100 # 3. Give a prompt to the customer asking him t...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python3 import requests import json import os import appdirs class ShortcutExporter begin function __init__ self begin set BASE_URL = string https://api.app.shortcut.com/api/v2 set TOKEN = get environ string SHORTCUT_API_TOKEN set DATA_DIR = call user_data_dir string shortcut make directories DATA_DIR...
#!/usr/bin/python3 import requests import json import os import appdirs class ShortcutExporter: def __init__(self): self.BASE_URL = 'https://api.app.shortcut.com/api/v2' self.TOKEN = os.environ.get('SHORTCUT_API_TOKEN') self.DATA_DIR = appdirs.user_data_dir('shortcut') os.makedirs(...
Python
zaydzuhri_stack_edu_python
function test_dict self begin assert equal call parse_str dict string x string y string {"x": "y"} end function
def test_dict(self): self.assertEqual( parse_str({'x': 'y'}), '{"x": "y"}' )
Python
nomic_cornstack_python_v1
function get_cov_matrix_parameters self begin set cov = call diag zeros call get_num_parameters set i = 0 for p in parameters begin set cov at tuple i i = call get_covariance set i = i + 1 end return cov end function
def get_cov_matrix_parameters(self): cov = numpy.diag(numpy.zeros(self.get_num_parameters())) i = 0 for p in self.parameters: cov[i,i] = p.get_covariance() i += 1 return cov
Python
nomic_cornstack_python_v1
function tab_str some_str tab_count begin return string * tab_count + replace string some_str string string + string * tab_count end function
def tab_str(some_str, tab_count): return "\t" * tab_count + str(some_str).replace("\n", "\n" + "\t" * tab_count)
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- comment Define your item pipelines here comment Don't forget to add your pipeline to the ITEM_PIPELINES setting comment See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql import csv import os class JdPipeline extends object begin function __init__ self begin com...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql import csv import os class JdPipeline(object): def __init__(self): #连接数据库,创建游标 self.db = p...
Python
zaydzuhri_stack_edu_python
function setUp self begin set data = dict string username string jweckert17 ; string email string jweckert17@gmail.com ; string password string test ; string first_name string Jacob ; string last_name string Eckert ; string bio string I am just a cool boi. set response = post string /register data format=string json se...
def setUp(self): data = { 'username': 'jweckert17', 'email': 'jweckert17@gmail.com', 'password': 'test', 'first_name': 'Jacob', 'last_name': 'Eckert', 'bio': 'I am just a cool boi.' } response = self.client.post('/register'...
Python
nomic_cornstack_python_v1
function single_sample forward_fn begin function f W σ begin return call forward_fn W σ at tuple newaxis slice : : at 0 end function return f end function
def single_sample(forward_fn): def f(W, σ): return forward_fn(W, σ[jnp.newaxis, :])[0] return f
Python
nomic_cornstack_python_v1
import pandas as pd import numpy as np comment import scipy comment import sklearn import matplotlib.pyplot as plt comment Define file names set file_name_911 = string 911-calls.csv set file_name_neighborhoods = string neighborhoods_gps.csv set file_name_trimet = string events_hour.csv comment Import file as a pandas d...
import pandas as pd import numpy as np #import scipy #import sklearn import matplotlib.pyplot as plt # Define file names file_name_911 = '911-calls.csv' file_name_neighborhoods = 'neighborhoods_gps.csv' file_name_trimet = 'events_hour.csv' # Import file as a pandas data frame df_911 = pd.read_csv(file_name_911) df_...
Python
zaydzuhri_stack_edu_python
from enum import Enum from typing import List from swarm_bots.utils.coordinates import Coordinates from swarm_bots.utils.direction import Direction class Spin extends Enum begin set CLOCKWISE = 0 set ANTI_CLOCKWISE = 1 function get_opposite self begin if self == CLOCKWISE begin return ANTI_CLOCKWISE end return CLOCKWIS...
from enum import Enum from typing import List from swarm_bots.utils.coordinates import Coordinates from swarm_bots.utils.direction import Direction class Spin(Enum): CLOCKWISE = 0 ANTI_CLOCKWISE = 1 def get_opposite(self) -> 'Spin': if self == Spin.CLOCKWISE: return Spin.ANTI_CLOCKWI...
Python
zaydzuhri_stack_edu_python
function value self begin return _RSI end function
def value(self): return self._RSI
Python
nomic_cornstack_python_v1
function jit func begin return func end function
def jit(func): return func
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- comment @Time : 2018/10/21 14:32 comment @Author : Ruichen Shao comment @File : cv_detector.py from src.detection.base_detector import BaseDetetctor from src.detection.cv_config import Config import cv2 class OpencvDector extends BaseDetetctor begin function detect self image_path begin se...
# -*- coding: utf-8 -*- # @Time : 2018/10/21 14:32 # @Author : Ruichen Shao # @File : cv_detector.py from src.detection.base_detector import BaseDetetctor from src.detection.cv_config import Config import cv2 class OpencvDector(BaseDetetctor): def detect(self, image_path): casc_path = Config.CASCPA...
Python
zaydzuhri_stack_edu_python
from collections import deque import numpy as np class StaticReplayBuffer begin string faster, smaller efficient in shaping, indexing. can access attrs by its name function __init__ self num_envs capacity begin set num_envs = num_envs set capacity = capacity set tuple obs action reward done = tuple none none none none ...
from collections import deque import numpy as np class StaticReplayBuffer: """faster, smaller efficient in shaping, indexing. can access attrs by its name """ def __init__(self, num_envs, capacity): self.num_envs = num_envs self.capacity = capacity self.obs, self.action,...
Python
zaydzuhri_stack_edu_python
function iter_nums begin set saved = dictionary function get_or_zero x y begin string Get the value at (x, y) in the cache, or return 0 set coord = tuple x y if coord in saved begin return saved at coord end else begin return 0 end end function for coord in call iter_coords begin set tuple x y = coord if coord == tuple...
def iter_nums(): saved = dict() def get_or_zero(x, y): """ Get the value at (x, y) in the cache, or return 0 """ coord = (x, y) if coord in saved: return saved[coord] else: return 0 for coord in iter_coords(): x, y = coord if coord ==...
Python
nomic_cornstack_python_v1
import time from custom_window import * from alien import * from scoreboard import * class Engine begin function __init__ self begin string Create graphics window, scoreboard, position grid and alien list set graphics_window = call custom_window string Space Invaders 300 300 set scoreboard = call Scoreboard set alien_l...
import time from custom_window import * from alien import * from scoreboard import * class Engine: def __init__(self): """Create graphics window, scoreboard, position grid and alien list""" self.graphics_window = custom_window("Space Invaders", 300, 300) self.scoreboard = Scoreboar...
Python
zaydzuhri_stack_edu_python
function _getStMCompTmpl self num name begin set graph = call getStateMachine num set stateList = dict for tuple u v d in call edges data=true begin if u not in stateList begin set stateList at u = list end append stateList at u tuple v d end function genStateTransitionCode listTransition begin function getStateTrans...
def _getStMCompTmpl(self, num, name): graph = self.dep.getStateMachine(num) stateList = {} for u, v, d in graph.edges(data=True): if u not in stateList: stateList[u] = [] stateList[u].append((v, d)) def genStateTransitionCode(listTransition): ...
Python
nomic_cornstack_python_v1
function init_db_command begin call init_db call echo string Initialized the database. end function
def init_db_command(): init_db() click.echo('Initialized the database.')
Python
nomic_cornstack_python_v1
function import_ api_key date before_date table format_resources resource begin if resource is Event and not date begin call echo string must specify --date for --resource=Event exit 1 end if table and date begin set table = string { table } $ { date } end with if expression table then temporary file mode=string w+b el...
def import_( api_key: Optional[str], date: Optional[datetime], before_date: Optional[datetime], table: Optional[str], format_resources: bool, resource: Type[ListableAPIResource], ): if resource is stripe.Event and not date: click.echo("must specify --date for --resource=Event") ...
Python
nomic_cornstack_python_v1
function cpu self begin return get pulumi self string cpu end function
def cpu(self) -> Optional[str]: return pulumi.get(self, "cpu")
Python
nomic_cornstack_python_v1
function index begin return call render_template string index.html items=items lib ListofPlaylist=call list_playlist config at string PLAYLIST_FOLDER end function
def index(): return render_template('index.html', items=g.lib.items(), ListofPlaylist=list_playlist(app.config['PLAYLIST_FOLDER']))
Python
nomic_cornstack_python_v1
if san == 0 begin print string Ноль end else if san == 1 begin print string Бир end else if san == 2 begin print string Эки end else if san == 3 begin print string Уч end else if san == 4 begin print string Торт end else if san == 5 begin print string Беш end else if san == 6 begin print string Алты end
if san == 0: print('Ноль') elif san == 1: print('Бир') elif san == 2: print('Эки') elif san == 3: print('Уч') elif san == 4: print('Торт') elif san == 5: print('Беш') elif san == 6: print('Алты')
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- string Created on Tue Aug 11 10:39:28 2015 @author: Kyle Ellefsen Fluorescence correlation spectroscopy measurement software When this program is run, Make sure that the National Instruments DAC PCI-6132 is "Dev1" with the National Instruments Measurement and Automation tool. - Dev1/ai1 is...
# -*- coding: utf-8 -*- """ Created on Tue Aug 11 10:39:28 2015 @author: Kyle Ellefsen Fluorescence correlation spectroscopy measurement software When this program is run, Make sure that the National Instruments DAC PCI-6132 is "Dev1" with the National Instruments Measurement and Automation tool. - Dev1/ai1 is the...
Python
zaydzuhri_stack_edu_python
function flow_rate self factor tags=none *args **kwargs begin set factor = call _convert_rate_value factor min=75 max=125 call commands string M221 S%d % factor tags=get kwargs string tags set ? set literal string trigger:printer.flow_rate end function
def flow_rate(self, factor, tags=None, *args, **kwargs): factor = self._convert_rate_value(factor, min=75, max=125) self.commands("M221 S%d" % factor, tags=kwargs.get("tags", set()) | {"trigger:printer.flow_rate"})
Python
nomic_cornstack_python_v1
comment Author : Koshvendra Singh comment Date : 05/06/2020 comment Description : fourer transform of box function import numpy as np import matplotlib.pyplot as plt comment definig box function function box_func x begin if call absolute x < 1 begin return 1 end else begin return 0 end end function comment plotting box...
# Author : Koshvendra Singh # Date : 05/06/2020 # Description : fourer transform of box function import numpy as np import matplotlib.pyplot as plt # definig box function def box_func(x): if np.absolute(x)<1: return (1) else: return(0) # plotting box function x=np.linspace(-10,10,100) ...
Python
zaydzuhri_stack_edu_python
function ninja_log_level_override line default_log_level begin if starts with line string FAILED: begin return CRITICAL end return default_log_level end function
def ninja_log_level_override(line, default_log_level): if line.startswith("FAILED: "): return logging.CRITICAL return default_log_level
Python
nomic_cornstack_python_v1
function send_data self receiver message begin set data = call Message message name receiver call send dumps data end function
def send_data(self, receiver, message): data = Message(message, self.name, receiver) self.client_socket.send(pickle.dumps(data))
Python
nomic_cornstack_python_v1
function print_students self begin pass end function
def print_students(self): pass
Python
nomic_cornstack_python_v1
function __init__ self tmpdir slope aspect wkt xform begin set tmpdir = tmpdir set slope = slope set aspect = aspect set tuple w h = shape set wkt = wkt set xform = xform end function
def __init__(self, tmpdir, slope, aspect, wkt, xform): self.tmpdir = tmpdir self.slope = slope self.aspect = aspect self.w, self.h = self.slope.shape self.wkt = wkt self.xform = xform
Python
nomic_cornstack_python_v1
function station_stats df begin print string Calculating The Most Popular Stations and Trip... set start_time = time comment TO DO: display most commonly used start station set most_common_start_station = mode at 0 print string The most frequent start station is: -> most_common_start_station comment TO DO: display most...
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station most_common_start_station = df['Start Station'].mode()[0] print ("The most frequent start station is:\n ->", most_common_start_station) ...
Python
nomic_cornstack_python_v1
for i in range 0 n begin set quiz = string input set cnt = 0 set sum = 0 for j in quiz begin if j == string O begin set cnt = cnt + 1 end else begin set cnt = 0 end set tmp = j set sum = sum + cnt end append score sum end for i in score begin print i end
for i in range(0,n): quiz=str(input()) cnt=0 sum=0 for j in quiz: if j=='O': cnt+=1 else: cnt=0 tmp=j sum+=cnt score.append(sum) for i in score: print(i)
Python
zaydzuhri_stack_edu_python
string Программа считает сумму/разницу/произведение/частное n чисел. Алгоритм: 1. Пользователь вводит число n. 2. Затем выбирает операцию (+, -, *, /). 3. После этого вводит n чисел. 4. Программа выводит результат и сообщение "Continue? (y/n)". 5. Если пользователь вводит y, то программа выполняется сначала. Иначе - вы...
""" Программа считает сумму/разницу/произведение/частное n чисел. Алгоритм: 1. Пользователь вводит число n. 2. Затем выбирает операцию (+, -, *, /). 3. После этого вводит n чисел. 4. Программа выводит результат и сообщение "Continue? (y/n)". 5. Если пользователь вводит y, то программа выполн...
Python
zaydzuhri_stack_edu_python
comment @lc app=leetcode.cn id=32 lang=python comment [32] 最长有效括号 comment @lc code=start class Solution extends object begin function longestValidParentheses self s begin string :type s: str :rtype: int set result = 0 if s begin set n = length s set dp = list 0 * n for i in range n begin comment i-dp[i-1]-1是与当前)对称的位置 i...
# # @lc app=leetcode.cn id=32 lang=python # # [32] 最长有效括号 # # @lc code=start class Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: int """ result = 0 if s: n = len(s) dp = [0] * n for i in range(n):...
Python
zaydzuhri_stack_edu_python
function list_keys self resource_group_name cluster_name **kwargs begin comment type: str comment type: str comment type: Any comment type: (...) -> "_models.OperationalizationClusterCredentials" comment type: ClsType["_models.OperationalizationClusterCredentials"] set cls = pop kwargs string cls none set error_map = d...
def list_keys( self, resource_group_name, # type: str cluster_name, # type: str **kwargs # type: Any ): # type: (...) -> "_models.OperationalizationClusterCredentials" cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationalizationClusterCredentials"] ...
Python
nomic_cornstack_python_v1
comment see: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin.html comment Function to minimize (adapted to a power law) function func pars x ydat dy begin set tuple exponent const = pars set ymod = const * x ^ exponent return sum ydat - ymod ^ 2 / dy ^ 2 end function comment Function to minimiz...
# see: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fmin.html # Function to minimize (adapted to a power law) def func(pars, x, ydat, dy): exponent,const=pars ymod = const*x**exponent return sum((ydat-ymod)**2/dy**2) # Function to minimize (adapted to a power law for converging ratio...
Python
zaydzuhri_stack_edu_python
function draw_chimera_bqm bqm width=none height=none begin string Draws a Chimera Graph representation of a Binary Quadratic Model. If cell width and height not provided assumes square cell dimensions. Throws an error if drawing onto a Chimera graph of the given dimensions fails. Args: bqm (:obj:`dimod.BinaryQuadraticM...
def draw_chimera_bqm(bqm, width=None, height=None): """Draws a Chimera Graph representation of a Binary Quadratic Model. If cell width and height not provided assumes square cell dimensions. Throws an error if drawing onto a Chimera graph of the given dimensions fails. Args: bqm (:obj:`dimod.B...
Python
jtatman_500k
function rotate_matrix deg matrix begin set deg = deg % 360 if deg == 0 begin return matrix end else if deg == 90 begin return list comprehension list row at slice : : - 1 for row in zip *matrix end else if deg == 180 begin return list comprehension row at slice : : - 1 for row in matrix at slice : : - 1 end else...
def rotate_matrix(deg, matrix): deg = deg % 360 if deg == 0: return matrix elif deg == 90: return [list(row[::-1]) for row in zip(*matrix)] elif deg == 180: return [row[::-1] for row in matrix][::-1] else: return rotate_matrix(90, rotate_matrix(180, matrix))
Python
zaydzuhri_stack_edu_python
function iterate self delay=0 begin set _started = true comment Since the CoreFoundation loop doesn't have the concept of "iterate" comment we can't ask it to do this. Instead we will make arrangements to comment crash it *very* soon and then make it run. This is a rough comment approximation of "an iteration". Using c...
def iterate(self, delay=0): self._started = True # Since the CoreFoundation loop doesn't have the concept of "iterate" # we can't ask it to do this. Instead we will make arrangements to # crash it *very* soon and then make it run. This is a rough # approximation of "an iteratio...
Python
nomic_cornstack_python_v1
import RPi.GPIO as GPIO import time comment [seconds] set TIMEOUT = 0.2 class UltrasonicSensor begin function __init__ self trigger_pin echo_pin speed_of_sound=34300 begin set _trig_pin = trigger_pin set _echo_pin = echo_pin set _speed_of_sound = speed_of_sound call __setup__ end function function __setup__ self begin ...
import RPi.GPIO as GPIO import time TIMEOUT = 0.2 # [seconds] class UltrasonicSensor: def __init__(self, trigger_pin, echo_pin, speed_of_sound=34300): self._trig_pin = trigger_pin self._echo_pin = echo_pin self._speed_of_sound = speed_of_sound self.__setup__() def __setup...
Python
zaydzuhri_stack_edu_python
if v > 80 begin print format string Você foi multado,o valor a ser pago é R$ {:.2f}. m end else begin print string Parabéns, você está dentro do limite de velocidade. end
if v > 80: print('Você foi multado,o valor a ser pago é R$ {:.2f}.'.format(m)) else: print('Parabéns, você está dentro do limite de velocidade.')
Python
zaydzuhri_stack_edu_python
function _is_activity_et_after_st df begin set df = sort values df by=START_TIME set df = copy df set df at string diff = df at string end_time - df at string start_time set mask = df at string diff < time delta string 0ns return not any end function
def _is_activity_et_after_st(df): df = df.sort_values(by=START_TIME) df = df.copy() df['diff'] = df['end_time'] - df['start_time'] mask = df['diff'] < pd.Timedelta('0ns') return not mask.any()
Python
nomic_cornstack_python_v1
class node begin function __init__ self data begin set next = none set data = data end function end class class linked begin function __init__ self begin set head = none end function function rev self link prev begin if next is none begin set head = link return end else begin set prev = link call rev link set next = pr...
class node: def __init__(self,data): self.next = None self.data = data class linked: def __init__(self): self.head = None def rev(self, link,prev): if link.next is None: self.head = link return else: prev = link self....
Python
zaydzuhri_stack_edu_python
function _find_starts self linespec begin string Finds the start points. Start points matching the linespec regex are returned as list in the following format: [(item, index), (item, index)..... set linespec = linespec + string .* set start_points = list for item in _indent_list begin set match = search linespec item ...
def _find_starts(self, linespec): """ Finds the start points. Start points matching the linespec regex are returned as list in the following format: [(item, index), (item, index)..... """ linespec += ".*" start_points = [] for item in self._inden...
Python
jtatman_500k
comment !/usr/bin/env python set tmpFile = open string /sys/class/thermal/thermal_zone0/temp set cpu_temp_raw = read tmpFile close tmpFile set cpu_temp = round decimal cpu_temp_raw / 1000 1 print cpu_temp
#!/usr/bin/env python tmpFile = open( '/sys/class/thermal/thermal_zone0/temp' ) cpu_temp_raw = tmpFile.read() tmpFile.close() cpu_temp = round(float(cpu_temp_raw)/1000, 1) print (cpu_temp)
Python
zaydzuhri_stack_edu_python
function bubble_sort array begin set arraySorted = false while not arraySorted begin set arraySorted = true for index in range length array - 1 begin if array at index > array at index + 1 begin set tuple array at index array at index + 1 = tuple array at index + 1 array at index set arraySorted = false end end end ret...
def bubble_sort(array): arraySorted = False while not arraySorted: arraySorted = True for index in range(len(array) -1): if array[index] > array[index +1]: array[index], array[index +1] = array[index +1], array[index] arraySorted = False return arr...
Python
zaydzuhri_stack_edu_python
function getSourceData sesSource appState=none qryList=none begin if not qryList begin set srcFilters = call AsuPsBioFilters sesSource subAffCodes set srcEmplidsSubQry = call getAllBiodesignEmplidList true return all end else begin return all end end function
def getSourceData( sesSource, appState=None, qryList=None ): if not qryList: srcFilters = AsuPsBioFilters( sesSource, appState.subAffCodes ) srcEmplidsSubQry = srcFilters.getAllBiodesignEmplidList( True ) return sesSource.query( AsuDwPsJobsLog ).join( srcEmplidsSubQry, AsuDwPsJobsLog.emplid==srcEmplids...
Python
nomic_cornstack_python_v1
function secret_uri self begin return get pulumi self string secret_uri end function
def secret_uri(self) -> str: return pulumi.get(self, "secret_uri")
Python
nomic_cornstack_python_v1
function preprocess_text text tokenize=false ner=false stem=false stopw=false all_lower=false strip_punct=true begin comment Clean the text set text = sub string what's string what is text set text = sub string \'s string text set text = sub string \'ve string have text set text = sub string can't string cannot text s...
def preprocess_text(text, tokenize=False, ner=False, stem=False, stopw=False, all_lower=False, strip_punct=True): # Clean the text text = re.sub(r"what's", "what is ", text) text = re.sub(r"\'s", " ", text) text = re.sub(r"\'ve", " have ", text) text = re.sub(r"can't", "cannot ", text) text = r...
Python
nomic_cornstack_python_v1
comment ! /usr/bin/env python comment -*- coding: utf-8 -*- comment created by Evgeny Ivanov for Big Data course at ULg to prove that, in fact, the climate change is real, 17/11/2018 comment execution time is ~ 1 min import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basema...
#! /usr/bin/env python # -*- coding: utf-8 -*- # created by Evgeny Ivanov for Big Data course at ULg to prove that, in fact, the climate change is real, 17/11/2018 # execution time is ~ 1 min import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import ...
Python
zaydzuhri_stack_edu_python
function task_denotate self task annotation begin string Removes an annotation from a task. call _execute task at string uuid string denotate string -- annotation set tuple id denotated_task = call get_task uuid=task at call u string uuid return denotated_task end function
def task_denotate(self, task, annotation): """ Removes an annotation from a task. """ self._execute( task['uuid'], 'denotate', '--', annotation ) id, denotated_task = self.get_task(uuid=task[six.u('uuid')]) return denotated_task
Python
jtatman_500k
comment !/usr/bin/env python comment -*- coding: utf-8 -*- import simplejson from django.http import JsonResponse , HttpResponse from django.views.decorators.csrf import csrf_exempt from sf.models import Product , Position string from django.http import JsonResponse response = JsonResponse(dict) import simplejson dict ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson from django.http import JsonResponse, HttpResponse from django.views.decorators.csrf import csrf_exempt from ..sf.models import Product, Position """ from django.http import JsonResponse response = JsonResponse(dict) import simplejson ...
Python
zaydzuhri_stack_edu_python
class Solution begin function racecar self target begin from queue import Queue set res = 0 set q = queue put tuple 0 1 set s = set add s tuple 0 1 while not call empty begin set size = call qsize for i in range size begin set tuple position speed = get q if position == target begin return res end set tuple np ns = tup...
class Solution: def racecar(self, target: int) -> int: from queue import Queue res = 0 q = Queue() q.put((0, 1)) s = set() s.add((0, 1)) while not q.empty(): size = q.qsize() for i in range(size): position, speed = q.get...
Python
zaydzuhri_stack_edu_python
import pandas as pd from collections import defaultdict from statistics import mean , median set df = read csv string games.csv header=0 engine=string c set years = dictionary set max_mov = 0 for year in range 2002 2018 begin set movs = eval string abs(home_score - away_score) if max movs > max_mov begin set max_mov = ...
import pandas as pd from collections import defaultdict from statistics import mean, median df = pd.read_csv('games.csv', header=0, engine='c') years = dict() max_mov = 0 for year in range(2002, 2018): movs = df.query('year == @year').eval('abs(home_score - away_score)') if max(movs) > max_mov: ma...
Python
zaydzuhri_stack_edu_python
import db from dataClass import News from reqs import init_api_conn , request_Data_1 , request_Data_2 , request_Data_3 , request_Data_4 , request_Data_5 set connection = call db_connect call create_tables connection comment openning connection with api set news_api = call init_api_conn string c2612454e7474eeaa7ec328a4f...
import db from dataClass import News from reqs import init_api_conn,request_Data_1,request_Data_2,request_Data_3,request_Data_4,request_Data_5 connection = db.db_connect() db.create_tables(connection) news_api = init_api_conn("c2612454e7474eeaa7ec328a4fc8f71a") #openning connection with api def fill_table_1_With...
Python
zaydzuhri_stack_edu_python
import sqlite3 set CREATE_SONG_TABLE = string CREATE TABLE IF NOT EXISTS songs (id INTEGER PRIMARY KEY, name TEXT, path TEXT); set INSERT_SONG = string INSERT INTO songs (name, path) VALUES (?, ?); set GET_ALL_SONGS = string SELECT * FROM songs; set GET_SONGS_BY_NAME = string SELECT path FROM songs WHERE name = ?; set ...
import sqlite3 CREATE_SONG_TABLE = "CREATE TABLE IF NOT EXISTS songs (id INTEGER PRIMARY KEY, name TEXT, path TEXT);" INSERT_SONG = "INSERT INTO songs (name, path) VALUES (?, ?);" GET_ALL_SONGS = "SELECT * FROM songs;" GET_SONGS_BY_NAME = "SELECT path FROM songs WHERE name = ?;" DELETE_SONG = "DELETE FROM songs WH...
Python
zaydzuhri_stack_edu_python
string Created on Mar 29, 2017 @author: lancer from fuzzywuzzy import process from fuzzywuzzy import fuzz import csv set dictByWordLength = dict comment aDict = {} function readEnglishDict begin with open string ../origData/american-english string r encoding=string utf-8 as csvfile begin set spamreader = reader csvfil...
''' Created on Mar 29, 2017 @author: lancer ''' from fuzzywuzzy import process from fuzzywuzzy import fuzz import csv; dictByWordLength = {} #aDict = {} def readEnglishDict(): with open('../origData/american-english', 'r', encoding='utf-8') as csvfile: spamreader = csv.reader(csvfile, delimiter=',', quote...
Python
zaydzuhri_stack_edu_python
from PIL import Image set im = open string 0014.png set im = call convert string RGB set tuple r g b = split im set r = call point lambda i -> i * 255 set out = merge string RGB tuple r g b show
from PIL import Image im = Image.open('0014.png') im = im.convert('RGB') r, g, b = im.split() r = r.point(lambda i: i * 255) out = Image.merge('RGB', (r, g, b)) out.show()
Python
zaydzuhri_stack_edu_python
set a = list 1 3 5 7 9 set b = list 13 17 set c = a + b print c set b at 0 = - 1 print b set d = list comprehension e + 1 for e in a print d append d b at 0 + 1 append d b at - 1 + 1 print d print d at slice : - 2 :
a = [ 1, 3, 5, 7, 9] b = [ 13, 17] c = a + b print(c) b[0] = -1 print(b) d = [ e + 1 for e in a ] print(d) d.append(b[0]+1) d.append(b[-1] + 1) print(d) print(d[:-2])
Python
zaydzuhri_stack_edu_python
string Created on Dec 16, 2013 @author: Mike class ChangeProblem begin string classdocs function __init__ self begin string Constructor set dataSet = string dataset_59_5 (1).txt set testSet = string man_tou.txt end function function DPChange self money coins begin set MinNumCoins = list decimal string inf * money + 1 s...
''' Created on Dec 16, 2013 @author: Mike ''' class ChangeProblem: ''' classdocs ''' def __init__(self): ''' Constructor ''' self.dataSet = "dataset_59_5 (1).txt" self.testSet = "man_tou.txt" def DPChange(self, money, coins): MinNumCoins = [flo...
Python
zaydzuhri_stack_edu_python
class Client begin function __init__ self client_id first_name last_name begin set client_id = client_id set first_name = first_name set last_name = last_name end function function __str__ self begin return string id: { client_id } , first_name: { first_name } , last_name: { last_name } end function function as_json_di...
class Client: def __init__(self, client_id: int, first_name: str, last_name: str): self.client_id = client_id self.first_name = first_name self.last_name = last_name def __str__(self): return f"id: {self.client_id}, first_name: {self.first_name}, last_name: {self.last_name}" ...
Python
zaydzuhri_stack_edu_python
function _initialize_pygame self begin call init set display = call set_mode tuple width height HWSURFACE ? DOUBLEBUF end function
def _initialize_pygame(self): pygame.init() self.display = pygame.display.set_mode( (self.width, self.height), pygame.HWSURFACE | pygame.DOUBLEBUF)
Python
nomic_cornstack_python_v1
function pickle_from_file filename begin with open filename string rb as file_ begin return load pickle file_ end end function
def pickle_from_file(filename): with open(filename, 'rb') as file_: return pickle.load(file_)
Python
nomic_cornstack_python_v1
import cv2 import time import glob import numpy as np from skimage.exposure import rescale_intensity from scipy import ndimage import matplotlib.pyplot as plt set tuple left_point1 left_point2 left_point3 = tuple list list list set tuple right_point1 right_point2 right_point3 = tuple list list list function load_...
import cv2 import time import glob import numpy as np from skimage.exposure import rescale_intensity from scipy import ndimage import matplotlib.pyplot as plt left_point1, left_point2, left_point3 = [], [], [] right_point1, right_point2, right_point3 = [], [], [] def load_Images(): original=[] title=[] f...
Python
zaydzuhri_stack_edu_python
function test_register_telegram_cb self begin set xknx = call XKNX telegram_received_cb=call AsyncMock assert length telegram_received_cbs == 1 end function
def test_register_telegram_cb(self): xknx = XKNX(telegram_received_cb=AsyncMock()) assert len(xknx.telegram_queue.telegram_received_cbs) == 1
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python3 import hebi from time import sleep comment Get a group set lookup = call Lookup sleep 2 set group = call get_group_from_names list string family list string base string shoulder string elbow if group == none begin print string Group not found! exit 1 end comment This is by default "100" - ...
#!/usr/bin/env python3 import hebi from time import sleep # Get a group lookup = hebi.Lookup() sleep(2) group = lookup.get_group_from_names(['family'], ['base', 'shoulder', 'elbow']) if group == None: print('Group not found!') exit(1) # This is by default "100" - setting this to 5 here allows the console outpu...
Python
zaydzuhri_stack_edu_python
class Solution extends object begin function subsets self nums begin string :type nums: List[int] :rtype: List[List[int]] return call recursiveSets nums 0 list list list end function function recursiveSets self nums index cur_combo set_list begin if length nums == index begin return set_list end for i in range index l...
class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ return self.recursiveSets(nums, 0, [], [[]]) def recursiveSets(self, nums, index, cur_combo, set_list): if (len(nums) == index): ...
Python
zaydzuhri_stack_edu_python
comment Copyright (C) University College London, 2007-2012, all rights reserved. comment This file is part of HemeLB and is CONFIDENTIAL. You may not work comment with, install, use, duplicate, modify, redistribute or share this comment file, or any part thereof, other than as allowed by any agreement comment specifica...
# # Copyright (C) University College London, 2007-2012, all rights reserved. # # This file is part of HemeLB and is CONFIDENTIAL. You may not work # with, install, use, duplicate, modify, redistribute or share this # file, or any part thereof, other than as allowed by any agreement # specifically made by you with Un...
Python
zaydzuhri_stack_edu_python
function _find_node_by_indices self point begin string "Find the GSNode that is refered to by the given indices. See GSNode::_indices() set tuple path_index node_index = point set path = paths at integer path_index set node = nodes at integer node_index return node end function
def _find_node_by_indices(self, point): """"Find the GSNode that is refered to by the given indices. See GSNode::_indices() """ path_index, node_index = point path = self.paths[int(path_index)] node = path.nodes[int(node_index)] return node
Python
jtatman_500k
import pandas as pd import numpy as np import matplotlib.pyplot as plt from statsmodels.tsa.stattools import adfuller , ARMA function adf_test ts begin set adftest = call adfuller ts autolag=string BIC set adf_res = call Series adftest at slice 0 : 4 : index=list string Test Statistic string p-value string Lags Used s...
import pandas as pd import numpy as np import matplotlib.pyplot as plt from statsmodels.tsa.stattools import adfuller,ARMA def adf_test(ts): adftest = adfuller(ts,autolag='BIC') adf_res = pd.Series(adftest[0:4], index=['Test Statistic','p-value','Lags Used','Number of Observations Used']) for key, value in adftes...
Python
zaydzuhri_stack_edu_python
function generate_naive_labels_with_misreporting samples begin set labels = list for sample in samples begin set score = 0 for feature in sample begin if feature is none begin set feature = 3 end set score = score + feature end set score = call feature_sum_to_score score append labels score end return labels end funct...
def generate_naive_labels_with_misreporting(samples: typing.Iterable[typing.List]) -> typing.List[int]: labels = [] for sample in samples: score = 0 for feature in sample: if feature is None: feature = 3 score += feature score = feature_sum_to_sc...
Python
nomic_cornstack_python_v1
function get_binary url begin set data = string for chunk in get requests url stream=true begin set data = data + chunk end return data end function
def get_binary(url): data = '' for chunk in requests.get(url, stream=True): data += chunk return data
Python
nomic_cornstack_python_v1
function sentences a b begin comment TODO set sentA = set call sent_tokenize a set sentB = set call sent_tokenize b return sentA ? sentB end function
def sentences(a, b): # TODO sentA = set(sent_tokenize(a)) sentB = set(sent_tokenize(b)) return sentA & sentB
Python
nomic_cornstack_python_v1
function sudoku_solver sudoku begin comment First complete constraint propagation set s = call Sudoku sudoku call solve comment Return complete board or start backtracking if call check_complete begin return call get_board end else begin set s = call continue_solve if call check_complete begin return call get_board end...
def sudoku_solver(sudoku): # First complete constraint propagation s = Sudoku(sudoku) s.solve() # Return complete board or start backtracking if s.check_complete(): return (s.get_board()) else: s = s.continue_solve() if s.check_complete(): ...
Python
nomic_cornstack_python_v1
import pymysql comment !!! Update the week to the prior week each time set week = 11 set season = 2018 function franchise_identification number begin if number == 1 begin return string Matt & Ross end else if number == 2 begin return string Scott & James end else if number == 3 begin return string Doug end else if numb...
import pymysql ######## !!! Update the week to the prior week each time week = 11 season = 2018 def franchise_identification(number): if number == 1: return 'Matt & Ross' elif number == 2: return 'Scott & James' elif number == 3: return 'Doug' elif n...
Python
zaydzuhri_stack_edu_python
function get_agent_orig_node_id self agent_id begin return call get_agent_orig_node_id agent_id end function
def get_agent_orig_node_id(self, agent_id): return self._base_assignment.get_agent_orig_node_id(agent_id)
Python
nomic_cornstack_python_v1
class Solution extends object begin function letterCombinations self digits begin set query_map = dict string 2 string abc ; string 3 string def ; string 4 string ghi ; string 5 string jkl ; string 6 string mno ; string 7 string pqrs ; string 8 string tuv ; string 9 string wxyz if not digits begin return list end comm...
class Solution(object): def letterCombinations(self, digits: str) -> list: query_map = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'} if not digits: return [] # 方法1:非回溯 # res = [] # for x in digits: # if x.isdig...
Python
zaydzuhri_stack_edu_python
comment Creating my own intials using turtle. comment 09/24/18 comment CTI-110 P4T2_Intials comment Reginald Richardson import turtle comment Set up the window attributes set wn = call Screen title wn string R and R Intitals call bgcolor string lightblue comment Create first intial set first_intial = call Turtle call p...
# Creating my own intials using turtle. # 09/24/18 # CTI-110 P4T2_Intials # Reginald Richardson # import turtle # Set up the window attributes wn = turtle.Screen() wn.title("R and R Intitals") wn.bgcolor("lightblue") # Create first intial first_intial = turtle.Turtle() first_intial.pensiz...
Python
zaydzuhri_stack_edu_python
import re , operator , sys , inspect import random from pathlib import Path from typing import Iterable , Any import itertools from typing import Iterable , Generator import numpy as np from numpy import array , ndarray from copy import copy from functools import partial from operator import itemgetter import torch fro...
import re, operator, sys, inspect import random from pathlib import Path from typing import Iterable, Any import itertools from typing import Iterable, Generator import numpy as np from numpy import array,ndarray from copy import copy from functools import partial from operator import itemgetter import torch from torc...
Python
zaydzuhri_stack_edu_python
import turtle set my_turtle = call Turtle function square length angle begin call forward length call right angle call forward length call right angle call forward length call right angle call forward length call right angle call forward length call right angle call forward length call right angle call forward length c...
import turtle my_turtle = turtle.Turtle() def square(length , angle): my_turtle.forward(length) my_turtle.right(angle) my_turtle.forward(length) my_turtle.right(angle) my_turtle.forward(length) my_turtle.right(angle) my_turtle.forward(length) my_turtle.right(angle) my_turtle.forward(length) my_tur...
Python
zaydzuhri_stack_edu_python
function autoMAC self begin if not has attribute self string A begin raise exception string Mode shape matrix not defined. end return call MAC A A end function
def autoMAC(self): if not hasattr(self, 'A'): raise Exception('Mode shape matrix not defined.') return tools.MAC(self.A, self.A)
Python
nomic_cornstack_python_v1
function tscheme_end_fill begin call _tscheme_prep call end_fill end function
def tscheme_end_fill(): _tscheme_prep() turtle.end_fill()
Python
nomic_cornstack_python_v1
function accuracy pred target topk=1 thresh=none ignore_index=none begin assert is instance topk tuple int tuple if is instance topk int begin set topk = tuple topk set return_single = true end else begin set return_single = false end set maxk = max topk if size pred 0 == 0 begin set accu = list comprehension call new_...
def accuracy(pred, target, topk=1, thresh=None, ignore_index=None): assert isinstance(topk, (int, tuple)) if isinstance(topk, int): topk = (topk,) return_single = True else: return_single = False maxk = max(topk) if pred.size(0) == 0: accu = [pred.new_tensor(0.) for ...
Python
nomic_cornstack_python_v1
function disable_matchmaker self begin set order_book = none set matching_engine = none set is_matchmaker = false end function
def disable_matchmaker(self): self.order_book = None self.matching_engine = None self.is_matchmaker = False
Python
nomic_cornstack_python_v1
import numpy as np import pygame class Entity begin function __init__ self x y renderer controller physics graphics colliders=none begin string colliders [pygame.Rect] - array of pygame Rects TODO: * The x and y coordinates of the entity are always in world coordinates. This means to determine where an entity exists on...
import numpy as np import pygame class Entity: def __init__(self, x, y, renderer, controller, physics, graphics, colliders=None): """ colliders [pygame.Rect] - array of pygame Rects TODO: * The x and y coordinates of the entity are always in world coordinates. ...
Python
zaydzuhri_stack_edu_python
function set_by_stamp self start_stamp=none end_stamp=none len=none begin pass end function
def set_by_stamp(self, start_stamp=None, end_stamp=None, len=None): pass
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- from werkzeug import generate_password_hash , check_password_hash from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import ForeignKey , DateTime , Integer , String , Text , Boolean , Column , Float from sqlalchemy.orm import relationship from datetime import datetime ...
# -*- coding: utf-8 -*- from werkzeug import generate_password_hash, check_password_hash from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import ForeignKey, DateTime, Integer, String, Text, Boolean, Column, Float from sqlalchemy.orm import relationship from datetime import datetime Base = decla...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- from __future__ import absolute_import , division , print_function import os import sys import pandas as pd change directory path at 0 call set_option string display.max_columns 1000 call set_option string display.width 1000 call set_option string display.max_colwidth 1000 class EDA extend...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import os import sys import pandas as pd os.chdir(sys.path[0]) pd.set_option('display.max_columns', 1000) pd.set_option('display.width', 1000) pd.set_option('display.max_colwidth', 1000) class EDA(object): def __init__(se...
Python
zaydzuhri_stack_edu_python
function read_services_from_calendar path day begin info string Reading the calendar for GTFS set weekdays = dict 0 string monday ; 1 string tuesday ; 2 string wednesday ; 3 string thursday ; 4 string friday ; 5 string saturday ; 6 string sunday set day_of_the_week = weekdays at call weekday set services = list set ca...
def read_services_from_calendar(path, day): logging.info("Reading the calendar for GTFS") weekdays = { 0: 'monday', 1: 'tuesday', 2: 'wednesday', 3: 'thursday', 4: 'friday', 5: 'saturday', 6: 'sunday' } day_of_the_week = weekdays[datetime.strptime...
Python
nomic_cornstack_python_v1
function get_paginated_list list_items path start limit data_name begin set count = count list_items set response = dict string start start ; string limit limit ; string count count ; string status string success ; string message SUCCESS comment make previous url if start == 1 begin set response at string previous = st...
def get_paginated_list(list_items, path, start, limit, data_name): count = list_items.count() response = { 'start': start, 'limit': limit, 'count': count, 'status': 'success', 'message': SUCCESS, } # make previous url if start == 1: response['previou...
Python
nomic_cornstack_python_v1
function tree_actions path predicate=lambda entry -> true action=lambda entry -> print entry maxdepth=10 begin for entry in call scantree path maxdepth=maxdepth begin if call predicate entry begin call action entry end end end function
def tree_actions(path, predicate=lambda entry: True, action=lambda entry: print(entry), maxdepth=10): for entry in scantree(path, maxdepth=maxdepth): if predicate(entry): action(entry)
Python
nomic_cornstack_python_v1
function pattern_search string pattern begin set i = 0 while i < length string begin set j = 0 while j < length pattern begin if string at i + j != pattern at j begin break end set j = j + 1 end if j == length pattern begin return i end set i = i + 1 end return - 1 end function
def pattern_search(string, pattern): i = 0 while i < len(string): j = 0 while j < len(pattern): if string[i+j] != pattern[j]: break j += 1 if j == len(pattern): return i i += 1 return -1
Python
jtatman_500k
comment !/usr/bin/env python comment -*- coding:utf-8 -*- comment pandas-对数据增删改查 import pandas as pd set stu_dic = dict string Age list 14 13 13 14 14 12 12 15 13 12 11 14 12 15 16 12 15 11 15 ; string Height list 69 56.5 65.3 62.8 63.5 57.3 59.8 62.5 62.5 59 51.3 64.3 56.3 66.5 72 64.8 67 57.5 66.5 ; string Name list ...
#!/usr/bin/env python # -*- coding:utf-8 -*- # pandas-对数据增删改查 import pandas as pd stu_dic = { 'Age': [14, 13, 13, 14, 14, 12, 12, 15, 13, 12, 11, 14, 12, 15, 16, 12, 15, 11, 15], 'Height': [69, 56.5, 65.3, 62.8, 63.5, 57.3, 59.8, 62.5, 62.5, 59, 51.3, 64.3, 56.3, 66.5, 72, 64.8, 67, 57.5, 66....
Python
zaydzuhri_stack_edu_python
function parse_block block_bytes num_tx begin try begin set nonce = block_bytes at slice 0 : 32 : set prior_hash = block_bytes at slice 32 : 64 : set block_hash = block_bytes at slice 64 : 96 : set block_height = integer block_bytes at slice 96 : 128 : set block_miner_addr = block_bytes at slice 128 : 160 : set blo...
def parse_block(block_bytes, num_tx): try: nonce = block_bytes[0:32] prior_hash = block_bytes[32:64] block_hash = block_bytes[64:96] block_height = int(block_bytes[96:128]) block_miner_addr = block_bytes[128:160] block_data = block_bytes[160:] except BaseException...
Python
nomic_cornstack_python_v1
function _convert_input self *args **kwargs begin string Takes variable inputs :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs :return: dict, combined dictionary of all inputs set args = li...
def _convert_input(self, *args, **kwargs): """ Takes variable inputs :param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts :param kwargs: str, any number of kwargs that represent token:value pairs :return: dict, combined dictionary of a...
Python
jtatman_500k
function _elemwise_elemany dom begin if prim != string ElemAny begin return list end set fused = list for tuple a r in items in_relations begin if pattern < BROADCAST and r <= ELEMWISE and call check_acyclic dom begin append fused a end end return tuple fused true end function
def _elemwise_elemany(dom): if dom.dom_op().prim != "ElemAny": return [] fused = [] for a, r in dom.in_relations.items(): if a.pattern < PrimLib.BROADCAST and r <= PrimLib.ELEMWISE and a.check_acyclic(dom): fused.append(a) ...
Python
nomic_cornstack_python_v1
function same_second stim1 stim2 begin set f_all = list for f in list stim1 at string position_pair stim2 at string position_pair begin if length string f == 1 begin set f = string 0 + string f end else begin set f = string f end append f_all f end return if expression f_all at 0 at 1 == f_all at 1 at 1 then 0 else 1 ...
def same_second(stim1, stim2): f_all = [] for f in [stim1['position_pair'],stim2['position_pair']]: if len(str(f))==1: f = '0'+str(f) else: f = str(f) f_all.append(f) return 0 if f_all[0][1] == f_all[1][1] else 1
Python
nomic_cornstack_python_v1
function predict self review begin raise NotImplementedError end function
def predict(self, review): raise NotImplementedError
Python
nomic_cornstack_python_v1
function save_all self commit=true begin comment Save without committing (so self.saved_forms is populated) comment - We need self.saved_forms so we can go back and access comment the nested formsets set objects = save commit=false comment Save each instance if commit=True if commit begin for o in objects begin save en...
def save_all(self, commit=True): # Save without committing (so self.saved_forms is populated) # - We need self.saved_forms so we can go back and access # the nested formsets objects = self.save(commit=False) # Save each instance if commit=True if commit: ...
Python
nomic_cornstack_python_v1
class Solution extends object begin function longestCommonPrefix self strs begin string :type strs: List[str] :rtype: str set return_v = string if length strs == 0 begin return return_v end if length strs == 1 begin return strs at 0 end set min_len = min list comprehension length s for s in strs if min_len == 0 begin ...
class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ return_v = '' if len(strs) == 0: return return_v if len(strs) == 1: return strs[0] min_len...
Python
zaydzuhri_stack_edu_python
function printMatrix *arr begin set tempMatrix = list string string string string string string string string string set count = 0 for element in arr begin set matrix at count = element end print string | matrix at 0 string , matrix at 1 string , martix at 2 string | print string | matrix at 3 string , matrix ...
def printMatrix (*arr): tempMatrix = [' ',' ',' ',' ',' ',' ',' ',' ',' '] count = 0 for element in arr: matrix[count] = element print("|",matrix[0],',',matrix[1],',',martix[2],'|') print("|",matrix[3],',',matrix[4],',',martix[5],'|') print("|",matrix[6],',',matrix[7],',',martix[...
Python
zaydzuhri_stack_edu_python