code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
function execute_action self agent action begin set bump = false set performance_measure = performance_measure - 1 if action == string TurnRight begin set heading = call turn_heading heading - 1 end else if action == string TurnLeft begin set heading = call turn_heading heading + 1 end else if action == string Forward ...
def execute_action(self, agent, action): agent.bump = False agent.performance_measure -= 1 if action == 'TurnRight': agent.heading = self.turn_heading(agent.heading, -1) elif action == 'TurnLeft': agent.heading = self.turn_heading(agent.heading, +1) elif ...
Python
nomic_cornstack_python_v1
set strings = split input set even_words = list comprehension print word for word in strings if length word % 2 == 0
strings = input().split() even_words = [print(word) for word in strings if len(word) % 2 == 0]
Python
zaydzuhri_stack_edu_python
function getset self *args begin if _cluster begin return execute self string GETSET *args shard_key=args at 0 end return execute self string GETSET *args end function
def getset(self, *args): if self._cluster: return self.execute(u'GETSET', *args, shard_key=args[0]) return self.execute(u'GETSET', *args)
Python
nomic_cornstack_python_v1
class Guest begin function __init__ self name begin set name = name set group = list end function function group_size self begin return length group end function function add_to_group self new_guest begin append group new_guest end function function remove_from_group self guest_to_remove begin remove group guest_to_re...
class Guest: def __init__(self, name): self.name = name self.group = [] def group_size(self): return len(self.group) def add_to_group(self, new_guest): self.group.append(new_guest) def remove_from_group(self, guest_to_remove): self.group.remove(guest_to_re...
Python
zaydzuhri_stack_edu_python
import os import glob import re import csv set a = glob glob string season*.csv set fileName = a at 0 set fields = list set rows = list set burnleyGames = list set palaceGames = list set burnleySeasonGoals = 0 set palaceSeasonGoals = 0 set burnleyGoalsConceded = 0 set palaceGoalsConceded = 0 set burnleyShots = 0 se...
import os import glob import re import csv a = glob.glob("season*.csv") fileName = a[0] fields = [] rows = [] burnleyGames = [] palaceGames = [] burnleySeasonGoals = 0 palaceSeasonGoals = 0 burnleyGoalsConceded = 0 palaceGoalsConceded = 0 burnleyShots = 0 palaceShots = 0 with open(fileName, 'r') as csvfile: cs...
Python
zaydzuhri_stack_edu_python
function to_precision x p begin set x = decimal x if x == 0.0 begin return string 0. + string 0 * p - 1 end set out = list if x < 0 begin append out string - set x = - x end set e = integer call log10 x set tens = power 10 e - p + 1 set n = floor x / tens if n < power 10 p - 1 begin set e = e - 1 set tens = power 10 e...
def to_precision(x,p): x = float(x) if x == 0.: return "0." + "0"*(p-1) out = [] if x < 0: out.append("-") x = -x e = int(math.log10(x)) tens = math.pow(10, e - p + 1) n = math.floor(x/tens) if n < math.pow(10, p - 1): e = e -1 tens = math.po...
Python
nomic_cornstack_python_v1
comment Reverses the string function encrypt text begin set i = length text - 1 set translated = string while i >= 0 begin set translated = translated + text at i set i = i - 1 end return translated end function comment Calls the function and outputs the calculation function main begin set text = input string What str...
#Reverses the string def encrypt(text): i = len(text) - 1 translated = "" while i >= 0: translated = translated + text[i] i = i - 1 return translated #Calls the function and outputs the calculation def main(): text = input("What string would you like to encode?") print("Your encr...
Python
zaydzuhri_stack_edu_python
comment by Lucas and Siddhant comment loading libaries import csv import json comment reading csv into a variable called vegetables with open string vegetables.csv string r as f begin set reader = dict reader f set vegetables = list reader comment Convert OrderedDict to regular dict set vegetables = list comprehension ...
#by Lucas and Siddhant #loading libaries import csv import json #reading csv into a variable called vegetables with open('vegetables.csv', 'r') as f: reader = csv.DictReader(f) vegetables = list(reader) vegetables = [dict(row) for row in vegetables] # Convert OrderedDict to regular dict #checking diction...
Python
zaydzuhri_stack_edu_python
function get_uninitialized_variables variables=none session=none begin if not session begin set session = call get_default_session end if variables is none begin set variables = call global_variables end else begin set variables = list variables end set init_flag = run stack list comprehension call is_variable_initiali...
def get_uninitialized_variables(variables=None, session=None): if not session: session = tf.get_default_session() if variables is None: variables = tf.global_variables() else: variables = list(variables) init_flag = session.run( tf.stack([t...
Python
nomic_cornstack_python_v1
import os set wordcount = list set linecount = list set average = list set countword = list set avgword = list function mean numbers begin return decimal sum numbers / max length numbers 1 end function set PyPara = join path string Resources string paragraph_1.txt set outputTXT = join path string Resources string ...
import os wordcount=[] linecount = [] average =[] countword = [] avgword = [] def mean(numbers): return float(sum(numbers)) / max(len(numbers), 1) PyPara = os.path.join('Resources','paragraph_1.txt') outputTXT= os.path.join("Resources", "paragraph_1_Rev.txt") with open(PyPara, newline="") as txtfile: para...
Python
zaydzuhri_stack_edu_python
function _refresh_outlineexplorer self index=none update=true clear=false begin string Refresh outline explorer panel set oe = outlineexplorer if oe is none begin return end if index is none begin set index = call get_stack_index end if data begin set finfo = data at index call setEnabled true if oe_proxy is none begin...
def _refresh_outlineexplorer(self, index=None, update=True, clear=False): """Refresh outline explorer panel""" oe = self.outlineexplorer if oe is None: return if index is None: index = self.get_stack_index() if self.data: finfo = self.d...
Python
jtatman_500k
comment views.py from django.shortcuts import render import datetime comment Create your views here. function show_time request begin set now = now set date_time = string format time now string %d/%m/%Y, %H:%M:%S set context = dict string current_date_time date_time return call render request string time.html context e...
# views.py from django.shortcuts import render import datetime # Create your views here. def show_time(request): now = datetime.datetime.now() date_time = now.strftime("%d/%m/%Y, %H:%M:%S") context = { 'current_date_time': date_time } return render(request, 'time.html', context) # urls.py ...
Python
jtatman_500k
function confidence self confidence begin set _confidence = confidence end function
def confidence(self, confidence): self._confidence = confidence
Python
nomic_cornstack_python_v1
function test_cpupin_format1 self begin call _update_vm_vcpu_pinning vcpu_pinning=DEFAULT_VCPU_PINNING end function
def test_cpupin_format1(self): self._update_vm_vcpu_pinning(vcpu_pinning=conf.DEFAULT_VCPU_PINNING)
Python
nomic_cornstack_python_v1
function stroke_rect self x y width height=none begin if height is none begin set height = width end call send_draw_command self COMMANDS at string strokeRect list x y width height end function
def stroke_rect(self, x, y, width, height=None): if height is None: height = width self._canvas_manager.send_draw_command( self, COMMANDS["strokeRect"], [x, y, width, height] )
Python
nomic_cornstack_python_v1
function evaluate_2d self box instance begin set error = mean np norm box at slice 1 : : - instance at slice 1 : : axis=1 set _error_2d = _error_2d + error return error end function
def evaluate_2d(self, box, instance): error = np.mean(np.linalg.norm(box[1:] - instance[1:], axis=1)) self._error_2d += error return error
Python
nomic_cornstack_python_v1
function get_group_with_rank rank groups begin for group in groups begin if rank in group begin return group end end raise call ValueError string Rank { rank } was not in any of the groups. end function
def get_group_with_rank(rank: int, groups: list[list[int]]) -> list[int]: for group in groups: if rank in group: return group raise ValueError(f'Rank {rank} was not in any of the groups.')
Python
nomic_cornstack_python_v1
function _remove_empty_events sse begin set sse_new = copy sse for tuple pixel link in items sse begin if link == set list begin del sse_new at pixel end end return sse_new end function
def _remove_empty_events(sse): sse_new = sse.copy() for pixel, link in sse.items(): if link == set([]): del sse_new[pixel] return sse_new
Python
nomic_cornstack_python_v1
function in_nbo self begin set saddr = call _addr_to_nbo saddr set daddr = call _addr_to_nbo daddr if is instance sport int begin set sport = call pack string !H sport end else begin set sport = sport end if is instance dport int begin set dport = call pack string !H dport end else begin set dport = dport end return ca...
def in_nbo(self): saddr = self._addr_to_nbo(self.saddr) daddr = self._addr_to_nbo(self.daddr) if isinstance(self.sport, int): sport = struct.pack('!H', self.sport) else: sport = self.sport if isinstance(self.dport, int): dport = struct.pack('...
Python
nomic_cornstack_python_v1
if num < 0 begin print string Factorial of negative number is not possible. end else if num == 1 begin print string Factorial of 1 is 1. end else begin for i in call xrange 1 num + 1 begin set fact = fact * i end print string Factorial of num string is fact end
if num < 0: print("Factorial of negative number is not possible.") elif num == 1: print("Factorial of 1 is 1.") else: for i in xrange(1, num + 1): fact = fact * i print("Factorial of", num, "is", fact)
Python
zaydzuhri_stack_edu_python
function search_destiny_entities_get self page searchTerm type begin comment TODO: Assuming first server is good - need to make fallback logic return call get_any format string {base}{request_url} base=servers at 0 request_url=string /Destiny2/Armory/Search/ { type } / { searchTerm } / end function
def search_destiny_entities_get(self, page, searchTerm, type): # TODO: Assuming first server is good - need to make fallback logic return self.session.get_any("{base}{request_url}".format(base=self.servers[0], request_url=F"/Destiny2/Armor...
Python
nomic_cornstack_python_v1
from hexBase import HexBase import Rhino.Geometry.Point3d as Point3d class HexShape extends HexBase begin function __init__ self grid pointer begin set cornersPt = list set centerPt = none set grid = grid set pointer = pointer set corners = list set seq = list list 0 0 list - 1 1 list - 1 2 list 0 3 list 1 2 list 1 1...
from hexBase import HexBase import Rhino.Geometry.Point3d as Point3d class HexShape(HexBase): def __init__(self, grid, pointer): self.cornersPt = [] self.centerPt = None self.grid = grid self.pointer = pointer self.corners = [] self.seq = [[0,0...
Python
zaydzuhri_stack_edu_python
function ignore_change self begin try begin set _ignore_change_callbacks = true yield end finally begin set _ignore_change_callbacks = false end end function
def ignore_change(self): try: self._ignore_change_callbacks = True yield finally: self._ignore_change_callbacks = False
Python
nomic_cornstack_python_v1
import pandas as pd import statistics import csv import random set df = read csv string data.csv set data = call tolist set samples = list for test in range 1 100 begin set x = random integer 1 length data - 1 append samples data at x end print samples set mean = mean statistics samples
import pandas as pd import statistics import csv import random df = pd.read_csv("data.csv") data = df["average"].tolist() samples = [] for test in range(1,100): x = random.randint(1,len(data)-1) samples.append(data[x]) print (samples) mean = statistics.mean(samples)
Python
zaydzuhri_stack_edu_python
from django.http import HttpResponse import datetime as dt function timeLine request begin set date = now set s = string Current date is + string call date + string <br> time is : + string time return call HttpResponse s end function
from django.http import HttpResponse import datetime as dt def timeLine(request): date=dt.datetime.now() s='Current date is'+str(date.date())+' <br> time is :'+str(date.time()) return HttpResponse(s)
Python
zaydzuhri_stack_edu_python
from mostra_caminho import MostraCaminho class DepthFirst begin function __init__ self grafo start goalNode begin set mostraCaminho = call MostraCaminho set caminho = dict set visitados = list set listaAdj = list set grafo = grafo set start = start set goalNode = goalNode end function function iniciarBusca self begi...
from mostra_caminho import MostraCaminho class DepthFirst: def __init__(self, grafo, start, goalNode): self.mostraCaminho = MostraCaminho() self.caminho = {} self.visitados = [] self.listaAdj = [] self.grafo = grafo self.start = start self.goalN...
Python
zaydzuhri_stack_edu_python
function _copy_node_type cls type_iter target log begin for obj in type_iter begin if id not in target begin set c_obj = call add_node deep copy obj debug string Copy NFFG node: %s % c_obj end else begin for p in ports begin if id not in ports begin call add_port id=id properties=properties comment TODO: Flowrules are ...
def _copy_node_type (cls, type_iter, target, log): for obj in type_iter: if obj.id not in target: c_obj = target.add_node(deepcopy(obj)) log.debug("Copy NFFG node: %s" % c_obj) else: for p in obj.ports: if p.id not in target.network.node[obj.id].ports: targe...
Python
nomic_cornstack_python_v1
function get_cross_val_scores self X y scoring=none verbose=0 begin comment CV method set kf = call KFold n_splits=5 shuffle=true random_state=random_state comment generating validation predictions set scores = cross val score model X y cv=kf scoring=scoring verbose=verbose comment calculating result return scores end ...
def get_cross_val_scores(self, X, y, scoring=None, verbose=0): # CV method kf = KFold( n_splits=5, shuffle=True, random_state=self.random_state ) # generating validation predictions scores = cross_val_score( self.model, ...
Python
nomic_cornstack_python_v1
function predict self begin set ph = call Predictor oh gh ch verbose call predict_model end function
def predict(self): ph = Predictor(self.oh, self.gh, self.ch, self.verbose) ph.predict_model()
Python
nomic_cornstack_python_v1
import pygame import math from shapely.geometry import Point function rot_center image angle begin set orig_rect = call get_rect set rot_image = call rotate image angle set rot_rect = copy orig_rect set center = center set rot_image = copy call subsurface rot_rect return rot_image end function function p2l p begin retu...
import pygame import math from shapely.geometry import Point def rot_center(image, angle): orig_rect = image.get_rect() rot_image = pygame.transform.rotate(image, angle) rot_rect = orig_rect.copy() rot_rect.center = rot_image.get_rect().center rot_image = rot_image.subsurface(rot_rect).copy() ...
Python
zaydzuhri_stack_edu_python
function name self begin return get pulumi self string name end function
def name(self) -> str: return pulumi.get(self, "name")
Python
nomic_cornstack_python_v1
string 使用Python爬虫爬取自己博客统计不同的博客的浏览量 升级版 import json import re import requests from com.dong.entity.Csdn import Csdn from com.dong.utils.DbPoolUtil import dbpool function parse_page_index html begin set p = compile string item-tiling.*?title="(.*?)".*?title="(.*?)".*?title="(.*?)".*?title="(.*?)".*?grade-box.*?title="(.*...
""" 使用Python爬虫爬取自己博客统计不同的博客的浏览量 升级版 """ import json import re import requests from com.dong.entity.Csdn import Csdn from com.dong.utils.DbPoolUtil import dbpool def parse_page_index(html): p = re.compile( ( 'item-tiling.*?title="(.*?)".*?title="(.*?)".*?title="(.*?)".*?title="(.*?)".*?' ...
Python
zaydzuhri_stack_edu_python
comment the numpy array import numpy as np comment import for keras modules from keras.datasets import imdb from keras.models import load_model from keras.preprocessing import sequence , text comment load the save model set model_path = string /home/ousainou/PycharmProjects/Thesis/data/models/imdb set model = call load...
# the numpy array import numpy as np # import for keras modules from keras.datasets import imdb from keras.models import load_model from keras.preprocessing import sequence ,text # load the save model model_path = '/home/ousainou/PycharmProjects/Thesis/data/models/imdb' model = load_model(model_path + 'lstm_imdb_mod...
Python
zaydzuhri_stack_edu_python
function check_he_vm_nic_via_guest_os nic_name begin set vm_os_nics = call all_interfaces step testflow string Check via guest OS that HE VM has NIC %s nic_name return nic_name in vm_os_nics end function
def check_he_vm_nic_via_guest_os(nic_name): vm_os_nics = conf.ENGINE_HOST.network.all_interfaces() test_libs.testflow.step( "Check via guest OS that HE VM has NIC %s", nic_name ) return nic_name in vm_os_nics
Python
nomic_cornstack_python_v1
function fw_ipv6_access_rules self begin return call IPv6Rule meta=call Meta href=call _link string fw_ipv6_access_rules end function
def fw_ipv6_access_rules(self): return IPv6Rule(meta=Meta(href=self._link('fw_ipv6_access_rules')))
Python
nomic_cornstack_python_v1
comment jihecaozuo comment KONGJIHE set set_1 = set print set_1 set set_1 = set literal string a string b print set_1 comment 不包含重复字符 set set_1 = set string abcabc print set_1 comment 添加;add添加一个元素 add set_1 string love print set_1 add set_1 string hate print set_1 comment set_1.add([0,1,2])报错 comment #可变类型不能放入集合(不可变类型有...
#jihecaozuo #KONGJIHE set_1 = set() print(set_1) set_1 = {'a','b'} print(set_1) #不包含重复字符 set_1 = set('abcabc') print(set_1) #添加;add添加一个元素 set_1.add('love') print(set_1) set_1.add('hate') print(set_1) # set_1.add([0,1,2])报错 # #可变类型不能放入集合(不可变类型有数字 字符串 元组) #删除 set_1.remove('a') print(set_1) set_1.discard('5')#若删除的元素不...
Python
zaydzuhri_stack_edu_python
import pygame import random import moves class Player begin function __init__ self colour begin set colour = colour set score = 0 end function end class class Human extends Player begin function __init__ self colour begin call __init__ colour set my_turn = false end function function promotion_handler self move begin s...
import pygame import random import moves class Player: def __init__(self, colour): self.colour = colour self.score = 0 class Human(Player): def __init__(self, colour): super().__init__(colour) self.my_turn = False def promotion_handler(self, move): """Before m...
Python
zaydzuhri_stack_edu_python
function test_form_save_handles_saving_to_a_list self begin with patch string test_utils.mocked_models.ItemForm._DEBUG_DO_NOT_SAVE_TO_LIST true begin call test_form_save_handles_saving_to_a_list end end function
def test_form_save_handles_saving_to_a_list(self): with patch('test_utils.mocked_models.ItemForm._DEBUG_DO_NOT_SAVE_TO_LIST', True): super(ItemFormTestFail, self).test_form_save_handles_saving_to_a_list()
Python
nomic_cornstack_python_v1
function remove_from_cart self product quantity begin if product in cart begin set current_quantity = get cart product if current_quantity < quantity begin print string Cannot remove more than what is in the cart return end set new_quantity = current_quantity - quantity if new_quantity == 0 begin pop cart product none ...
def remove_from_cart(self, product, quantity): if product in self.cart: current_quantity = self.cart.get(product) if current_quantity < quantity: print('Cannot remove more than what is in the cart') return new_quantity = current_quantity - quantity if new_quantity == 0: self.cart.pop(produ...
Python
nomic_cornstack_python_v1
from django.shortcuts import render , redirect from forms import StudentForm from models import Student comment create a new entry of student in database function new_student request begin if method == string POST begin set form = call StudentForm POST if call is_valid begin save return call redirect string students_de...
from django.shortcuts import render, redirect from .forms import StudentForm from .models import Student def new_student(request): #create a new entry of student in database if request.method == "POST": form = StudentForm(request.POST) if form.is_valid(): form.save() return ...
Python
zaydzuhri_stack_edu_python
function get_calls_list self session date=none begin if date == none begin set calls = all end else begin set calls = all end return calls end function
def get_calls_list(self, session, date=None) -> List: if date == None: calls = session.query( Calls.id, Calls.planned_at, Calls.linkedin, Calls.leadgen_id ).all() else: calls = session.query( ...
Python
nomic_cornstack_python_v1
comment Using kamilsudol be5820ba6ab1a4e3005dd4243d931b2f3cbcde88 import unittest import task import events class Tests extends TestCase begin function setUp self begin set car = call Car string Opel end function function test_turn_start self begin start car assert equal true car_started end function function test_turn...
#Using kamilsudol be5820ba6ab1a4e3005dd4243d931b2f3cbcde88 import unittest import task import events class Tests(unittest.TestCase): def setUp(self): self.car = task.Car("Opel") def test_turn_start(self): self.car.start() self.assertEqual(True, self.car.car_started) def test_turn_...
Python
zaydzuhri_stack_edu_python
import math import numpy as np from ddqn_c51.memory import ReplayMemory from ddqn_c51.nn import NN class C51Agent begin string The DDQN Agent, notice the difference to DQN lies in the use of a target network function __init__ self env memory net target_net atoms=51 epsilon_init=1 gamma=0.99 epsilon_min=0.01 epsilon_dec...
import math import numpy as np from ddqn_c51.memory import ReplayMemory from ddqn_c51.nn import NN class C51Agent: """ The DDQN Agent, notice the difference to DQN lies in the use of a target network """ def __init__(self, env, memory: ReplayMemory, ...
Python
zaydzuhri_stack_edu_python
function check_symbols self classtypes path begin set symbols_pass = call SymbolsPass pk_members pk_import path set error_messages : List at str = list for AST in values pk_mains begin extend error_messages call check_symbols AST end for AST in values pk_workunits begin extend error_messages call check_symbols AST end...
def check_symbols(self, classtypes: List[PyKokkosEntity], path: str) -> None: symbols_pass = SymbolsPass(self.pk_members, self.pk_import, path) error_messages: List[str] = [] for AST in self.pk_members.pk_mains.values(): error_messages.extend(symbols_pass.check_symbols(AST)) ...
Python
nomic_cornstack_python_v1
set x = input string enteryournumber set y = integer x set z = y * y print z set x = 2 * 0 set y = 1 set z = x + y print z set x = string dog set y = string cat set x = 2 print x y set M = 12 print m
x=input("enteryournumber") y=int(x) z=y*y print(z) x=2*0 y=1 z=x+y print(z) x="dog" y="cat" x=2 print(x,y) M=12 print(m)
Python
zaydzuhri_stack_edu_python
function handle_commands C begin while true begin set response = input MENU if response == string q begin return C end else if response == string n begin set r = call Restaurant_get_info set C = call Collection_add C r end else if response == string e begin set C = list end else if response == string c begin set n = d...
def handle_commands(C: list) -> list: while True: response = input(MENU) if response=="q": return C elif response=='n': r = Restaurant_get_info() C = Collection_add(C, r) elif response== 'e': C = [] elif response == 'c': ...
Python
nomic_cornstack_python_v1
function complement self other=none begin comment default behaviour : return complement of self if other is none begin return call Sequence join string generator expression call __complement base for base in _sequence end else comment complement of a string, if valid if is instance other str begin if call is_valid_seq...
def complement(self, other: Optional[str] = None): if other is None: # default behaviour : return complement of self return Sequence("".join(self.__complement(base) for base in self._sequence)) elif isinstance(other, str): # complement of a string, if valid if Sequence.is_valid...
Python
nomic_cornstack_python_v1
comment -----------------------------------------------------------------# comment Write a python program which acts as a calculator (function based) comment -----------------------------------------------------------------# function calculator begin set Mathoperation = input string ------------------------------------...
#-----------------------------------------------------------------# #Write a python program which acts as a calculator (function based) #-----------------------------------------------------------------# def calculator(): Mathoperation = input(''' ------------------------------------------------------------- ...
Python
zaydzuhri_stack_edu_python
set name = string umar set dept = string science education print name string ,dept set scare = string boo! print scare set n1 = 3 set n2 = 5 set n3 = n1 + n2
name ="umar" dept ="science education" print(name,"\n,dept") scare="boo!" print (scare) n1= 3 n2 = 5 n3 = n1 + n2
Python
zaydzuhri_stack_edu_python
function get_keys self seq depend_on=none begin set key_idx_list = list set order = idx_map at 1 at - 1 + 1 if depend_on is none begin for i in range 0 length seq - order + 1 begin set tuple key idx = call ngram_key seq i order if key is not none and idx is not none begin append key_idx_list tuple key idx end end end ...
def get_keys(self, seq, depend_on=None): key_idx_list = [] order = self.idx_map[1][-1] + 1 if depend_on is None: for i in range(0, len(seq)-order+1): key, idx = self.ngram_key(seq, i, order) if key is not None and idx is not None: ...
Python
nomic_cornstack_python_v1
class Piglet begin function speak self begin print string oink oink end function end class set hamlet = call Piglet call speak
class Piglet: def speak(self): print("oink oink") hamlet = Piglet() hamlet.speak()
Python
zaydzuhri_stack_edu_python
from ariadne import * function Intialization begin print string 1. x*x-2 print string 2. x*x*x-10 print string 3. 6*x*x+4*x-50 print string 4. x*x-200 end function function function_for_execution function_number x begin comment f=['x*x-2','x*x*x-10','4*x*x-50','x*x-200'] if function_number == 1 begin set f = x * x - 2 ...
from ariadne import * def Intialization(): print("1. x*x-2") print("2. x*x*x-10") print("3. 6*x*x+4*x-50") print("4. x*x-200") def function_for_execution(function_number,x): #f=['x*x-2','x*x*x-10','4*x*x-50','x*x-200'] if function_number==1: f= x*x-2 elif function_numbe...
Python
zaydzuhri_stack_edu_python
comment Uses Python3 set a = input set lists = split a set x = integer lists at 0 set y = integer lists at 1 set tuple a b = tuple x y while y != 0 begin set tuple x y = tuple y x % y end print integer a // x * b
#Uses Python3 a = input() lists = a.split() x = int(lists[0]) y = int(lists[1]) a,b = x,y while y != 0: x,y = y, x%y print(int((a//x)*b))
Python
zaydzuhri_stack_edu_python
function plot_edoses self dos_pos=none method=string gaussian step=0.01 width=0.1 **kwargs begin string Plot the band structure and the DOS. Args: dos_pos: Index of the task from which the DOS should be obtained. None is all DOSes should be displayed. Accepts integer or list of integers. method: String defining the met...
def plot_edoses(self, dos_pos=None, method="gaussian", step=0.01, width=0.1, **kwargs): """ Plot the band structure and the DOS. Args: dos_pos: Index of the task from which the DOS should be obtained. None is all DOSes should be displayed. Accepts integer or lis...
Python
jtatman_500k
from lxml import etree import urllib import json comment Here is the list of abbreviations to be used for all BART reachable stations: comment https://api.bart.gov/docs/overview/abbrev.aspx set from_station = string Mont set to_station = string Dublin/Pleasanton set to_station_abbrev = string dubl comment MW9S-E7SL-26D...
from lxml import etree import urllib import json # Here is the list of abbreviations to be used for all BART reachable stations: # https://api.bart.gov/docs/overview/abbrev.aspx from_station = "Mont" to_station = "Dublin/Pleasanton" to_station_abbrev = "dubl" # MW9S-E7SL-26DU-VV8V is the api access key provided by ht...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- string TWITTER SCRAPING BOT 2021 USE A SCRAPER ACCOUNT! comment Block of Essential Python Modules from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import expected_conditions as EC from...
# -*- coding: utf-8 -*- """ TWITTER SCRAPING BOT 2021 USE A SCRAPER ACCOUNT! """ # Block of Essential Python Modules from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import expected_conditions as EC f...
Python
zaydzuhri_stack_edu_python
function find begin set dRow = list 0 1 0 - 1 set dCol = list 1 0 - 1 0 set s = list comment 입구로 이동 append s list sRow sCol comment 방문 표시 set maze at sRow at sCol = 1 while length s != 0 begin comment 이동할 칸 좌표를 꺼내고 set n = pop s comment 주변 좌표 계산 for i in range 4 begin set nRow = n at 0 + dRow at i set nCol = n at 1 + ...
def find(): dRow = [0,1,0,-1] dCol = [1,0,-1,0] s = [] s.append([sRow,sCol]) # 입구로 이동 maze[sRow][sCol] = 1 # 방문 표시 while(len(s)!=0): n = s.pop() # 이동할 칸 좌표를 꺼내고 for i in range(4): # 주변 좌표 계산 nRow = n[0] + dRow[i] nCol = n[1] + dCol[i] ...
Python
zaydzuhri_stack_edu_python
comment Le holdem game from settings import * from time import * import hand import math import random import sys comment TODO: comment bets don't add up comment blind doesn't register right player comment eternal passing still? comment "h": [ comment "~holdem <start holdem game>", comment "~bet [amount] <>", comment "...
# Le holdem game from settings import * from time import * import hand import math import random import sys # TODO: # bets don't add up # blind doesn't register right player # eternal passing still? # "h": [ # "~holdem <start holdem game>", # "~bet [amount] <>", # "~call <match bet, if able>", # "~ra...
Python
zaydzuhri_stack_edu_python
function generate self sorder begin from generator import For from symbolic import nx , ny , nz , indexed , ix set ns = integer nv_ptr at - 1 set dim = dim set tuple istore iload ncond = call _get_istore_iload_symb dim set tuple rhs dist = call _get_rhs_dist_symb ncond set idx = call Idx ix tuple 0 ncond set fstore = c...
def generate(self, sorder): from .generator import For from .symbolic import nx, ny, nz, indexed, ix ns = int(self.stencil.nv_ptr[-1]) dim = self.stencil.dim istore, iload, ncond = self._get_istore_iload_symb(dim) rhs, dist = self._get_rhs_dist_symb(ncond) idx ...
Python
nomic_cornstack_python_v1
function errprint msg begin write stderr msg flush stderr end function
def errprint(msg): sys.stderr.write(msg) sys.stderr.flush()
Python
nomic_cornstack_python_v1
import math import random import csv import numpy as np function setup_env begin set env = zeros tuple 100 4 set neg_coord = list 33 45 46 56 58 68 73 75 76 set wall_coord = list 21 22 23 24 26 27 28 34 44 54 64 74 set goal_coord = list 55 for i in range 100 begin if i < 10 begin set env at i at 0 = 999 end if i > 89 b...
import math import random import csv import numpy as np def setup_env(): env = np.zeros((100, 4)) neg_coord = [33, 45, 46, 56, 58, 68, 73, 75, 76] wall_coord = [21, 22, 23, 24, 26, 27, 28, 34, 44, 54, 64, 74] goal_coord = [55] for i in range(100): if (i < 10): env[i][0] = 999 if (i > 89)...
Python
zaydzuhri_stack_edu_python
function register_loader_type loader_type provider_factory begin set _provider_factories at loader_type = provider_factory end function
def register_loader_type(loader_type, provider_factory): _provider_factories[loader_type] = provider_factory
Python
nomic_cornstack_python_v1
function is_active self user begin if is_superuser begin return true end if start_date or end_date begin set started = true set ended = false set now = now if start_date and start_date > now begin set started = false end if end_date and now >= end_date begin set ended = true end return started and not ended end else be...
def is_active(self, user): if user.is_superuser: return True if self.start_date or self.end_date: started = True ended = False now = datetime.datetime.now() if self.start_date and self.start_date > now: started = False ...
Python
nomic_cornstack_python_v1
from pmc.singleton import singleton function test_singleton begin string Test ``pmc.singleton.singleton`` functionality. decorator singleton class TestClassA begin pass end class decorator singleton class TestClassB begin pass end class set instance_a_one = call TestClassA set instance_a_two = call TestClassA set insta...
from pmc.singleton import singleton def test_singleton(): """ Test ``pmc.singleton.singleton`` functionality. """ @singleton class TestClassA: pass @singleton class TestClassB: pass instance_a_one = TestClassA() instance_a_two = TestClassA() instance_b = Test...
Python
zaydzuhri_stack_edu_python
function test_options_with_multiple_values begin set result = call _parse_options string test=foo,bar assert result == dict string test list string foo string bar end function
def test_options_with_multiple_values(): result = _parse_options( """ test=foo,bar """ ) assert result == {"test": ["foo", "bar"]}
Python
nomic_cornstack_python_v1
set s = input set l = split s set n = integer l at 0 set m = integer l at 1 print 1 ? n + 1 ? m
s=input() l=s.split() n=int(l[0]) m=int(l[1]) print((1<<n)+(1<<m))
Python
zaydzuhri_stack_edu_python
function replay self batch_size begin if length memory < batch_size begin return end set mini_batch = random sample memory batch_size for tuple state action reward next_state done in mini_batch begin set target = reward if not done begin string # predict the reward of the next state future_value = self.model.predict(ne...
def replay(self, batch_size): if len(self.memory) < batch_size: return mini_batch = random.sample(self.memory, batch_size) for state, action, reward, next_state, done in mini_batch: target = reward if not done: """ # predict t...
Python
nomic_cornstack_python_v1
from flask import Flask set app = call Flask __name__ decorator call route string / function hello begin return string I Made Website With Python + Flask + Linux + Apache2! end function decorator call route string /returnsHTML function secondEndPoint begin return string <html><body><h1>A Header!</h1><p>Here is some dat...
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "I Made Website With Python + Flask + Linux + Apache2!" @app.route("/returnsHTML") def secondEndPoint(): return "<html><body><h1>A Header!</h1><p>Here is some data in a paragraph!</p></body></html>" if __name__ == "__main__":...
Python
zaydzuhri_stack_edu_python
from abc import ABC , abstractmethod from dataclasses import dataclass from typing import List from datetime import datetime from learning_hub.domain.common import Entity , Validator decorator call dataclass frozen=true class Assignment extends Entity begin set name : str set resource : str set instructions : str end c...
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import List from datetime import datetime from learning_hub.domain.common import Entity, Validator @dataclass(frozen=True) class Assignment(Entity): name: str resource: str instructions: str @dataclass(fr...
Python
zaydzuhri_stack_edu_python
import random set n = 5 set z = list comprehension list 0 * n for i in range n for r in range n begin for s in range n begin set z at r at s = random integer 0 1 print z at r at s end=string end print end set _x = integer input string Zadaj súradnicu x: set _y = integer input string Zadaj súradnicu y: if z at _x at _y ...
import random n = 5 z = [[0]*n for i in range(n)] for r in range(n): for s in range(n): z[r][s]= random.randint(0,1) print(z[r][s], end=" ") print() _x = int(input("Zadaj súradnicu x:")) _y = int(input("Zadaj súradnicu y:")) if z[_x][_y] == 1: z[_x][_y] = 0 else: z[_x][_y] = ...
Python
zaydzuhri_stack_edu_python
function test XTest model begin set YPredict = predict model XTest return YPredict end function
def test(XTest, model): YPredict = model.predict(XTest) return YPredict
Python
nomic_cornstack_python_v1
import operator import os import re import matplotlib.pyplot as plt from wordcloud import WordCloud function interpret_args args begin string :param args: *args :return: input_path, output_path, list of special words if length args == 1 begin set path = string test.txt end else if args at 1 == string def begin set path...
import operator import os import re import matplotlib.pyplot as plt from wordcloud import WordCloud def interpret_args(args): """ :param args: *args :return: input_path, output_path, list of special words """ if len(args) == 1: path = 'test.txt' else: if args[1] == 'def': ...
Python
zaydzuhri_stack_edu_python
comment coding=utf-8 import sys set special_chars = list string Ȁ string Ȃ string Ȅ string Ȇ string Ȉ string Ȋ comment up left comment down left comment up right comment down right comment vertical comment horizontal if length argv < 4 begin print string Usage: python patcher.py commands box outputfile exit 0 end set c...
# coding=utf-8 import sys special_chars = [ 'Ȁ', # up left 'Ȃ', # down left 'Ȅ', # up right 'Ȇ', # down right 'Ȉ', # vertical 'Ȋ' # horizontal ] if len(sys.argv) < 4: print("Usage: python patcher.py commands box outputfile") exit(0) commandsfile = sys.argv[1] boxfile = sys.argv[2] o...
Python
zaydzuhri_stack_edu_python
import sys set num = integer strip read line stdin set lst = sorted set map int split strip read line stdin print *lst
import sys num = int(sys.stdin.readline().strip()) lst = sorted(set(map(int, sys.stdin.readline().strip().split()))) print(*lst)
Python
zaydzuhri_stack_edu_python
string " ===================================================================================== Gerenciamento de Erros ===================================================================================== - Dead letter queue (Filas de re-tentativas) - Monitoramento entre eixos - Rastreamento de Fluxo ===================...
"""" ===================================================================================== Gerenciamento de Erros ===================================================================================== - Dead letter queue (Filas de re-tentativas) - Monitoramento entre eixos - Rastreamento d...
Python
zaydzuhri_stack_edu_python
function __init__ self variables constraints begin set constraints = constraints string list of constraints set variables = dict string dictionary of variable names to variable instances set domains = dict string dictionary of variable names to DiscreteSet/IntervalSet with admissible values for var in variables begin...
def __init__(self,variables, constraints): self.constraints = constraints "list of constraints" self.variables = {} "dictionary of variable names to variable instances" self.domains = {} "dictionary of variable names to DiscreteSet/IntervalSet with admissible values" ...
Python
nomic_cornstack_python_v1
from operator import itemgetter import re from utils import Roman class DataSanitization begin function __init__ self file_name begin set sorted_names_weight = list set renamed = dict set file_name = file_name end function function sanitize self begin string Sanitize using a determined set or rules a text file with c...
from operator import itemgetter import re from utils import Roman class DataSanitization(): def __init__(self, file_name): self.sorted_names_weight = [] self.renamed = {} self.file_name = file_name def sanitize(self): """ Sanitize using a determined set or rules a...
Python
zaydzuhri_stack_edu_python
function get_status workflow_id begin set tuple exit_code output = call run_pegasus string status workflow_id=workflow_id if exit_code != 0 begin return string UNKNOWN end set in_dag_status = false for line in read lines call StringIO output begin if string UNRDY in line or string UNREADY in line begin set in_dag_statu...
def get_status(workflow_id): exit_code, output = run_pegasus('status', workflow_id=workflow_id) if exit_code != 0: return 'UNKNOWN' in_dag_status = False for line in cStringIO.StringIO(output).readlines(): if 'UNRDY' in line or 'UNREADY' in line: in_dag_status = True ...
Python
nomic_cornstack_python_v1
function getAllDistances self begin if distances is none begin return none end return distances at tuple slice : _distanceCount : slice : : end function
def getAllDistances(self): if self.distances is None: return None return self.distances[:self._distanceCount, :]
Python
nomic_cornstack_python_v1
function _load_buffer self buffer_point_idx begin if buffer_point_idx >= length buffer_points begin set buffer_data = list set buffer_targets = list return true end if file is none begin call _open_file end set tuple start end = buffer_points at buffer_point_idx set loaded = list zip data at slice start : end : targ...
def _load_buffer(self, buffer_point_idx: int) -> bool: if buffer_point_idx >= len(self.buffer_points): self.buffer_data = [] self.buffer_targets = [] return True if self.file is None: self._open_file() start, end = self.buffer_points[buffer_point_i...
Python
nomic_cornstack_python_v1
import pynput from pynput.keyboard import Key , Listener set count = 0 set keys = list set world = string function on_press key begin print key set word = word + key print string pressed global keys count append keys string key print keys set count = count + 1 end function function on_release key begin if key == esc ...
import pynput from pynput.keyboard import Key, Listener count = 0 keys = [] world="" def on_press(key): print(key) word=word+key print("pressed") global keys, count keys.append(str(key)) print(keys) count += 1 def on_release(key): if key == Key.esc: return with...
Python
zaydzuhri_stack_edu_python
function variable_details var begin set tuple var_id region metric = split var string - set name = var_names at var_id return tuple var_id region metric name end function
def variable_details(var): var_id, region, metric = var.split('-') name = var_names[var_id] return var_id, region, metric, name
Python
nomic_cornstack_python_v1
string Question 2.8 from LinkedList import * function loop_detection looped_list begin string Returns the node at the begining of the loop if not next or not next begin return none end set slow = next set fast = next while slow and fast and slow != fast begin set slow = next set fast = next end if not slow or not fast ...
""" Question 2.8 """ from LinkedList import * def loop_detection(looped_list): """ Returns the node at the begining of the loop """ if not looped_list.next or not looped_list.next.next: return None slow = looped_list.next fast = looped_list.next.next while slow and fast and slow != fast:...
Python
zaydzuhri_stack_edu_python
import board , busio , adafruit_ssd1306 , time , adafruit_dht import RPi.GPIO as GPIO from PIL import Image , ImageDraw , ImageFont from tinydb import TinyDB from datetime import datetime , timedelta comment Setup I/O and sensors set i2c = call I2C SCL SDA set display = call SSD1306_I2C 128 64 i2c set dht11 = call DHT1...
import board, busio, adafruit_ssd1306, time, adafruit_dht import RPi.GPIO as GPIO from PIL import Image, ImageDraw, ImageFont from tinydb import TinyDB from datetime import datetime, timedelta # Setup I/O and sensors i2c = busio.I2C(board.SCL, board.SDA) display = adafruit_ssd1306.SSD1306_I2C(128, 64, i2c) dht11 = ada...
Python
zaydzuhri_stack_edu_python
function setenv self var value begin call _log_command list string export format string {}={} var value if not dryrun begin set environ at var = value end end function
def setenv(self, var, value): self._log_command(["export", "{}={}".format(var, value)]) if not self.dryrun: os.environ[var] = value
Python
nomic_cornstack_python_v1
if divisor1 > ending or divisor2 > ending begin print string Invalid!! end for i in range 1 ending + 1 begin if i % divisor1 == 0 and i % divisor2 == 0 begin print i end end
if divisor1>ending or divisor2>ending: print("Invalid!!") for i in range(1, ending+1): if i % divisor1==0 and i % divisor2==0: print(i)
Python
zaydzuhri_stack_edu_python
import unittest from logic import * class TestCases extends TestCase begin function test_case_1 self begin assert false call is_even 3 assert true call is_even 6 pass end function function test_case_2 self begin assert true call in_an_interval 2 assert false call in_an_interval 9 assert false call in_an_interval 45 ass...
import unittest from logic import * class TestCases(unittest.TestCase): def test_case_1(self): self.assertFalse(is_even(3)) self.assertTrue(is_even(6)) pass def test_case_2(self): self.assertTrue(in_an_interval(2)) self.assertFalse(in_an_interval(9)) self.assertFalse(in_an_interval(45)) self.assertFals...
Python
zaydzuhri_stack_edu_python
string Created on 12 jun. 2017 @author: Alfonso from EliminacionDeVariables import descarteDeVariables , factoresIniciales , eliminacionVariablesOcultas , multiplicacionNormalizacionFactores from Heuristicas import minDegree , minFill , minFactor from InferenciaAproximada import muestraAleatoria , muestreoConRechazo fr...
''' Created on 12 jun. 2017 @author: Alfonso ''' from EliminacionDeVariables import descarteDeVariables, factoresIniciales, \ eliminacionVariablesOcultas, multiplicacionNormalizacionFactores from Heuristicas import minDegree, minFill, minFactor from InferenciaAproximada import muestraAleatoria, muestreoConRechazo...
Python
zaydzuhri_stack_edu_python
class Solution begin function inorderTraversal self root begin set res : List at int = list if not root begin return list end if left begin call inorderTraversal left end append res val if right begin call inorderTraversal right end return res end function function inorderTraversal self root begin set res : List at i...
class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: res:List[int]=[] if not root: return [] if root.left: self.inorderTraversal(root.left) res.append(root.val) if root.right: self.inorderTraversal(root.right) re...
Python
zaydzuhri_stack_edu_python
comment Shi Tao Luo comment Shitao.luo40@myhunter.cuny.edu comment Nov. 11 2019 comment This program print out the collitions in nyc import folium import pandas as pd set inF = input string Enter a csv file: set outF = input string Enter a output file: set Colli = read csv inF set mapColli = map location=list 40.75 - 7...
#Shi Tao Luo #Shitao.luo40@myhunter.cuny.edu #Nov. 11 2019 #This program print out the collitions in nyc import folium import pandas as pd inF = input("Enter a csv file:") outF = input("Enter a output file:") Colli = pd.read_csv(inF) mapColli = folium.Map(location=[40.75, -74.125], zoom_start = 10, tiles="Carto...
Python
zaydzuhri_stack_edu_python
import sys import os import numpy as np import flask import pickle import time set HER_GRID = 50 set VER_GRID = 50 set HER_LEN = 1050 set VER_LEN = 750 set a_col = 6 set a_row = 4 set hopDis = 2 set COL = HER_LEN // HER_GRID set ROW = VER_LEN // VER_GRID set PRELOCATION = 10 set arg1 = argv at 1 set loaded_model = load...
import sys import os import numpy as np import flask import pickle import time HER_GRID = 50 VER_GRID = 50 HER_LEN = 1050 VER_LEN = 750 a_col = 6 a_row = 4 hopDis = 2 COL = HER_LEN//HER_GRID ROW = VER_LEN//VER_GRID PRELOCATION = 10 arg1 = sys.argv[1] loaded_model = pickle.load(open("model.pkl","rb")) if not arg1: ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python comment -*-coding:utf-8-*- import hashlib comment 判断一个字符串是否为none火控 function defaultIfEmpty string defaultStr begin return if expression string == none or string == string then defaultStr else string end function comment 计算字符串的md5值
#!/usr/bin/env python # -*-coding:utf-8-*- import hashlib #判断一个字符串是否为none火控 def defaultIfEmpty(string,defaultStr): return defaultStr if string==None or string == "" else string #计算字符串的md5值
Python
zaydzuhri_stack_edu_python
import io import struct from mcserver.events.init import HandshakeEvent from mcserver.events.login import ConfirmEncryptionEvent , LoginStartEvent from mcserver.events.status import PingEvent , StatusEvent , Connect16Event from mcserver.objects.server_core import ServerCore from mcserver.utils.cryptography import decry...
import io import struct from mcserver.events.init import HandshakeEvent from mcserver.events.login import ConfirmEncryptionEvent, LoginStartEvent from mcserver.events.status import PingEvent, StatusEvent, Connect16Event from mcserver.objects.server_core import ServerCore from mcserver.utils.cryptography import decrypt...
Python
zaydzuhri_stack_edu_python
function PrependItem self parent text ct_type=0 wnd=none image=- 1 selImage=- 1 data=none begin return call DoInsertItem parent 0 text ct_type wnd image selImage data end function
def PrependItem(self, parent, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None): return self.DoInsertItem(parent, 0, text, ct_type, wnd, image, selImage, data)
Python
nomic_cornstack_python_v1
string class decorators described in the preceding chapter sometimes overlap with metaclasses—in terms of both utility and benefit. Although they are often used for managing instances, class decorators can also augment classes, independent of any created instances. Their syntax makes their usage similarly explicit, and...
''' class decorators described in the preceding chapter sometimes overlap with metaclasses—in terms of both utility and benefit. Although they are often used for managing instances, class decorators can also augment classes, independent of any created instances. Their syntax makes their usage similarly explicit, and ar...
Python
zaydzuhri_stack_edu_python
function fix_go_names directory file begin comment Description comment Reads a .csv file with the GO-Ontology Data, then fixes the term names to not show the ID, then writes back to the file with the appended name. comment Arguments comment directory: The directory where the csv files are comment file: The name of the ...
def fix_go_names(directory, file): ##Description ##Reads a .csv file with the GO-Ontology Data, then fixes the term names to not show the ID, then writes back to the file with the appended name. ##Arguments ##directory: The directory where the csv files are ##file: The name of the file that you wan...
Python
zaydzuhri_stack_edu_python
function set self value begin if value is none begin call _set_error true end else comment notify external source to update the value if is instance _src DS begin if set ref value begin comment on update success call _set_cache_value value call _set_error false end else begin comment on update error call _set_error tru...
def set(self, value): if value is None: self._set_error(True) else: # notify external source to update the value if isinstance(self._src, DS): if self._src.set(self.ref, value): # on update success self._set_cach...
Python
nomic_cornstack_python_v1
import json from postrunner.request import Request class Collection begin set info = dictionary set __requests = list function __init__ self collection_as_string cert=none verify=true begin set collection_obj = loads collection_as_string call __load collection_obj end function function __getattr__ self attr begin for r...
import json from postrunner.request import Request class Collection: info = dict() __requests = list() def __init__(self, collection_as_string, cert=None, verify=True): collection_obj = json.loads(collection_as_string) self.__load(collection_obj) def __getattr__(self, attr): for r in self.__requests: ...
Python
zaydzuhri_stack_edu_python
import numpy as np import copy import pickle import sys import time from nn.functional import clip_gradients class Model begin function __init__ self begin set layers = list set inputs = none set optimizer = none set regularization = none end function function add self layer begin append layers layer end function func...
import numpy as np import copy import pickle import sys import time from nn.functional import clip_gradients class Model(): def __init__(self): self.layers = [] self.inputs = None self.optimizer = None self.regularization = None def add(self, layer): self.layers.appen...
Python
zaydzuhri_stack_edu_python
function pre a b begin import pandas as pd import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeClassifier from sklearn import preprocessing from sklearn.linear_model import LinearRegression set basic = read csv string location_Avail.csv set le = call LabelEncoder set x1 = basic at string SOIL set y1 = ...
def pre(a,b): import pandas as pd import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeClassifier from sklearn import preprocessing from sklearn.linear_model import LinearRegression basic=pd.read_csv('location_Avail.csv') le = preprocessing.LabelEncoder() x1 = basic["SOIL"] y1 = basic["STATE"] ...
Python
zaydzuhri_stack_edu_python