code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
function f z begin set m_max = integer z - 1 ^ 0.5 // 1 set m_min = integer z / 2 ^ 0.5 // 1 print z m_max set out = 0 for m in range m_min m_max + 1 begin set m2 = m ^ 2 set n = round z - m2 ^ 0.5 if m2 + n ^ 2 == z begin print m2 n ^ 2 set out = out + 1 end end return out end function if __name__ == string __main__ b...
def f(z): m_max = int((z - 1) ** 0.5 // 1) m_min = int((z / 2) ** 0.5 // 1) print(z, m_max) out = 0 for m in range(m_min, m_max + 1): m2 = m ** 2 n = round((z - m2) ** 0.5) if m2 + n ** 2 == z: print(m2, n ** 2) out += 1 return out if __name__ ==...
Python
zaydzuhri_stack_edu_python
comment run with ./manage.py shell < django_shell_script.py from courses.models import * from django.db.models import Count string WRITING TO TIMEGRID JSON comment nb: does not deal with evening classes comment { comment "dateTimeFormat": "iso8601", comment "events": [ comment { comment "start": "2007-08-29T09:00", com...
#run with ./manage.py shell < django_shell_script.py from courses.models import * from django.db.models import Count """WRITING TO TIMEGRID JSON""" #nb: does not deal with evening classes # { # "dateTimeFormat": "iso8601", # "events": [ # { # "start": "2007-08-29T09:00", # "end": "2...
Python
zaydzuhri_stack_edu_python
function makeDict list1 list2 begin if length list1 > length list2 begin return dictionary zip list1 list2 end else if length list2 > length list1 begin return dictionary zip list2 list1 end else begin return dictionary zip list1 list2 end end function set name = list string Anna string Eli string Pariece string Brenda...
def makeDict(list1,list2): if len(list1) > len(list2): return dict(zip(list1, list2)) elif len(list2) > len(list1): return dict(zip(list2, list1)) else: return dict(zip(list1,list2)) name = ["Anna", "Eli", "Pariece", "Brendan", "Amy", "Shane", "Oscar"] favorite_animal = ["...
Python
zaydzuhri_stack_edu_python
function fetch_ensembl_genetree_by_member memberID=none species=none id_type=none output=string nh nh_format=string full begin if not memberID begin raise call valueError string Please provide a genetree id end else begin set http = call Http string .cache set server = string http://beta.rest.ensembl.org set ext = stri...
def fetch_ensembl_genetree_by_member(memberID=None, species=None, id_type=None, output="nh", nh_format="full"): if not memberID: raise valueError('Please provide a genetree id') else: http = httplib2.Http(".cache") server = "http://beta.rest.ensembl.org" ext = "/genetree/member/id/%s?" %(memberID) if specie...
Python
nomic_cornstack_python_v1
function get_sched begin set cnx = call connect user=MYSQL_ID password=MYSQL_PW database=MYSQL_DB set cursor = call cursor set get_sched = string SELECT day,time,temp FROM schedule ORDER BY day,time execute cursor get_sched set data = list for tuple day xtime ytemp in cursor begin comment xtime will be returned as a t...
def get_sched(): cnx = mysql.connector.connect(user=MYSQL_ID, password=MYSQL_PW, database=MYSQL_DB) cursor = cnx.cursor() get_sched = ("SELECT day,time,temp FROM schedule ORDER BY day,time") cursor.execute(get_sched) data=[] for (day,xtime, ytemp) in cursor: # xtime will be returned ...
Python
nomic_cornstack_python_v1
comment Codeforces comment #110A - Minimum Integer comment http://codeforces.com/problemset/problem/1101/A comment 11/01/2019 comment Nilton G. M. Junior if __name__ == string __main__ begin set num_queries = integer input for i in range num_queries begin set tuple l r d = list map int split input print if expression d...
# Codeforces # #110A - Minimum Integer # http://codeforces.com/problemset/problem/1101/A # 11/01/2019 # Nilton G. M. Junior if __name__ == '__main__': num_queries = int(input()) for i in range(num_queries): l, r, d = list(map(int, input().split())) print(d if d < l else d * (1 + r...
Python
zaydzuhri_stack_edu_python
function get_con_sf self j begin return je at slice ie at j : ie at j + 1 : end function
def get_con_sf(self, j): return self.je[ self.ie[j] : self.ie[j+1] ]
Python
nomic_cornstack_python_v1
function test_WindowContour empty_fuselage begin raise NotImplementedError end function
def test_WindowContour(empty_fuselage): raise(NotImplementedError)
Python
nomic_cornstack_python_v1
function feature_name self begin if feature_names is not none begin return feature_names at call feature end return none end function
def feature_name(self) -> (str, None): if self.shadow_tree.feature_names is not None: return self.shadow_tree.feature_names[self.feature()] return None
Python
nomic_cornstack_python_v1
function get_itinerary ip_list start begin set ip_len = length ip_list set each_tuple = tuple set itinerary = list set i = 0 while i < ip_len begin for each_tuple in ip_list begin if each_tuple at 0 == start begin set start = each_tuple at 1 append itinerary each_tuple at 0 remove ip_list each_tuple end end set i = i...
def get_itinerary(ip_list, start): ip_len = len(ip_list) each_tuple = () itinerary = [] i = 0 while i < ip_len: for each_tuple in ip_list: if each_tuple[0] == start: start = each_tuple[1] itinerary.append(each_tuple[0]) ip_list.rem...
Python
zaydzuhri_stack_edu_python
function cal_torsion_angles self begin set ca_lst = call get_ca_lst set tau_lst = list set theta_lst = list for i in range length ca_lst - 3 begin set atoms = list ca_lst at i ca_lst at i + 1 ca_lst at i + 2 ca_lst at i + 3 set vectors = list comprehension call get_vector for atom in atoms set tau = call calc_dihedra...
def cal_torsion_angles(self): ca_lst = self.get_ca_lst() tau_lst = [] theta_lst = [] for i in range(len(ca_lst) - 3): atoms = [ca_lst[i], ca_lst[i + 1], ca_lst[i + 2], ca_lst[i + 3]] vectors = [atom.get_vector() for atom in atoms] tau = calc_dihedral(v...
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- string Created on Fri Oct 21 22:33:49 2016 @author: matthaberland import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np set g = call imread string g.jpg comment plt.imshow(a) set h = call imread string h.jpg comment plt.imshow(b) comment This is not what we wa...
# -*- coding: utf-8 -*- """ Created on Fri Oct 21 22:33:49 2016 @author: matthaberland """ import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np g = mpimg.imread("g.jpg") # plt.imshow(a) h = mpimg.imread("h.jpg") # plt.imshow(b) # This is not what we want # i = g - h # plt.imshow(i) ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python import requests import json import argparse from pyzabbix import ZabbixAPI function zone_ips_from_consul service=string consul=string localhost:8500 begin if not service begin set url = format string http://{}/v1/catalog/services consul end else begin set url = format string http://{}/v1/healt...
#!/usr/bin/python import requests import json import argparse from pyzabbix import ZabbixAPI def zone_ips_from_consul(service="", consul="localhost:8500"): if not service: url = "http://{}/v1/catalog/services".format(consul) else: url = "http://{}/v1/health/service/{}?passing=true".format( ...
Python
zaydzuhri_stack_edu_python
function add_building self building street node_1 node_1_distance node_1_direction node_2 node_2_distance node_2_direction begin comment Create building node by building name and street name. set building_node = tuple building street comment Store every building nodes to the dictionary. set Building2Node at building = ...
def add_building(self, building, street,node_1,node_1_distance,node_1_direction,node_2,node_2_distance,node_2_direction): # Create building node by building name and street name. building_node=(building,street) # Store every building nodes to the dictionary. self.Building2Node[building]=...
Python
nomic_cornstack_python_v1
function rotateAroundAxis self rotation_axis angle begin comment For the mathematics look for: Rodrigues rotation formula. comment http://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula set unit_rotation_axis = call getNormalizedVector set rotated_vector = call scalarMultiplication cos angle set tmp_vector = call c...
def rotateAroundAxis(self, rotation_axis, angle): # For the mathematics look for: Rodrigues rotation formula. # http://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula unit_rotation_axis = rotation_axis.getNormalizedVector() rotated_vector = self.scalarMultiplication(np.cos(angle)) ...
Python
nomic_cornstack_python_v1
from collections import Counter function most_frequent arr begin set c = counter arr return call most_common 1 at 0 at 0 end function set arr = list 1 3 3 3 5 4 4 6 print call most_frequent arr comment Output: 3
from collections import Counter def most_frequent(arr): c = Counter(arr) return c.most_common(1)[0][0] arr = [1, 3, 3, 3, 5, 4, 4, 6] print(most_frequent(arr)) # Output: 3
Python
iamtarun_python_18k_alpaca
function SetByte self byte page column begin try begin set bitmap at page at column = character byte end except IndexError begin raise call LcmCanvasError string Request index out of range: page=%d column=%d % tuple page column end end function
def SetByte(self, byte, page, column): try: self.bitmap[page][column] = chr(byte) except IndexError: raise LcmCanvasError('Request index out of range: page=%d column=%d' % (page, column))
Python
nomic_cornstack_python_v1
for i in list begin if i == l begin print string Yes break end end for else begin print string No end
for i in list: if i==l: print("Yes") break else: print("No")
Python
zaydzuhri_stack_edu_python
function __create_all_pairs all_elements all_pairs begin if length all_elements == 1 begin return all_pairs end set current_element = all_elements at 0 for element in all_elements at slice 1 : : begin append all_pairs list current_element element end return call __create_all_pairs all_elements at slice 1 : : all_pa...
def __create_all_pairs(all_elements, all_pairs): if len(all_elements) == 1: return all_pairs current_element = all_elements[0] for element in all_elements[1:]: all_pairs.append([current_element, element]) return __create_all_pairs(all_elements[1:], all_pairs)
Python
nomic_cornstack_python_v1
comment Problem 3 comment Bookmark this page comment Problem 3 - Using Bisection Search to Make the Program Faster comment 20.0/20.0 points (graded) comment You'll notice that in Problem 2, your monthly payment had to be a multiple of comment $10. Why did we make it that way? You can try running your code locally so co...
# Problem 3 # Bookmark this page # Problem 3 - Using Bisection Search to Make the Program Faster # 20.0/20.0 points (graded) # You'll notice that in Problem 2, your monthly payment had to be a multiple of # $10. Why did we make it that way? You can try running your code locally so # that the payment can be any dollar ...
Python
zaydzuhri_stack_edu_python
set n = 3.14159 set raio = decimal input set area = n * raio ^ 2 print string A=%.4f % area
n = 3.14159 raio = float(input()) area = n * raio**2 print('A=%.4f' % area)
Python
zaydzuhri_stack_edu_python
function Args parser begin call AddParentFlagsToParser parser call add_argument string --location metavar=string LOCATION required=true help=string Location call add_argument string --insight-type metavar=string INSIGHT_TYPE required=true help=string Insight type to list insights for. Supported insight-types can be fou...
def Args(parser): flags.AddParentFlagsToParser(parser) parser.add_argument( '--location', metavar='LOCATION', required=True, help='Location' ) parser.add_argument( '--insight-type', metavar='INSIGHT_TYPE', required=True, help=( 'Insight type to list in...
Python
nomic_cornstack_python_v1
string problema 2 Crie uma função is_divisible(n, x, y) que verifica se um número n é divisível por dois números x e y. Todas as entradas são dígitos positivos, diferentes de zero. Exemplos: is_divisible(3,1,3)--> True is_divisible(12,2,6)--> True is_divisible(100,5,3)--> False is_divisible(12,7,5)--> False function is...
''' problema 2 Crie uma função is_divisible(n, x, y) que verifica se um número n é divisível por dois números x e y. Todas as entradas são dígitos positivos, diferentes de zero. Exemplos: is_divisible(3,1,3)--> True is_divisible(12,2,6)--> True is_divisible(100,5,3)--> False is_divisible(12,7,5)--> False ''' def is_di...
Python
zaydzuhri_stack_edu_python
function hamming self begin set ys = ys * call hamming length ys end function
def hamming(self): self.ys *= np.hamming(len(self.ys))
Python
nomic_cornstack_python_v1
from trader import Trader set trader = call Trader print call get_ticks 1.15 print call get_ticks 4.3 set price = call increment_price 1.15 158 print string new price: price
from trader import Trader trader = Trader() print(trader.get_ticks(1.15)) print(trader.get_ticks(4.3)) price = trader.increment_price(1.15, 158) print("new price: ", price)
Python
zaydzuhri_stack_edu_python
function columns self begin return call get_terminal_size at 1 end function
def columns(self): return get_terminal_size()[1]
Python
nomic_cornstack_python_v1
function stop_left_attachment self begin call stop end function
def stop_left_attachment(self): self.left_attachment.stop()
Python
nomic_cornstack_python_v1
function _is_table_valid self new_tname begin comment is it in the ermrest schema? set ermrest_schema = call getCatalogSchema assert in new_tname ermrest_schema at string schemas at string public at string tables string New table not found in ermrest schema comment is it in the local model? assert in new_tname tables c...
def _is_table_valid(self, new_tname): # is it in the ermrest schema? ermrest_schema = self.model.catalog.getCatalogSchema() self.assertIn(new_tname, ermrest_schema['schemas']['public']['tables'], 'New table not found in ermrest schema') # is it in the local model? self.assertIn(n...
Python
nomic_cornstack_python_v1
class A begin function __init__ self dog name begin set name = name set dog = dog end function function show self begin print name dog end function end class set objA = call A string DOG string NAME class B extends A begin function __init__ self fname dname begin set fname = fname set dname = dname end function functio...
class A: def __init__(self, dog, name): self.name = name; self.dog = dog; def show(self): print(self.name, self.dog) objA = A("DOG", "NAME"); class B(A): def __init__(self, fname, dname): self.fname = fname; self.dname = dname; def show(self)...
Python
zaydzuhri_stack_edu_python
function _get_dataproc_image_version image_uri begin set tuple project image_name = call _extract_image_name_and_project image_uri set command = list string gcloud string compute string images string describe image_name string --project project string --format=value(labels.goog-dataproc-version) comment get stdout from...
def _get_dataproc_image_version(image_uri): project, image_name = _extract_image_name_and_project(image_uri) command = [ "gcloud", "compute", "images", "describe", image_name, "--project", project, "--format=value(labels.goog-dataproc-version)" ] # get stdout from compute images list --filters wi...
Python
nomic_cornstack_python_v1
import argparse import io import unittest import physionet_tools.db_splitter as db_splitter import tests set TEST_RESOURCES_PATH = string { TEST_RESOURCES_PATH } /db_splitter class SplitByAgeTest extends TestCase begin function setUp self begin set rec_to_age = dict string chf10 22 ; string 16265 32 ; string 111 47 ; s...
import argparse import io import unittest import physionet_tools.db_splitter as db_splitter import tests TEST_RESOURCES_PATH = f'{tests.TEST_RESOURCES_PATH}/db_splitter' class SplitByAgeTest(unittest.TestCase): def setUp(self): self.rec_to_age = { 'chf10': 22, '16265': 32, ...
Python
zaydzuhri_stack_edu_python
comment 遍历整个列表 string magicians = ['alice','loce','lili','limei'] for magician in magicians: print(magician) print('执行结束!') set magicians = list string alice string loce string lili string limei for magician in magicians begin print magician print string 执行结束! end
#遍历整个列表 ''' magicians = ['alice','loce','lili','limei'] for magician in magicians: print(magician) print('执行结束!') ''' magicians = ['alice','loce','lili','limei'] for magician in magicians: print(magician) print('执行结束!')
Python
zaydzuhri_stack_edu_python
function dfTreatment2 df begin set df at string Nom_Estil = df at string NomdelGrup + string : + df at string Estil set loc at tuple Region == string Catalunya string NumRegio = 1 set loc at tuple Region == string Comunitat Valenciana string NumRegio = 2 set loc at tuple Region == string Illes Balears string NumRegio =...
def dfTreatment2(df): df["Nom_Estil"]=df["NomdelGrup"]+": " +df["Estil"] df.loc[df.Region =="Catalunya", 'NumRegio'] = 1 df.loc[df.Region =="Comunitat Valenciana", 'NumRegio'] = 2 df.loc[df.Region =="Illes Balears", 'NumRegio'] = 3 df.loc[df.Region =="AndorralaVella", 'NumRegio'] = 4 df.lat...
Python
nomic_cornstack_python_v1
function _get_disk self vm_size begin return if expression cc then call _size_get_disk vm_size else none end function
def _get_disk(self, vm_size): return self.cc._size_get_disk(vm_size) if self.cc else None
Python
nomic_cornstack_python_v1
comment Kattis: Best Relay Team class Runner begin function __init__ self name first_leg other_leg begin set name = name set first_leg = first_leg set other_leg = other_leg end function function show self begin print format string {} {} {} name first_leg other_leg end function function show_name self begin print name e...
#Kattis: Best Relay Team class Runner: def __init__(self, name, first_leg, other_leg): self.name = name self.first_leg = first_leg self.other_leg = other_leg def show(self): print('{} {} {}'.format(self.name, self.first_leg, self.other_leg)) def show_name(self): ...
Python
zaydzuhri_stack_edu_python
function _next_argument begin for idx in range 1 length argv begin if not starts with argv at idx string - begin return pop argv idx end end raise call TypeError string Missing argument end function
def _next_argument(): for idx in range(1, len(sys.argv)): if not sys.argv[idx].startswith("-"): return sys.argv.pop(idx) raise TypeError("Missing argument")
Python
nomic_cornstack_python_v1
function fit_predict self X y begin return predict fit self X y X end function
def fit_predict(self, X, y): return self.fit(X, y).predict(X)
Python
nomic_cornstack_python_v1
function get_mi self k label term_type=string w **kwargs begin set topk = get kwargs string topk call get_topk_terms k label term_type set topk_terms = list comprehension term for tuple term _ in topk set coocurr_df = get kwargs string coocurr call get_coocurr k label term_type topk=topk set labels_true = df at truth_c...
def get_mi(self, k, label, term_type='w', **kwargs): topk = kwargs.get('topk', self.get_topk_terms(k, label, term_type)) topk_terms = [term for term, _ in topk] coocurr_df = kwargs.get('coocurr', self.get_coocurr(k, label, term_type, topk=topk)) labels_true = self.df[self.truth_col] ...
Python
nomic_cornstack_python_v1
import time function e55 begin function is_palindrome n begin return n == integer string n at slice : : - 1 end function function reverse_and_add n begin return n + integer string n at slice : : - 1 end function set Lychrel_list = list for i in call xrange 1 10 ^ 4 begin set is_Lychrel = true set current_num = i f...
import time def e55(): def is_palindrome(n): return n == int(str(n)[::-1]) def reverse_and_add(n): return n + int(str(n)[::-1]) Lychrel_list = [] for i in xrange( 1, 10**4 ): is_Lychrel = True current_num = i for _ in xrange(50): current_num = rev...
Python
zaydzuhri_stack_edu_python
function buildBid self node name value price begin set nameData = call name_show name set addr = nameData at string address set namePrevOut = call gettxout nameData at string txid nameData at string vout call assert_equal namePrevOut at string scriptPubKey at string address addr set nameValue = namePrevOut at string va...
def buildBid (self, node, name, value, price): nameData = node.name_show (name) addr = nameData["address"] namePrevOut = node.gettxout (nameData["txid"], nameData["vout"]) assert_equal (namePrevOut["scriptPubKey"]["address"], addr) nameValue = namePrevOut["value"] tx = CTransaction () name...
Python
nomic_cornstack_python_v1
function _prepare_put_request self key value timestamp timeout put_if_exists begin set req = dict string TableName table_name ; string Item dict name dict data_type key ; name dict data_type decode base64 encode value string ascii ; name dict data_type string integer timestamp ; name dict data_type string integer times...
def _prepare_put_request(self, key, value, timestamp, timeout, put_if_exists): req = { 'TableName': self.table_name, 'Item': { self._key_field.name: { self._key_field.data_type: key }, self._value_field.name: { ...
Python
nomic_cornstack_python_v1
function get_pagination_arguments args begin set page = call arg_to_number get args string page DEFAULT_PAGE set limit = call arg_to_number get args string limit DEFAULT_LIMIT if page < 1 begin raise call DemistoException string Page argument must be greater than 1 end if not 1 <= limit <= MAX_LIMIT begin raise call De...
def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]: page = arg_to_number(args.get('page', DEFAULT_PAGE)) limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) if page < 1: raise DemistoException('Page argument must be greater than 1') if not 1 <= limit <= MAX_LIMIT: ...
Python
nomic_cornstack_python_v1
function eratosthenes num begin set lst = list range 2 num set i = 0 while i < length lst begin set lst = list comprehension j for j in lst if j == lst at i or j % lst at i set i = i + 1 end return lst end function
def eratosthenes(num): lst = list(range(2,num)) i = 0 while i < len(lst): lst = [j for j in lst if j == lst[i] or j%lst[i]] i += 1 return lst
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python3 comment -*- coding=utf-8 -*- comment @Author : zunsi comment @File : RE匹配IP地址.py comment @Time : 2019-10-20 21:25:34 import re set str1 = string Port-channel1.189 192.168.189.254 YES CONFIG up up set re_result = call groups print re_result set format_str = string {0:<7}: {1:50} print forma...
# !/usr/bin/env python3 # -*- coding=utf-8 -*- # @Author : zunsi # @File : RE匹配IP地址.py # @Time : 2019-10-20 21:25:34 import re str1 = 'Port-channel1.189 192.168.189.254 YES CONFIG up up' re_result = re.match(r'(\w\S+\d)\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+\w+\s+\w+\s+(up|down)\s+\w+', ...
Python
zaydzuhri_stack_edu_python
function reset_angle self angle=none begin pass end function
def reset_angle(self, angle=None): pass
Python
nomic_cornstack_python_v1
function create_url begin return call token_urlsafe 16 end function
def create_url() -> str: return secrets.token_urlsafe(16)
Python
nomic_cornstack_python_v1
function versions self begin set versions = generator expression left strip t string v for t in tags return filter version_is_valid versions end function
def versions(self): versions = (t.lstrip('v') for t in self.tags) return filter(version_is_valid, versions)
Python
nomic_cornstack_python_v1
function Guide command begin if command == string + begin print string Adds 1 to one of the memory values. end else if command == string - begin print string Removes 1 from one of the memory values. end else if command == string R begin print string Resets all memory values' contents. end else if command == string move...
def Guide(command): if command == "+": print("\nAdds 1 to one of the memory values.") elif command == "-": print("\nRemoves 1 from one of the memory values.") elif command == "R": print("\nResets all memory values' contents.") elif command == "move": print("\nMoves a memory value's contents to anoth...
Python
zaydzuhri_stack_edu_python
string .. module:: package_commands :platform: Unix, Windows :synopsis: Contains the functionality to create commands and events. Commands will be managed and executed by single interface i.e., :class:`CommandManager` .. moduleauthor:: Ajeet Singh <singajeet@gmail.com> from configparser import ConfigParser from ui_buil...
""" .. module:: package_commands :platform: Unix, Windows :synopsis: Contains the functionality to create commands and events. Commands will be managed and executed by single interface i.e., :class:`CommandManager` .. moduleauthor:: Ajeet Singh <singajeet@gmail.com> """ from configparser import ConfigParser fro...
Python
zaydzuhri_stack_edu_python
function test_any self begin set alias = parse __doc__ at 0 set matchex = matchex set matched = match calc accounts aliases string foo-party1999+m3047.net+y assert equal length matched 1 return end function
def test_any(self): alias = parse(self.test_any.__doc__)[0] matchex = alias.matchex matched = matchex.match(alias.calc, alias.accounts, alias.aliases, 'foo-party1999+m3047.net+y') self.assertEqual(len(matched),1) return
Python
nomic_cornstack_python_v1
import os set a = get current directory set c = list directory a
import os a=os.getcwd() c=os.listdir(a)
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- from __future__ import division comment COMECE AQUI ABAIXO set n = input string Digite n: set soma = 0 for i in range 0 n + 1 1 begin set pi = - 1 ^ i / 2 * i + 1 set soma = soma + pi end print soma * 4
# -*- coding: utf-8 -*- from __future__ import division #COMECE AQUI ABAIXO n=input('Digite n: ') soma=0 for i in range (0,n+1,1): pi=(-1**i)/(2*i+1) soma=soma+pi print (soma*4)
Python
zaydzuhri_stack_edu_python
function _set_queue self v load=false begin if has attribute v string _utype begin set v = call _utype v end try begin set t = call YANGDynClass v base=call YANGListType string name yc_queue_openconfig_qos_elements__qos_queues_queue yang_name=string queue parent=self is_container=string list user_ordered=false path_hel...
def _set_queue(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=YANGListType("name",yc_queue_openconfig_qos_elements__qos_queues_queue, yang_name="queue", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name',...
Python
nomic_cornstack_python_v1
function reverse_edges self edges inplace=true multiedges=none begin set tempG = if expression inplace then self else copy self for e in edges begin call reverse_edge e inplace=true multiedges=multiedges end if not inplace begin return tempG end end function
def reverse_edges(self, edges, inplace=True, multiedges=None): tempG = self if inplace else copy(self) for e in edges: tempG.reverse_edge(e,inplace=True,multiedges=multiedges) if not inplace: return tempG
Python
nomic_cornstack_python_v1
function add_symbol self symbol_name attrs begin set attrs at IS_FUNC = get attrs IS_FUNC false if not attrs at IS_FUNC begin if TYPE not in attrs begin raise call SymbolWithoutType symbol_name end set attrs at SIZE = call get_type_size attrs set attrs at OFFSET = next_offset set next_offset = next_offset + attrs at SI...
def add_symbol(self, symbol_name: str, attrs: dict): attrs[SymbolAttrs.IS_FUNC] = attrs.get(SymbolAttrs.IS_FUNC, False) if not attrs[SymbolAttrs.IS_FUNC]: if SymbolAttrs.TYPE not in attrs: raise SymbolWithoutType(symbol_name) attrs[SymbolAttrs.SIZE] = get_type_s...
Python
nomic_cornstack_python_v1
class MyStack extends object begin function __init__ self begin set queue1 = list set queue2 = list end function function push self x begin append queue1 x end function function pop self begin if not queue1 begin return false end while length queue1 > 1 begin append queue2 pop queue1 0 end while queue2 begin append q...
class MyStack(object): def __init__(self): self.queue1 = [] self.queue2 = [] def push(self, x): self.queue1.append(x) def pop(self): if not self.queue1: return False while len(self.queue1)>1: self.queue2.append(self.queue1.pop(0...
Python
zaydzuhri_stack_edu_python
function _update_indices source_idcs update_idcs update begin if not update_idcs begin return update_idcs end for s in source_idcs begin set update_idcs = list comprehension if expression u > s then u + update else u for u in update_idcs end return update_idcs end function
def _update_indices(source_idcs, update_idcs, update): if not update_idcs: return update_idcs for s in source_idcs: update_idcs = [u + update if u > s else u for u in update_idcs] return update_idcs
Python
nomic_cornstack_python_v1
function setup_summary self begin comment Summary collection with call variable_scope string loss begin call scalar string cls_loss cls_loss_avg call scalar string reg_loss reg_loss call scalar string learning_rate learning_rate end with call variable_scope string accuracy begin call scalar string acc_trn accuracy_avg ...
def setup_summary(self): # Summary collection with tf.variable_scope('loss'): tf.summary.scalar('cls_loss', self.cls_loss_avg) tf.summary.scalar('reg_loss', self.reg_loss) tf.summary.scalar('learning_rate', self.learning_rate) with tf.variable_scope('accurac...
Python
nomic_cornstack_python_v1
function sanitise_array data begin set array = array data if ndim == 0 begin set array = array at tuple newaxis newaxis end else if ndim == 1 begin set array = array at tuple slice : : newaxis end else if ndim != 2 begin raise call ValueError string Only 1/2 dimensional data can be saved to text files, data.shape = ...
def sanitise_array(data): array = np.array(data) if array.ndim == 0: array = array[np.newaxis, np.newaxis] elif array.ndim == 1: array = array[:, np.newaxis] elif array.ndim != 2: raise ValueError(f'Only 1/2 dimensional data can be saved to text files, data.shape = {array.shape}...
Python
nomic_cornstack_python_v1
function compareWithAll lijst previouslist feedback=0 begin global usedcombos set results = list comment to make sure there's a 2 letter combination with gaps if feedback == 2 begin for i in previouslist begin for tuple letter1 letter2 in lijst begin if letter1 in i and letter2 in i begin append results i end end end ...
def compareWithAll(lijst, previouslist, feedback = 0): global usedcombos results = [] if feedback == 2: #to make sure there's a 2 letter combination with gaps for i in previouslist: for letter1, letter2 in lijst: if letter1 in i and letter2 in i: r...
Python
nomic_cornstack_python_v1
if num % 2 == 0 begin print string par end else begin print string ímpar end
if num % 2 == 0: print("par") else: print("ímpar")
Python
zaydzuhri_stack_edu_python
import pandas as pd from tqdm import tqdm from pandas import DataFrame from abc import abstractmethod from factor.base import BaseFactor from utils.utility import stack_dataframe_by_fields class BaseCarryFactor extends BaseFactor begin string 期限结构因子基类 See Also ________ bases.bases.BaseClass factor.bases.BaseFactor func...
import pandas as pd from tqdm import tqdm from pandas import DataFrame from abc import abstractmethod from factor.base import BaseFactor from utils.utility import stack_dataframe_by_fields class BaseCarryFactor(BaseFactor): """ 期限结构因子基类 See Also ________ bases.bases.BaseClass factor.bases.Ba...
Python
zaydzuhri_stack_edu_python
function get_public_key_for_token encoded_token attempt_refresh=true logger=none begin set logger = logger or call get_logger __name__ log_level=string info set kid = call get_kid encoded_token set force_issuer = get config string FORCE_ISSUER if force_issuer begin set iss = config at string USER_API end else begin set...
def get_public_key_for_token(encoded_token, attempt_refresh=True, logger=None): logger = logger or get_logger(__name__, log_level="info") kid = get_kid(encoded_token) force_issuer = flask.current_app.config.get("FORCE_ISSUER") if force_issuer: iss = flask.current_app.config["USER_API"] else...
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- comment @author: WuFan string Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than or equal to the node's key. T...
# -*- coding: utf-8 -*- #@author: WuFan """ Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than or equal to the node's key. The right subtr...
Python
zaydzuhri_stack_edu_python
import requests from enum import Enum , auto class RefereeDecision extends Enum begin set WHITE = 0 set RED = 1 set BLUE = 2 set YELLOW = 3 end class class RefereeType extends Enum begin set MAIN = string F set LEFT = string L set RIGHT = string R end class class ApiService begin set token = none set competitionId = no...
import requests from enum import Enum, auto class RefereeDecision(Enum): WHITE = 0 RED = 1 BLUE = 2 YELLOW = 3 class RefereeType(Enum): MAIN = "F" LEFT = "L" RIGHT = "R" class ApiService: token = None competitionId = None attemptLogId = None baseUrl = "https://heavyplates...
Python
zaydzuhri_stack_edu_python
function acknowledged self begin return _acknowledged end function
def acknowledged(self): return self._acknowledged
Python
nomic_cornstack_python_v1
import csv import matplotlib.pyplot as plt set fig = figure set ax = call subplots set X = list set Y = list with open string tmp.log string r as f begin set cr = reader f for row in cr begin if row at 1 == string 500 begin append X decimal row at 3 append Y decimal row at 5 end end end for z in zip X Y begin print z...
import csv import matplotlib.pyplot as plt fig = plt.figure() ax = fig.subplots() X = [] Y = [] with open('tmp.log', 'r') as f: cr = csv.reader(f) for row in cr: if row[1] == '500': X.append(float(row[3])) Y.append(float(row[5])) for z in zip(X, Y): print(z) ax.plot(X,...
Python
zaydzuhri_stack_edu_python
function unique_words words begin set counter = dict for word in words begin set clean = lower strip word punctuation if clean in counter begin set counter at clean = counter at clean + 1 end else if clean begin set counter at clean = 1 end end return counter end function
def unique_words(words): counter = {} for word in words: clean = word.strip(string.punctuation).lower() if clean in counter: counter[clean] += 1 elif clean: counter[clean] = 1 return counter
Python
nomic_cornstack_python_v1
function serialize self buff begin try begin set _x = self write buff call pack seq secs nsecs set _x = frame_id set length = length _x if python3 or type _x == unicode begin set _x = encode _x string utf-8 set length = length _x end write buff call pack length _x set _x = self write buff call pack secs nsecs set _x = ...
def serialize(self, buff): try: _x = self buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) _x = self.header.frame_id length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.writ...
Python
nomic_cornstack_python_v1
function rotate90 imgs begin return if expression ndim == 3 then call rot90 imgs else call rot90 imgs axes=tuple 1 2 end function
def rotate90(imgs): return np.rot90(imgs) if imgs.ndim == 3 else np.rot90(imgs, axes=(1, 2))
Python
nomic_cornstack_python_v1
function load_z1qso z1qso_fil=none cand_fil=none good_z=false new=none NOSTOP=false begin comment if not NOSTOP: comment pdb.set_trace() # You probably want the UVQ DR1 if z1qso_fil is none begin set z1qso_fil = call resource_filename string uvqs string data/UVQS/uvqs_dr1_sources.fits end print format string z1qso_anal...
def load_z1qso(z1qso_fil=None, cand_fil=None, good_z=False, new=None, NOSTOP=False): #if not NOSTOP: # pdb.set_trace() # You probably want the UVQ DR1 if z1qso_fil is None: z1qso_fil = resource_filename('uvqs', 'data/UVQS/uvqs_dr1_sources.fits') print('z1qso_analy: Reading z1qso data from...
Python
nomic_cornstack_python_v1
function add a b begin return a + b end function function subtract a b begin return a - b end function function multiply a b begin return a * b end function function divide a b begin return a / b end function function main begin set continue_program = true while continue_program begin call display_menu set user_choice ...
def add(a,b): return a+b def subtract(a,b): return a-b def multiply(a,b): return a*b def divide(a,b): return a/b def main(): continue_program = True while (continue_program): display_menu() user_choice = input("Choice: ") # Students must first be taught that, in python, functions are first class citizens (...
Python
zaydzuhri_stack_edu_python
function add_mines self begin set mine_locations = list while length mine_locations < num_mines begin set tuple r c = tuple random integer 0 row - 1 random integer 0 col - 1 comment Sanity check if we are not repeating the mines if tuple r c not in mine_locations begin set box = call widget set is_mine = true append m...
def add_mines(self): mine_locations = [] while len(mine_locations) < self.num_mines: r, c = random.randint(0, self.row - 1), random.randint(0, self.col - 1) # Sanity check if we are not repeating the mines if (r, c) not in mine_locations: box = sel...
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- comment DS1820.py # comment Communication with DS1820 # comment (c) https://github.com/thomaspfeiffer-git May 2015, 2016, 2017 # import re import time import sys import threading class Consume_CPU extends Thread begin string cause of some timing issues of the kernel implementation of the 1...
# -*- coding: utf-8 -*- ############################################################################## # DS1820.py # # Communication with DS1820 # # (c) https://github.com/thomaspfeiffer-git May 2015, 2016,...
Python
zaydzuhri_stack_edu_python
function member_names self begin return call yield_column_names schema end function
def member_names(self) -> Iterator[str]: return yield_column_names(self.schema)
Python
nomic_cornstack_python_v1
import numpy as np import matplotlib.pyplot as plt function f x begin return 2 * sin x + 2015 end function set x1 = array range 0.0 10.0 0.5 title plt string UNIVERSIDAD plot x1 f dist x1 string cs x1 f dist x1 string g save figure string Universidad.png show
import numpy as np import matplotlib.pyplot as plt def f(x): return (2*np.sin(x))+2015 x1=np.arange(0.0,10.0,0.5) plt.title('UNIVERSIDAD') plt.plot(x1,f(x1),'cs',x1,f(x1),'g') plt.savefig('Universidad.png') plt.show()
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- string Created on Thu Jun 18 18:08:48 2015 Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. Tag: Linked List idea: 如果遇到重复则把当前节点的next指向下一个的next,并且保持当前节点不动。 如果没有重复,则当前节点到下一...
# -*- coding: utf-8 -*- """ Created on Thu Jun 18 18:08:48 2015 Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. Tag: Linked List idea: 如果遇到重复则把当前节点的next指向下一个的next,并且保持当前节点不动。 如果没有重复,则当前节点到下一个节点。...
Python
zaydzuhri_stack_edu_python
function print_message outfile msg format_str=string indent=0 begin call write_indent outfile indent write outfile format string SCAPULA_PRINT("{msg}"{fmt}); msg=string msg fmt=if expression not format_str then string else string , + string format_str end function
def print_message(outfile: TextIO, msg: str, format_str: str="", indent: int=0): write_indent(outfile, indent) outfile.write("SCAPULA_PRINT(\"{msg}\"{fmt});\n".format( msg=str(msg), fmt="" if not format_str else ", " + str(format_str) ))
Python
nomic_cornstack_python_v1
function gaussian X model transposition=false **kwargs begin comment create linear points from samples set x = linear space min X axis=0 max X axis=0 length X comment calculate probability of each points set tuple logprob responsibilities = eval x set pdf = exp logprob end function
def gaussian(X, model, transposition=False, **kwargs): # create linear points from samples x = np.linspace(np.min(X, axis=0), np.max(X, axis=0), len(X)) # calculate probability of each points logprob, responsibilities = model.eval(x) pdf = np.exp(logprob)
Python
nomic_cornstack_python_v1
from urllib.request import urlopen from bs4 import BeautifulSoup as soup import astropy.io.fits as fits from astropy import time , coordinates as coord import glob import datetime set star = input string Enter star system : set planet = input string Enter planet in star system : set url = string http://var2.astro.cz/ET...
from urllib.request import urlopen from bs4 import BeautifulSoup as soup import astropy.io.fits as fits from astropy import time, coordinates as coord import glob import datetime star = input("Enter star system : ") planet = input("Enter planet in star system : ") url = "http://var2.astro.cz/ETD/etd....
Python
zaydzuhri_stack_edu_python
comment Author(s) - Mukund Manikarnike from igraph import * from random import randint import scipy import scipy.stats comment Read from the anonymized edge list that was created set anonymizedEdgeListFile = open string anonymized_edge_list.csv string r comment Create a graph object for the graph that has been created ...
#Author(s) - Mukund Manikarnike from igraph import * from random import randint import scipy import scipy.stats #Read from the anonymized edge list that was created anonymizedEdgeListFile = open("anonymized_edge_list.csv", 'r') #Create a graph object for the graph that has been created graph = Graph() graph.add_ver...
Python
zaydzuhri_stack_edu_python
for i in range 1 n + 1 begin set res = res + binary i at slice 2 : : end return integer res 2 % mod
for i in range(1,n+1): res += bin(i)[2:] return int(res,2) % mod
Python
zaydzuhri_stack_edu_python
function task_sphinx begin return call Task file_dep=list CONF actions=list tuple needs list string sphinx uptodate=list not exists CONF end function
def task_sphinx(): return Task( file_dep=[CONF], actions=[(needs, ["sphinx"])], uptodate=[not CONF.exists()] )
Python
nomic_cornstack_python_v1
string Resource --> CTCI and learning from hackerrank linked lists class Node begin function __init__ self data begin set data = data set next = none end function end class class Stack begin function __init__ self begin set top = none end function function push self data begin set new_node = call Node data if top is no...
''' Resource --> CTCI and learning from hackerrank linked lists ''' class Node: def __init__(self, data): self.data = data self.next = None class Stack: def __init__(self): self.top = None def push(self, data): new_node = Node(data) if self.top is None: ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python3 comment audit_missing_library_music comment Retrieves all songs in both the beets datbase and converted library folder comment then returns a list of all paths in the beets database that do not exist in the converted library folder comment USAGE: comment --db - Path to the beets datbase fi...
#!/usr/bin/env python3 # audit_missing_library_music # Retrieves all songs in both the beets datbase and converted library folder # then returns a list of all paths in the beets database that do not exist in the converted library folder # USAGE: # --db - Path to the beets datbase file # --dir - Directory to searc...
Python
zaydzuhri_stack_edu_python
function get_highest_priority_queue_that_needs_work self begin set non_empty_queues = list for tuple queue_name queue in call iteritems queues begin if not call is_queue_empty queue begin append non_empty_queues queues at queue_name end end if length non_empty_queues == 0 begin return none end sort non_empty_queues ke...
def get_highest_priority_queue_that_needs_work(self): non_empty_queues = [] for (queue_name, queue) in six.iteritems(self.queues): if not self.is_queue_empty(queue): non_empty_queues.append(self.queues[queue_name]) if len(non_empty_queues) == 0: return Non...
Python
nomic_cornstack_python_v1
function onDelSavePressed begin global menuList set buttonText = call getText call getButtonAt menuList at 1 call getSelectedIndex menuList at 1 if buttonText != string Nouvelle partie begin call sysExec string clear call printScreen string Pictures/comfirmDeleteSave.pic write stdout string [16; + string integer round...
def onDelSavePressed(): global menuList buttonText = Button.getText(Menu.getButtonAt(menuList[1],Menu.getSelectedIndex(menuList[1]))) if(buttonText != "Nouvelle partie"): Tools.sysExec("clear") Menu.printScreen("Pictures/comfirmDeleteSave.pic") sys.stdout.write("\033[16;"+str(int(round((Object.SCREEN_WIDTH/2...
Python
nomic_cornstack_python_v1
import requests from bs4 import BeautifulSoup set r = get requests string http://example.com set data = text set soup = call BeautifulSoup data string html.parser for item in find all soup string div begin print text end
import requests from bs4 import BeautifulSoup r = requests.get("http://example.com") data = r.text soup = BeautifulSoup(data, 'html.parser') for item in soup.find_all("div"): print(item.text)
Python
jtatman_500k
comment This package will contain the spiders of your Scrapy project comment Please refer to the documentation for information on how to create and manage comment your spiders. import requests from bs4 import BeautifulSoup comment import scrapy comment from scrapy.spidermiddlewares.httperror import HttpError comment fr...
# This package will contain the spiders of your Scrapy project # # Please refer to the documentation for information on how to create and manage # your spiders. import requests from bs4 import BeautifulSoup # import scrapy # from scrapy.spidermiddlewares.httperror import HttpError # from twisted.internet.error import ...
Python
zaydzuhri_stack_edu_python
function getIntersectorList self l begin return list comprehension call getIntersector v for v in l end function
def getIntersectorList(self, l): return [self.getIntersector(v) for v in l]
Python
nomic_cornstack_python_v1
import sys set input = readline set n = integer input function solution n begin set arr = list set answer = list for i in range n begin append arr integer input set j = i while j begin if arr at j < arr at j - 1 begin set tuple arr at j arr at j - 1 = tuple arr at j - 1 arr at j set j = j - 1 end else begin break end...
import sys input = sys.stdin.readline n = int(input()) def solution(n): arr = [] answer = [] for i in range(n): arr.append(int(input())) j = i while j: if arr[j] < arr[j-1]: arr[j], arr[j-1] = arr[j-1], arr[j] j -= 1 else: ...
Python
zaydzuhri_stack_edu_python
function printwin window x y data begin call addstr y x data call refresh end function
def printwin(window, x, y, data): window.addstr(y,x,data) window.refresh()
Python
nomic_cornstack_python_v1
function forward self state action valid_reward_len=none begin set states = float_features set actions = float_features set batch_size = shape at 1 set hidden = call get_initial_hidden_state states at 0 at tuple none slice : : slice : : batch_size=batch_size comment all_steps_hidden shape: seq_len, batch_size, hi...
def forward( self, state: rlt.FeatureData, action: rlt.FeatureData, valid_reward_len: Optional[torch.Tensor] = None, ): states = state.float_features actions = action.float_features batch_size = states.shape[1] hidden = self.get_initial_hidden_state( ...
Python
nomic_cornstack_python_v1
from typing import List class Solution begin function setZeroes self matrix begin string Do not return anything, modify matrix in-place instead. set row = length matrix set col = length matrix at 0 set row_zero = set set col_zero = set for i in range row begin for j in range col begin if matrix at i at j == 0 begin add...
from typing import List class Solution: def setZeroes(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ row = len(matrix) col = len(matrix[0]) row_zero = set() col_zero = set() for i i...
Python
zaydzuhri_stack_edu_python
function nb_cube figure begin set nb = 0 for i in range length figure begin for j in range length figure at 0 begin for k in range length figure at 0 at 0 begin if num != 0 begin set nb = nb + 1 end end end end return nb end function
def nb_cube(figure): nb = 0 for i in range (len(figure)): for j in range (len(figure[0])): for k in range (len(figure[0][0])): if figure[i][j][k].num != 0 : nb += 1 return nb
Python
nomic_cornstack_python_v1
function clear_calculator self begin call display 0 call setText string call setText string call setText string end function
def clear_calculator(self): self.ui.screen.display(0) self.ui.molecule_line_edit.setText('') self.ui.calc_param_line_edit.setText('') self.ui.showing_results_label.setText('')
Python
nomic_cornstack_python_v1
function check_with_place self place data_layout dtype shape slot_dim=- 1 begin set epsilon = 1e-05 if length shape == 2 begin set x_shape = shape set c = x_shape at 1 end else begin call ValueError string len(shape) should be equal to 2 end set scale_shape = list c set x_val = as type call random_sample x_shape dtype ...
def check_with_place(self, place, data_layout, dtype, shape, slot_dim=-1): epsilon = 0.00001 if len(shape) == 2: x_shape = shape c = x_shape[1] else: ValueError("len(shape) should be equal to 2") scale_shape = [c] x_val = np.random.random_samp...
Python
nomic_cornstack_python_v1
comment Problem 89 comment 18 February 2005 comment The rules for writing Roman numerals allow for many ways of writing each number (see About Roman Numerals...). However, there is always a "best" way of writing a particular number. comment For example, the following represent all of the legitimate ways of writing the ...
#Problem 89 #18 February 2005 #The rules for writing Roman numerals allow for many ways of writing each number (see About Roman Numerals...). However, there is always a "best" way of writing a particular number. #For example, the following represent all of the legitimate ways of writing the number sixteen: #III...
Python
zaydzuhri_stack_edu_python
comment 15. Write a Python program to assess if a file is closed or not set fi1 = open string file.txt string r set fi2 = open string file.txt string r print closed close fi1 print closed close fi2 print closed print closed comment output string [ashutoshmeena111@demo-1 FileHandlingAssignment]$ python program15.py Fals...
#15. Write a Python program to assess if a file is closed or not fi1=open("file.txt","r") fi2=open("file.txt","r") print(fi1.closed) fi1.close() print(fi2.closed) fi2.close() print(fi1.closed) print(fi2.closed) #output ''' [ashutoshmeena111@demo-1 FileHandlingAssignment]$ python program15.py False False True True '''...
Python
zaydzuhri_stack_edu_python
import os import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.stats import kde import scipy.stats as st comment color plot of given samples function plot_density samples a b nbins iteration L path begin set X_LIMS = tuple - L L set Y_LIMS = tuple - L L set fig = fi...
import os import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.stats import kde import scipy.stats as st # color plot of given samples def plot_density(samples, a, b, nbins, iteration, L, path): X_LIMS = (-L, L) Y_LIMS = (-L, L) fig = plt.figure(figs...
Python
zaydzuhri_stack_edu_python