code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
comment 1 comment 3 5 comment 7 9 11 comment 13 15 17 19 comment 21 23 25 27 29 comment ... function row_sum_odd_numbers n begin set middle_l = 0 set middle_2 = 0 set the_sum = 0 set total = 0 set middle = n ^ 2 if middle % 2 == 0 begin set middle_l = middle - 1 set the_sum = the_sum + middle_l set middle_r = middle + ...
# 1 # 3 5 # 7 9 11 # 13 15 17 19 #21 23 25 27 29 #... def row_sum_odd_numbers(n): middle_l = 0 middle_2 = 0 the_sum = 0 total = 0 middle = n ** 2 if middle % 2 == 0: middle_l = middle - 1 the_sum += middle_l middle_r = middle + 1 ...
Python
zaydzuhri_stack_edu_python
comment ! /usr/bin/python3 import os from subprocess import PIPE , Popen comment function for returning terminal command cret=command return function cret command begin set process = popen args=command stdout=PIPE shell=true return communicate process at 0 end function set a = call cret string mediainfo --Inform="Video...
#! /usr/bin/python3 import os from subprocess import PIPE, Popen #function for returning terminal command cret=command return def cret(command): process = Popen( args=command, stdout=PIPE, shell=True ) return process.communicate()[0] a=cret('mediainfo --Inform="Video;%Duration/S...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python comment coding=utf-8 import random import string import sys import math from PIL import Image , ImageDraw , ImageFont , ImageFilter comment 字体的位置,不同版本的系统会有不同 comment font_path = r'C:\Windows\Fonts\Arial\ariblk.ttf' set font_path = string C:\Windows\Fonts\Microsoft YaHei\msyh.ttf comment 生成几...
#!/usr/bin/env python #coding=utf-8 import random import string import sys import math from PIL import Image,ImageDraw,ImageFont,ImageFilter #字体的位置,不同版本的系统会有不同 #font_path = r'C:\Windows\Fonts\Arial\ariblk.ttf' font_path = r'C:\Windows\Fonts\Microsoft YaHei\msyh.ttf' #生成几位数的验证码 number = 4 #生成验证码图片的高度和宽度 size = (100,30...
Python
zaydzuhri_stack_edu_python
string newest version auto configures x and y pad from PIL import ImageGrab from PIL import Image from PIL import ImageOps from Cord import Cord from numpy import * import os import time from ctypes import windll import win32api import win32con import win32gui set user32 = user32 call SetProcessDPIAware class Api begin...
""" newest version auto configures x and y pad """ from PIL import ImageGrab from PIL import Image from PIL import ImageOps from Cord import Cord from numpy import * import os import time from ctypes import windll import win32api import win32con import win32gui user32 = windll.user32 user32.SetProcessDPI...
Python
zaydzuhri_stack_edu_python
function resize_volume self size begin set curr_size = size if size <= curr_size begin raise call InvalidVolumeResize string The new volume size must be larger than the current volume size of '%s'. % curr_size end set body = dict string volume dict string size size call action self string resize body=body end function
def resize_volume(self, size): curr_size = self.volume.size if size <= curr_size: raise exc.InvalidVolumeResize("The new volume size must be larger " "than the current volume size of '%s'." % curr_size) body = {"volume": {"size": size}} self.manager.action...
Python
nomic_cornstack_python_v1
function play_game word_list begin comment TO DO ... comment random init set hand = call deal_hand HAND_SIZE while true begin set cmd = input string Enter n to deal a new hand, r to replay the last hand, or e to end game: if cmd == string n begin set hand = call deal_hand HAND_SIZE call play_hand copy hand word_list pr...
def play_game(word_list): # TO DO ... hand = deal_hand(HAND_SIZE) # random init while True: cmd = input('Enter n to deal a new hand, r to replay the last hand, or e to end game: ') if cmd == 'n': hand = deal_hand(HAND_SIZE) play_hand(hand.copy(), word_list) ...
Python
nomic_cornstack_python_v1
function fit self X y begin comment Store the classes seen during fit set classes_ = call unique_labels y set class_map_ = dictionary comprehension k : i for tuple i k in enumerate classes_ set class_map_inverse_ = dictionary comprehension i : k for tuple i k in enumerate classes_ set map_label_ = call vectorize lambda...
def fit(self, X, y): # Store the classes seen during fit self.classes_ = unique_labels(y) self.class_map_ = {k: i for i, k in enumerate(self.classes_)} self.class_map_inverse_ = {i: k for i, k in enumerate(self.classes_)} self.map_label_ = np.vectorize(lambda x: self.class_map_[x...
Python
nomic_cornstack_python_v1
function test_transform_column_values_format self begin call _test_transform_column_values string {}_out end function
def test_transform_column_values_format(self): self._test_transform_column_values("{}_out")
Python
nomic_cornstack_python_v1
if age >= 18 begin print string No fajnie, jestes dorosly! end else if age > 100 begin print string Serio? end else begin print string Troche Ci jeszcze brakuje, co? end
if (age>=18): print("No fajnie, jestes dorosly!") elif (age >100): print("Serio?") else: print ("Troche Ci jeszcze brakuje, co?")
Python
zaydzuhri_stack_edu_python
function _get_laser_bias_current self begin return __laser_bias_current end function
def _get_laser_bias_current(self): return self.__laser_bias_current
Python
nomic_cornstack_python_v1
comment -*- coding:UTF-8 -*- import json import urllib.request import urllib.parse from lxml import etree string 爬取内涵段子 class NeiHan extends object begin function __init__ self url begin set url = url set headers = dict string User-Agent string Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko...
# -*- coding:UTF-8 -*- import json import urllib.request import urllib.parse from lxml import etree ''' 爬取内涵段子 ''' class NeiHan(object): def __init__(self,url): self.url = url self.headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) V...
Python
zaydzuhri_stack_edu_python
function division dataword poly begin set dataword = dataword + string 0 * length poly - 1 while length dataword >= length poly begin if dataword at 0 == string 1 begin for i in range length poly begin if dataword at i == poly at i begin set dataword = dataword at slice : i : + string 0 + dataword at slice i + 1 : :...
def division(dataword,poly): dataword=dataword + "0"*(len(poly)-1) while len(dataword)>=len(poly): if dataword[0]=='1': for i in range(len(poly)): if dataword[i]==poly[i]: dataword = dataword[:i] + "0" + dataword[i + 1:] else: ...
Python
zaydzuhri_stack_edu_python
function largest_prime_in_range start end begin set largest_prime = 0 comment Iterate over the range for i in range start end + 1 begin comment Check if number is prime set is_prime = true if i > 1 begin for j in range 2 ceil square root i + 1 begin if i % j == 0 begin set is_prime = false break end end end comment Che...
def largest_prime_in_range(start, end): largest_prime = 0 # Iterate over the range for i in range(start, end + 1): # Check if number is prime is_prime = True if i > 1: for j in range(2, ceil(sqrt(i))+ 1): if i % j == 0: is_prime = False...
Python
jtatman_500k
function sig_heatmap_html_extract files begin set signal = list comprehension list comprehension none for j in range length files at 0 for i in range length files set bg = list comprehension list comprehension none for j in range length files at 0 for i in range length files for tuple i file_row in enumerate files begi...
def sig_heatmap_html_extract(files): signal = [[None for j in range(len(files[0]))] for i in range(len(files))] bg = [[None for j in range(len(files[0]))] for i in range(len(files))] for i, file_row in enumerate(files): for j, file in enumerate(file_row): signal[i][j], _, bg[i][j], __ ...
Python
nomic_cornstack_python_v1
function get_item_name sp item_type item_id begin if item_type == string playlist begin set name = get call playlist playlist_id=item_id fields=string name string name end else if item_type == string album begin set name = get call album album_id=item_id string name end else if item_type == string track begin set name ...
def get_item_name(sp, item_type, item_id): if item_type == 'playlist': name = sp.playlist(playlist_id=item_id, fields='name').get('name') elif item_type == 'album': name = sp.album(album_id=item_id).get('name') elif item_type == 'track': name = sp.track(track_id=item_id).get('name') ...
Python
nomic_cornstack_python_v1
comment import all the library import cv2 , time import numpy as np from os import listdir , makedirs from os.path import isfile , join , exists class Recognise begin function __init__ self begin set faceClassifier = call CascadeClassifier string Haarcascades/haarcascade_frontalface_default.xml end function function cr...
# import all the library import cv2, time import numpy as np from os import listdir, makedirs from os.path import isfile, join, exists class Recognise: def __init__(self): self.faceClassifier = cv2.CascadeClassifier('Haarcascades/haarcascade_frontalface_default.xml') def create(self, name): ...
Python
zaydzuhri_stack_edu_python
function has_permission user *permissions **role_kwargs begin string Judge if an user has permission, and if it does return role object, and if it doesn't return False. role_kwargs will be passed to role functions. With role object, you can use role.relation to get Role_Perm_Rel object. set Role = call get_model string...
def has_permission(user, *permissions, **role_kwargs): """ Judge if an user has permission, and if it does return role object, and if it doesn't return False. role_kwargs will be passed to role functions. With role object, you can use role.relation to get Role_Perm_Rel object. """ Role = g...
Python
jtatman_500k
function left self left begin call left left end function
def left(self, left): self.ptr.left(left)
Python
nomic_cornstack_python_v1
function type self begin return get pulumi self string type end function
def type(self) -> str: return pulumi.get(self, "type")
Python
nomic_cornstack_python_v1
comment coding: UTF-8 string Created on 2013-5-8 Author: tianwei Description: Main Program import os import sys import config from post_rc import DailyPost from getApi import GetRepoCommits function make_beautiful info=none begin string make beautiful format In: a list Out: a formatted string text if info is none begin...
# coding: UTF-8 """ Created on 2013-5-8 Author: tianwei Description: Main Program """ import os import sys import config from post_rc import DailyPost from getApi import GetRepoCommits def make_beautiful(info=None): """ make beautiful format In: a list Out: a formatted string text ...
Python
zaydzuhri_stack_edu_python
function post self begin set base_url = string http://api.openweathermap.org/data/2.5/weather?q= set parser = call RequestParser call add_argument string city required=true help=string A city needs to be provided. set args = call parse_args set formatted_search_term = quote city comment randomize temperature unit set c...
def post(self): self.base_url = 'http://api.openweathermap.org/data/2.5/weather?q=' parser = reqparse.RequestParser() parser.add_argument('city', required=True, help='A city needs to be provided.') args = parser.parse_args() formatted_search_term = parse.quote(args.city) ...
Python
nomic_cornstack_python_v1
if st1 == st2 begin print string Strings are equal. end else begin print string Strings are not equal. end
if st1 == st2: print("Strings are equal.") else: print("Strings are not equal.")
Python
iamtarun_python_18k_alpaca
function display_message_on_maschine self message screen_index begin call _send_to_display message screen_index end function
def display_message_on_maschine(self, message, screen_index): self._send_to_display(message, screen_index)
Python
nomic_cornstack_python_v1
import re function remove_comments text begin set regex = string (\".*?\"|\'.*?\')|(/\*.*?\*/|\#[^\r\n]*$) set clean_text = strip sub regex string text 0 MULTILINE return clean_text end function call remove_comments string # This is a python comment print("Hello world") # This is another comment comment output: print ...
import re def remove_comments(text): regex = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|\#[^\r\n]*$)" clean_text = re.sub(regex, "", text, 0, re.MULTILINE).strip() return clean_text remove_comments("# This is a python comment\nprint(\"Hello world\") # This is another comment") #output: print("Hello world")
Python
jtatman_500k
from utils.MyUtils import edge_and_cut import pandas as pd from PIL import Image import numpy as np import csv import os import tqdm import matplotlib.pyplot as plt from matplotlib import patches if __name__ == string __main__ begin set TRAIN_DF = string data/test.csv set BASE_PATH = string data/images/ set BBOX_PATH =...
from utils.MyUtils import edge_and_cut import pandas as pd from PIL import Image import numpy as np import csv import os import tqdm import matplotlib.pyplot as plt from matplotlib import patches if __name__ == '__main__': TRAIN_DF = 'data/test.csv' BASE_PATH = 'data/images/' BBOX_PATH = 'data/test_bbox.cs...
Python
zaydzuhri_stack_edu_python
function id_contains self id_contains begin set _id_contains = id_contains end function
def id_contains(self, id_contains): self._id_contains = id_contains
Python
nomic_cornstack_python_v1
from sys import exit , argv from os import listdir from os.path import isfile comment Command table for command_type function set command_tab = dict string push string C_PUSH ; string pop string C_POP ; string label string C_LABEL ; string if-goto string C_IF ; string goto string C_GOTO ; string function string C_FUNCT...
from sys import exit, argv from os import listdir from os.path import isfile # Command table for command_type function command_tab = { 'push' : 'C_PUSH', 'pop' : 'C_POP', 'label' : 'C_LABEL', 'if-goto' : 'C_IF', 'goto' : 'C_GOTO', ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python string This script subscribes to apriltag algorithms /tag_detections topic. This is to be used as the ground truth system for the rl_robotics_framework. It packages that data up for use in the RL algorithm script using a custom message. The original implementation does not do much, just for...
#!/usr/bin/env python ''' This script subscribes to apriltag algorithms /tag_detections topic. This is to be used as the ground truth system for the rl_robotics_framework. It packages that data up for use in the RL algorithm script using a custom message. The original implementation does not do much, just forwards the...
Python
zaydzuhri_stack_edu_python
from flask import Flask , request , render_template , jsonify import numpy as np import pickle set app = call Flask __name__ decorator call route string / comment Form page to submit text function submission_page begin return call render_template string index.html end function decorator call route string /predict metho...
from flask import Flask, request, render_template, jsonify import numpy as np import pickle app = Flask(__name__) # Form page to submit text @app.route('/') def submission_page(): return render_template('index.html') @app.route('/predict', methods=['POST'] ) def predict(): user_data = request.json with...
Python
zaydzuhri_stack_edu_python
function process begin set file = open string words.txt string r set lines = read lines file set g_split = split lines at 0 set h_random = random choice g_split print string welcome to the game, Hangman! print string I am thinking of a word that is length h_random string letters long. print string _ * 9 print string Yo...
def process(): file = open("words.txt", "r") lines = file.readlines() g_split = lines[0].split() h_random = random.choice(g_split) print("welcome to the game, Hangman!") print("I am thinking of a word that is", len(h_random), "letters long.") print("_ " * 9) print("You have 8 g...
Python
nomic_cornstack_python_v1
string Module for rendering routes from flask import request , jsonify from api.controllers.controller import Controller import jwt from functools import wraps class Routes begin string Create a Routes class function __init__ self begin set controller = call Controller end function function fetch_routes self app begin ...
""" Module for rendering routes """ from flask import request, jsonify from api.controllers.controller import Controller import jwt from functools import wraps class Routes: """ Create a Routes class """ def __init__(self): self.controller = Controller() def fetch_routes(self, app): ...
Python
zaydzuhri_stack_edu_python
function punch self begin comment you are not working, futher investagtion needed... if weight < 5 begin return string That tickles. end else if weight < 15 begin return string Hey that hurt! end else begin return string OUCH! end end function
def punch(self): # you are not working, futher investagtion needed... if self.weight < 5: return "That tickles." elif self.weight < 15: return "Hey that hurt!" else: return "OUCH!"
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- from xml.etree import ElementTree class TechCardXml extends object begin function __init__ self xml_path=string begin set documents = list set relations_dump = list set tree = parse ElementTree xml_path set root = get root tree end function function parse_all_tp self begin for tp in find...
# -*- coding: utf-8 -*- from xml.etree import ElementTree class TechCardXml(object): def __init__(self, xml_path=''): self.documents = [] self.relations_dump = [] self.tree = ElementTree.parse(xml_path) self.root = self.tree.getroot() def parse_all_tp(self): for tp in...
Python
zaydzuhri_stack_edu_python
function save self fname begin with open fname string wb as f begin dump self f end end function comment pickle.dump(self, open(fname, 'wb'))
def save(self, fname): with open(fname, "wb") as f: cloudpickle.dump(self, f) # pickle.dump(self, open(fname, 'wb'))
Python
nomic_cornstack_python_v1
function __lt__ self other begin try begin set tuple x0 y0 = centroid set tuple x1 y1 = centroid return tuple - y0 x0 < tuple - y1 x1 end except AttributeError begin return NotImplemented end end function
def __lt__(self, other): try: x0, y0 = self.centroid x1, y1 = other.centroid return (-y0,x0)<(-y1,x1) except AttributeError: return NotImplemented
Python
nomic_cornstack_python_v1
function divide x y begin try begin set result = x / y print result end except ZeroDivisionError begin print string division by zero! end except ValueError begin print string ValueError!!!!!!!!!! end try else begin print string result is result end finally begin print string executing finally clause end end function se...
def divide(x, y): try: result = x / y print(result) except ZeroDivisionError: print("division by zero!") except ValueError: print("ValueError!!!!!!!!!!") else: print("result is", result) finally: print("executing finally clause") x = int(ra...
Python
zaydzuhri_stack_edu_python
for idx in range 5 begin print basic * idx end=string print string # end=string print basic * 4 - idx end
for idx in range(5): print(basic * idx, end='') print('#', end='') print(basic * (4-idx))
Python
zaydzuhri_stack_edu_python
function __CalculateCentroid self contour begin set moments = call moments contour set centroid = tuple - 1 - 1 if moments at string m00 != 0 begin set centroid = tuple integer round moments at string m10 / moments at string m00 integer round moments at string m01 / moments at string m00 end return centroid end functio...
def __CalculateCentroid(self, contour): moments = cv2.moments(contour) centroid = (-1, -1) if moments["m00"] != 0: centroid = (int(round(moments["m10"] / moments["m00"])), int(round(moments["m01"] / moments["m00"]))) return centroid
Python
nomic_cornstack_python_v1
comment Eduardo Moura Cirilo Rocha, mouracirilor@wisc.edu comment February of 2019 comment learning_curve import json import numpy as np import sys import math comment called at end of file function main begin comment Receive arguments using sys ######################################################## set k = integer a...
###################################################################################### # Eduardo Moura Cirilo Rocha, mouracirilor@wisc.edu # February of 2019 # learning_curve ###################################################################################### import json import numpy as np import sys import math ...
Python
zaydzuhri_stack_edu_python
function _load_cube_pkg pkg cube begin string NOTE: all items in fromlist must be strings try begin comment First, assume the cube module is available comment with the name exactly as written set fromlist = map str list cube set mcubes = call __import__ pkg fromlist=fromlist return get attribute mcubes cube end except ...
def _load_cube_pkg(pkg, cube): ''' NOTE: all items in fromlist must be strings ''' try: # First, assume the cube module is available # with the name exactly as written fromlist = map(str, [cube]) mcubes = __import__(pkg, fromlist=fromlist) return getattr(mcubes, c...
Python
jtatman_500k
function test_continue_build begin set tknzr = call WsTknzr is_uncased=true max_vocab=- 1 min_count=0 call build_vocab list string a call build_vocab list string b call build_vocab list string c assert tk2id == dict BOS_TK BOS_TKID ; EOS_TK EOS_TKID ; PAD_TK PAD_TKID ; UNK_TK UNK_TKID ; string a max BOS_TKID EOS_TKID P...
def test_continue_build() -> None: tknzr = WsTknzr(is_uncased=True, max_vocab=-1, min_count=0) tknzr.build_vocab(['a']) tknzr.build_vocab(['b']) tknzr.build_vocab(['c']) assert tknzr.tk2id == { BOS_TK: BOS_TKID, EOS_TK: EOS_TKID, PAD_TK: PAD_TKID, UNK_TK: UNK_TKID, 'a': max(BOS_TKID, EOS_T...
Python
nomic_cornstack_python_v1
import math import unittest from app.components.camera import Camera from app.utils.calculator import Calculator class TestCalculatorAngleAroundPoint extends TestCase begin function test_x_positive_y_positive self begin assert equal call calculate_angle 2 2 0 0 45 assert equal call calculate_angle 4 4 2 2 45 assert equ...
import math import unittest from app.components.camera import Camera from app.utils.calculator import Calculator class TestCalculatorAngleAroundPoint(unittest.TestCase): def test_x_positive_y_positive(self): self.assertEqual(Calculator.calculate_angle(2, 2, 0, 0), 45) self.assertEqual(Calculator....
Python
zaydzuhri_stack_edu_python
function test_api_score_word self begin with client as client begin set response = get client string /api/new-game set response_json = call get_json set game_id = response_json at string gameId set game = games at game_id set board at 0 = list string A string A string A string A string A set board at 1 = list string D ...
def test_api_score_word(self): with self.client as client: response = client.get('/api/new-game') response_json = response.get_json() game_id = response_json["gameId"] game = games[game_id] game.board[0] = ["A", "A","A","A","A"] game.board...
Python
nomic_cornstack_python_v1
function underlying_price self begin try begin set underlying_price = _underlying_price end except AttributeError begin set data = call get_options_data set underlying_price = Underlying_Price at 0 end return underlying_price end function
def underlying_price(self): try: underlying_price = self._underlying_price except AttributeError: data = self.get_options_data() underlying_price = data.Underlying_Price[0] return underlying_price
Python
nomic_cornstack_python_v1
function action self calculation_name=none begin call status string parsing specs file tag=string status comment ---load the yaml specifications file set specs = call load_specs comment status('done loading specs',tag='status') comment ---read simulations from the slices dictionary set sns = keys specs at string slices...
def action(self,calculation_name=None): status('parsing specs file',tag='status') #---load the yaml specifications file specs = self.load_specs() #### status('done loading specs',tag='status') #---read simulations from the slices dictionary sns = specs['slices'].keys() #---variables are passed dire...
Python
nomic_cornstack_python_v1
function install_package self module **kwargs begin call message string Installing module from %s %s % tuple module string kwargs set package = call import_module module if get kwargs string package begin pop kwargs string package end set setup_return = setup package self module keyword kwargs set ff_id = get kwargs st...
def install_package(self, module: str, **kwargs): logging.message('Installing module from %s %s' % (module, str(kwargs))) package = importlib.import_module(module) if kwargs.get('package'): kwargs.pop('package') setup_return = package.Setup(self, module, **kwargs) ff_id = kwargs.get('ff_id') ...
Python
nomic_cornstack_python_v1
import matplotlib.pyplot as plt import numpy as np from src import parameters as params import pandas as pd from factor_analyzer import FactorAnalyzer from factor_analyzer.factor_analyzer import calculate_bartlett_sphericity from factor_analyzer.factor_analyzer import calculate_kmo class Test begin function __init__ se...
import matplotlib.pyplot as plt import numpy as np from src import parameters as params import pandas as pd from factor_analyzer import FactorAnalyzer from factor_analyzer.factor_analyzer import calculate_bartlett_sphericity from factor_analyzer.factor_analyzer import calculate_kmo class Test: def __init__(self, s...
Python
zaydzuhri_stack_edu_python
string Find out the max length of context and question, so that we know what is the max length to pad the sentence from __future__ import print_function import matplotlib.pyplot as plt set context_max_len = 0 set context_len = list with open string data/squad/train.ids.context string r as file begin for line in file b...
''' Find out the max length of context and question, so that we know what is the max length to pad the sentence ''' from __future__ import print_function import matplotlib.pyplot as plt context_max_len = 0 context_len = [] with open('data/squad/train.ids.context', 'r') as file: for line in file: context_ma...
Python
zaydzuhri_stack_edu_python
function pmat matrix begin set size = length matrix at 0 comment print(size) print for a in matrix begin for i in range size begin comment print("%+d"%round(a[i],2),end="") set number = round a at i 2 print format string {0: .2f} number if expression number then string - else string string end=string if i < size - 1 b...
def pmat(matrix): size = len(matrix[0]) #print(size) print() for a in matrix: for i in range(size): #print("%+d"%round(a[i],2),end="") number = round(a[i],2) print('{0: .2f}'.format(number, '-' if number else ' '),' ',end='') if i < size-1 : ...
Python
zaydzuhri_stack_edu_python
import pandas as pd import statistics as st import plotly_express as pe import plotly.figure_factory as pf import random as rand import plotly.graph_objects as pg set data1 = read csv string original.csv set read = call tolist set graph = call create_distplot list read list string Math Scores Month 1 show_hist=false sh...
import pandas as pd import statistics as st import plotly_express as pe import plotly.figure_factory as pf import random as rand import plotly.graph_objects as pg data1= pd.read_csv("original.csv") read= data1["Math_score"].tolist() graph= pf.create_distplot([read],["Math Scores Month 1"], show_hist=False) gra...
Python
zaydzuhri_stack_edu_python
function post self begin set data = json call create_testing_scenario data return tuple none 201 end function
def post(self): data = request.json create_testing_scenario(data) return None, 201
Python
nomic_cornstack_python_v1
from typing import List from data_handling.CsvProvider import CsvProvider import pandas as pd class LocalFileCsvProvider extends CsvProvider begin function read_csv self path delimiter column_names begin return read csv path delimiter=delimiter names=column_names end function end class
from typing import List from data_handling.CsvProvider import CsvProvider import pandas as pd class LocalFileCsvProvider(CsvProvider): def read_csv(self, path: str, delimiter: str, column_names: List[str]) -> pd.DataFrame: return pd.read_csv(path, delimiter=delimiter, names=column_names)
Python
zaydzuhri_stack_edu_python
function __new__ mcs name bases attrs begin set wrap = lambda f -> if expression f then call infer_composite_step f else f for attr in attrs begin if attr in WHITELIST begin continue end set val = attrs at attr if is instance val FunctionType begin set attrs at attr = call wrap val end else if is instance val property ...
def __new__(mcs, name, bases, attrs): wrap = lambda f: infer_composite_step(f) if f else f for attr in attrs: if attr in RecipeApiMeta.WHITELIST: continue val = attrs[attr] if isinstance(val, types.FunctionType): attrs[attr] = wrap(val) elif isinstance(val, property): ...
Python
nomic_cornstack_python_v1
set list = list 1 2 3 4 set var1 = pop list 0 set var2 = pop list 2 insert list 0 var2 insert list 3 var1 print list
list = [1, 2, 3, 4] var1 = list.pop(0) var2 = list.pop(2) list.insert(0, var2) list.insert(3, var1) print(list)
Python
zaydzuhri_stack_edu_python
string Abstract class for a cluster solution. @author Aaron Zampaglione <azampagl@my.fit.edu> @course CSE 5800 Advanced Topics in CS: Learning/Mining and the Internet, Fall 2011 @project Proj 03, CLUSTERING @copyright Copyright (c) 2011 Aaron Zampaglione @license MIT from doc import Doc from lib.dotdict import dotdict ...
""" Abstract class for a cluster solution. @author Aaron Zampaglione <azampagl@my.fit.edu> @course CSE 5800 Advanced Topics in CS: Learning/Mining and the Internet, Fall 2011 @project Proj 03, CLUSTERING @copyright Copyright (c) 2011 Aaron Zampaglione @license MIT """ from doc import Doc from lib.dotdict import dotdic...
Python
zaydzuhri_stack_edu_python
comment 健康食谱输出。列出 5 种不同的食材,请输出它们可能组成的所 有菜式名称。 set dite = list string 西红柿 string 花椰菜 string 黄瓜 string 牛排 string 虾仁 set icount = 0 for x in range 0 5 begin for y in range 0 5 begin if not x == y begin set icount = icount + 1 print format string {}{} dite at x dite at y end=string end end end print format string 类别:{} ico...
#健康食谱输出。列出 5 种不同的食材,请输出它们可能组成的所 有菜式名称。 dite = ['西红柿', '花椰菜', '黄瓜', '牛排', '虾仁'] icount = 0; for x in range (0,5): for y in range (0,5): if not (x==y): icount+=1; print("{}{}".format(dite[x],dite[y]),end=" ") print("类别:{}".format(icount))
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python comment coding: utf-8 comment In[2]: comment string functions-Built in functions comment upper()-returns strings which all the characters in upper case set str = string lakalaka print upper str print lower str comment In[5]: comment whether the given character is upper or not comment if it ...
#!/usr/bin/env python # coding: utf-8 # In[2]: ##string functions-Built in functions ##upper()-returns strings which all the characters in upper case str="lakalaka" print(str.upper()) print(str.lower()) # In[5]: ##whether the given character is upper or not ##if it is upper it returns true otherwise it returns f...
Python
zaydzuhri_stack_edu_python
comment defaultdict Counter deque appendleft from collections import * import sys set input = readline import time set t = time function main begin set n = integer input set d = list list + list comprehension deque map int split input for i in n * list 0 set c = 0 while any d begin set c = c + 1 set f = 0 set skip = s...
from collections import* #defaultdict Counter deque appendleft import sys input=sys.stdin.readline import time t=time.time() def main(): n=int(input()) d=[[]]+[deque(map(int,input().split()))for i in n*[0]] c=0 while any(d): c+=1 f=0 skip=set() for i in range(1,n+1): ...
Python
zaydzuhri_stack_edu_python
comment coding = utf-8 set Authorinfo = string ------------------Name: Yuan-Chao Hu-------------- --------------Email: ychu0213@gmail.com----------- ----------Web: https://yuanchaohu.github.io/------ comment Prepare the header part of different file types import numpy as np function lammps step atomnum boxbounds addson...
#coding = utf-8 Authorinfo = """ ------------------Name: Yuan-Chao Hu-------------- --------------Email: ychu0213@gmail.com----------- ----------Web: https://yuanchaohu.github.io/------ """ #Prepare the header part of different file types import numpy as ...
Python
zaydzuhri_stack_edu_python
function putBack self w begin comment print ( 'put back token=' , w ) set wr = get root w if length wr == 0 begin return end else if wr at - 1 in Opn begin call prepend wr return end else if call atToken begin call prepend SPC end set ss = call getSuffixes if length ss > 0 begin call prepend string - + join string - ss...
def putBack ( self , w ): # print ( 'put back token=' , w ) wr = w.getRoot() if len(wr) == 0: return elif wr[-1] in ellyChar.Opn: self.prepend(wr) return elif self.atToken(): self.prepend(ellyChar.SPC) ss = w.getSuffixes() ...
Python
nomic_cornstack_python_v1
comment For Loop, Learn Python - Full Course for Beginners [Tutorial] comment for letter in "Giraffe Academy": # Print all letter, 1 by 1 comment print(letter) comment for index in range(10): # Print all index, from 1 to 9 comment print(index) comment for index in range(3, 10): # Print all index, from 3 to 9 comment pr...
# For Loop, Learn Python - Full Course for Beginners [Tutorial] # for letter in "Giraffe Academy": # Print all letter, 1 by 1 # print(letter) # for index in range(10): # Print all index, from 1 to 9 # print(index) # for index in range(3, 10): # Print all index, from 3 to 9 # print(index) # friends = ["J...
Python
zaydzuhri_stack_edu_python
function sigmoid x begin return 1 / 1 + exp - x end function function sigmoid_der x begin return sigmoid x * 1 - sigmoid x end function
def sigmoid(x): return 1/(1+np.exp(-x)) def sigmoid_der(x): return sigmoid(x)*(1-sigmoid(x))
Python
zaydzuhri_stack_edu_python
import math import time set start_time = time set f = open string input string r set contents = read f function countOrbit planet orbits begin set count = 0 for tuple index orbit in enumerate orbits begin if orbit at 1 == planet begin set count = count + 1 set count = count + call countOrbit orbit at 0 orbits end end r...
import math import time start_time = time.time() f = open("input", "r") contents = f.read() def countOrbit(planet, orbits): count = 0 for index, orbit in enumerate(orbits): if orbit[1] == planet: count += 1 count += countOrbit(orbit[0], orbits) return count array = conte...
Python
zaydzuhri_stack_edu_python
function find_maximum_sum arr begin if length arr == 0 begin return 0 end set maxEndingHere = arr at 0 set maxSoFar = arr at 0 set start = 0 set end = 0 for i in range 1 length arr begin if arr at i > maxEndingHere + arr at i begin set start = i set maxEndingHere = arr at i end else begin set maxEndingHere = maxEndingH...
def find_maximum_sum(arr): if len(arr) == 0: return 0 maxEndingHere = arr[0] maxSoFar = arr[0] start = 0 end = 0 for i in range(1, len(arr)): if arr[i] > maxEndingHere + arr[i]: start = i maxEndingHere = arr[i] else: maxEndingHere = m...
Python
greatdarklord_python_dataset
function gen_id self begin return call Tools_gen_id self end function
def gen_id(self): return _fitz.Tools_gen_id(self)
Python
nomic_cornstack_python_v1
import urllib import urllib2 function twitter_search query limit=10 begin import simplejson as json string returns a list of results based on a query using the public twitter api - no rate limits and no api keys needed set query = quote query set req = string http://search.twitter.com/search.json?q=%s % query set data ...
import urllib import urllib2 def twitter_search(query, limit=10): import simplejson as json """ returns a list of results based on a query using the public twitter api - no rate limits and no api keys needed """ query = urllib.quote(query) req = ("http://search.twitter.com/s...
Python
zaydzuhri_stack_edu_python
from puzzle1 import read_data function password_validity policy_range policy_char password begin set policy_range_list = split policy_range string - set first_index = integer policy_range_list at 0 - 1 set second_index = integer policy_range_list at 1 - 1 if policy_char == password at first_index and policy_char != pas...
from puzzle1 import read_data def password_validity(policy_range, policy_char, password): policy_range_list = policy_range.split('-') first_index = int(policy_range_list[0]) - 1 second_index = int(policy_range_list[1]) - 1 if policy_char == password[first_index] and policy_char != password[second_inde...
Python
zaydzuhri_stack_edu_python
function queue self begin call _append_op self comment so pre-constructed Observable instances can be queued and returned in a single statement return self end function
def queue(self): qml._current_context._append_op(self) return self # so pre-constructed Observable instances can be queued and returned in a single statement
Python
nomic_cornstack_python_v1
import requests from bs4 import BeautifulSoup as BS set url = string https://www.lpga.or.jp/members/info/1000932 comment html = urllib.request.urlopen(url) set html = text set soup = call BS html string html.parser find all text=true recursive=false set placeholders = find soup string table dict string class string tou...
import requests from bs4 import BeautifulSoup as BS url = 'https://www.lpga.or.jp/members/info/1000932' #html = urllib.request.urlopen(url) html = requests.get(url).text soup = BS(html, 'html.parser') soup.html.findAll(text=True, recursive=False) placeholders = soup.find('table', {'class': 'tournamentRecordTable p...
Python
zaydzuhri_stack_edu_python
function cmd ctx url key secret input_file abort overwrite export_format **kwargs begin set content = call read_stream stream=input_file set client = call start_client url=url key=key secret=secret set p_grp = name set apiobj = get attribute client p_grp with call exc_wrap wraperror=wraperror abort=abort begin set sqs ...
def cmd(ctx, url, key, secret, input_file, abort, overwrite, export_format, **kwargs): content = ctx.obj.read_stream(stream=input_file) client = ctx.obj.start_client(url=url, key=key, secret=secret) p_grp = ctx.parent.parent.command.name apiobj = getattr(client, p_grp) with ctx.obj.exc_wrap(wraperr...
Python
nomic_cornstack_python_v1
function is_admissible graph goalNode begin set nodes = nodes set paths = list for n in nodes begin set paths = call call generic_search *generic_branch_and_bound_with_extended_set graph n goalNode if call path_length graph paths < call get_heuristic_value n goalNode begin return false end end return true end function
def is_admissible(graph, goalNode): nodes = graph.nodes paths = [] for n in nodes: paths = generic_search(*generic_branch_and_bound_with_extended_set)(graph, n, goalNode) if path_length(graph, paths) < graph.get_heuristic_value(n,goalNode): return False return True
Python
nomic_cornstack_python_v1
function create_lifetime_chart self classname filename=string begin string Create chart that depicts the lifetime of the instance registered with `classname`. The output is written to `filename`. try begin from pylab import figure , title , xlabel , ylabel , plot , savefig end except ImportError begin return nopylab_ms...
def create_lifetime_chart(self, classname, filename=''): """ Create chart that depicts the lifetime of the instance registered with `classname`. The output is written to `filename`. """ try: from pylab import figure, title, xlabel, ylabel, plot, savefig except...
Python
jtatman_500k
function auth_me self begin return call request string %sauth_me/ % resource_uri at string access_token end function
def auth_me(self): return self.request("%sauth_me/" % self.resource_uri)["access_token"]
Python
nomic_cornstack_python_v1
function plot_img img name=none outlier_fraction=0.005 histo_clims=none begin if name == none begin set name = call splitext img at 0 end set img_arr = call get_img_array img figure tight_layout=true if histo_clims begin comment Convert user supplied limits to a tuple of floats set histo_clims = tuple map float histo_c...
def plot_img(img, name=None, outlier_fraction=0.005, histo_clims=None): if name ==None: name = os.path.splitext(img)[0] img_arr = get_img_array(img) plt.figure(tight_layout=True) if histo_clims: # Convert user supplied limits to a tuple of floats histo_clims = tuple(map(float, h...
Python
nomic_cornstack_python_v1
comment 상수 comment 문자열 거꾸로 비교 set tuple f s = split input print max f at slice : : - 1 s at slice : : - 1 comment 방법 2 set tuple f s = split input set l = list f reverse l print join string l
# 상수 # 문자열 거꾸로 비교 f, s = input().split() print(max(f[::-1],s[::-1])) # 방법 2 f, s = input().split() l = list(f) l.reverse() print(''.join(l))
Python
zaydzuhri_stack_edu_python
function makeSocket self begin set db = call connect_database connect_string comment autocommit call set_isolation_level 0 return db end function
def makeSocket(self): db = skytools.connect_database(self.connect_string) db.set_isolation_level(0) # autocommit return db
Python
nomic_cornstack_python_v1
function _handle_newaxis_ellipses index_tup max_dim begin set non_indexes = tuple none Ellipsis set concrete_indices = sum generator expression idx not in non_indexes for idx in index_tup set index_list = list comment newaxis_at = [] set has_ellipsis = false set int_count = 0 for item in index_tup begin if is instance...
def _handle_newaxis_ellipses(index_tup: tuple, max_dim: int) -> Tuple: non_indexes = (None, Ellipsis) concrete_indices = sum(idx not in non_indexes for idx in index_tup) index_list = [] # newaxis_at = [] has_ellipsis = False int_count = 0 for item in index_tup: if isinstance(item, nu...
Python
nomic_cornstack_python_v1
function _epoch_before_hook self begin set _train_steps_this_epoch = 0 end function
def _epoch_before_hook(self): self._train_steps_this_epoch = 0
Python
nomic_cornstack_python_v1
string Leia N, calcule e escreva os N primeiros termos de seqüência (1, 3, 6, 10, 15,...). comment ENTRADA function main begin set n = integer input string Digite um número N: call sequencia n end function comment PROCESSAMENTO function sequencia n begin set v = 2 set s = 1 while v <= n + 1 begin print s end=string set...
'''Leia N, calcule e escreva os N primeiros termos de seqüência (1, 3, 6, 10, 15,...).''' # ENTRADA def main(): n = int(input('Digite um número N: ')) sequencia(n) # PROCESSAMENTO def sequencia(n): v = 2 s = 1 while v <= n + 1: print(s, end=' ') s = s + v v ...
Python
zaydzuhri_stack_edu_python
comment python class Main begin function __init__ self begin call main end function function main self begin print string Hello World ! end function end class comment end defs comment end class
#python class Main: def __init__(self): self.main(); def main(self): print("Hello World !"); #end defs #end class
Python
zaydzuhri_stack_edu_python
import torch import torchvision import torch.nn as nn from model import DeepSleepNet set EPOCHS = 100 set LR = 0.01 set model = call DeepSleepNet training=true comment set optimizer set optimizer = adam parameters model lr=LR weight_decay=0.001 set criterion = cross entropy loss for epoch in range EPOCHS begin zero gra...
import torch import torchvision import torch.nn as nn from model import DeepSleepNet EPOCHS = 100 LR = 0.01 model = DeepSleepNet(training=True) optimizer = torch.optim.Adam(model.parameters(),lr=LR,weight_decay=1e-3) # set optimizer criterion = nn.CrossEntropyLoss() for epoch in range(EPOCHS): opti...
Python
zaydzuhri_stack_edu_python
import cv2 set c = lower string input string You want Image to be Canny :- set path = string Ai_Practical\images\lambo.jpg if c == string y begin set Image = call imread path set Image_C = call Canny Image 10 10 image show string 2nd Image_C call waitKey 0 end else begin set g = lower string input string You Want Image...
import cv2 c = (str(input("You want Image to be Canny :- ")).lower()) path = "Ai_Practical\images\lambo.jpg" if c == "y": Image = cv2.imread(path) Image_C = cv2.Canny(Image,10,10) cv2.imshow("2nd",Image_C) cv2.waitKey(0) else : g = (str(input("You Want Image to be Grayscale :...
Python
zaydzuhri_stack_edu_python
from Game.Card.number_card import NumberCard from Game.Card.wild_card import WildCard class Run begin string Represents a run match function __init__ self count begin string Initialize the Number Set set count = count end function function matched self cards store=false begin string Returns if the set of cards matches ...
from Game.Card.number_card import NumberCard from Game.Card.wild_card import WildCard class Run: """ Represents a run match """ def __init__(self, count): """ Initialize the Number Set """ self.count = count def matched(self, cards, store=False): """ Returns...
Python
zaydzuhri_stack_edu_python
function required_finding_label_keys self begin return get pulumi self string required_finding_label_keys end function
def required_finding_label_keys(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: return pulumi.get(self, "required_finding_label_keys")
Python
nomic_cornstack_python_v1
import random set playerStats = list 65 10 1 2 5 6 function rollPlayerStats begin global playerStats print string attributes: health, accuracy, wounds, movement, technology and experience print playerStats set stat = input string Type the name of the stat you would like to increase: if playerStats at 5 <= 0 begin print...
import random playerStats = [65, 10, 1, 2, 5, 6] def rollPlayerStats(): global playerStats print('''attributes: health, accuracy, wounds, movement, technology and experience''') print(playerStats) stat = input('''Type the name of the stat you would like to increase: ''') if playerStats[5] <= 0: ...
Python
zaydzuhri_stack_edu_python
for x in range 0 n - 2 begin for y in range x + 1 n - 1 begin for z in range y + 1 n begin if m at x < m at y < m at z begin set c = c + 1 end end end end print c
for x in range(0,n-2): for y in range(x+1,n-1): for z in range(y+1,n): if(m[x]<m[y]<m[z]): c=c+1 print(c)
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python import sys append path string ./tools/ from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import pandas as pd import numpy as np import matplotlib.pyplot as plt from plot_confusion_matrix import plot_confusion_matrix from sklearn.preprocessing impo...
#!/usr/bin/python import sys sys.path.append("./tools/") from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import pandas as pd import numpy as np import matplotlib.pyplot as plt from plot_confusion_matrix import plot_confusion_matrix from sklearn.preprocessing import Impu...
Python
zaydzuhri_stack_edu_python
import math , random comment cumulative density function, returns area/probability up to x function normal_cdf x mean std_dev begin return 1 + call erf x - mean / square root 2 / std_dev / 2 end function set mean = 64.43 set std_dev = 2.99 set prob_between_62_and_66 = call normal_cdf 66.0 mean std_dev - call normal_cdf...
import math, random # cumulative density function, returns area/probability up to x def normal_cdf(x: float, mean: float, std_dev: float) -> float: return (1 + math.erf((x - mean) / math.sqrt(2) / std_dev)) / 2 mean = 64.43 std_dev = 2.99 prob_between_62_and_66 = normal_cdf(66.0, mean, std_dev) - normal_cdf(62...
Python
zaydzuhri_stack_edu_python
from flask import Flask , render_template , request , redirect , url_for import json import urllib.request from urllib.error import HTTPError set app = call Flask __name__ comment api key and search movie url set api_key = string 6478ea326187eb3ae9d55585ee8170ef set search_url = string https://api.themoviedb.org/3/sear...
from flask import Flask, render_template, request, redirect, url_for import json import urllib.request from urllib.error import HTTPError app = Flask(__name__) #api key and search movie url api_key = "6478ea326187eb3ae9d55585ee8170ef" search_url = "https://api.themoviedb.org/3/search/movie?api_key="+api_key+"&query=...
Python
zaydzuhri_stack_edu_python
string Good morning. Here's your coding interview problem for today. This problem was asked by Airbnb. Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. For example, [2, 4, 6, 8] should return 12, since we pick 4 and 8. [5, 1, 1, 5] should ret...
""" Good morning. Here's your coding interview problem for today. This problem was asked by Airbnb. Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. For example, [2, 4, 6, 8] should return 12, since we pick 4 and 8. [5, 1, 1, 5] should ret...
Python
zaydzuhri_stack_edu_python
function __str__ self begin return username + string 's Profile end function
def __str__(self): return self.user.username + "'s Profile"
Python
nomic_cornstack_python_v1
from __future__ import absolute_import from __future__ import print_function from import csstokens as tokens class TokenStackContext extends object begin function __init__ self parser begin set parser = parser set _accept = false end function function __enter__ self begin call token_stack_push return self end function...
from __future__ import absolute_import from __future__ import print_function from .. import csstokens as tokens class TokenStackContext(object): def __init__(self, parser): self.parser = parser self._accept = False def __enter__(self): self.parser.token_stack_push() return...
Python
zaydzuhri_stack_edu_python
comment !/bin/python3 import myboard import numpy as np class Tiktak begin set board = list comment player_labels = ["empty","Black","White"] set empty_stone = list 1 0 0 set black_stone = list 0 1 0 set white_stone = list 0 0 1 comment player_list ={player_labels[0]:empty_stone, player_labels[1]:black_stone, player_l...
#!/bin/python3 import myboard import numpy as np class Tiktak: board = [] # player_labels = ["empty","Black","White"] empty_stone = [1,0,0] black_stone = [0,1,0] white_stone = [0,0,1] # player_list ={player_labels[0]:empty_stone, player_labels[1]:black_stone, player_labels[2]:white_stone} w_...
Python
zaydzuhri_stack_edu_python
function addCallback self callback begin comment specify current main algorithm reference if call getParent is not none begin call setAlgo call getParent end else begin call setAlgo self end comment set as new append _callbacks callback end function
def addCallback(self, callback): # specify current main algorithm reference if self.getParent() is not None: callback.setAlgo(self.getParent()) else: callback.setAlgo(self) # set as new self._callbacks.append(callback)
Python
nomic_cornstack_python_v1
import sys set S = input set length_S = length S set cursor_head = 0 set cursor_tail = - 1 set ret = 0 while length_S + cursor_tail > cursor_head begin if S at cursor_head == S at cursor_tail begin set cursor_head = cursor_head + 1 set cursor_tail = cursor_tail - 1 end else if S at cursor_head == string x begin set cur...
import sys S = input() length_S = len(S) cursor_head = 0 cursor_tail = -1 ret = 0 while length_S + cursor_tail > cursor_head: if S[cursor_head] == S[cursor_tail]: cursor_head += 1 cursor_tail -= 1 else: if S[cursor_head] == 'x': cursor_head += 1 ret += 1 elif S[cursor_tail] == 'x': ...
Python
zaydzuhri_stack_edu_python
comment 회의실 배정 comment https://www.acmicpc.net/problem/1931 import sys set stdin = open string input.txt string r set n = integer input set meet = list for k in range n begin set tuple s e = map int split input append meet tuple s e end sort meet key=lambda x -> tuple x at 1 x at 0 set et = 0 set cnt = 0 for tuple s e...
#회의실 배정 #https://www.acmicpc.net/problem/1931 import sys sys.stdin = open("input.txt","r") n=int(input()) meet=[] for k in range(n): s,e=map(int,input().split()) meet.append((s,e)) meet.sort(key=lambda x: (x[1],x[0])) et=0 cnt=0 for s,e in meet: if et<=s: cnt+=1 et=e #print(s,e,e...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python3 from selenium import webdriver import unittest class NewVisitorTest extends TestCase begin function setUp self begin set browser = call Firefox call implicitly_wait 3 end function function tearDown self begin call quit end function function test_can_start_a_list_and_retrieve_it_later self begi...
#!/usr/bin/python3 from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit() def test_can_start_a_list_and_retrieve_it_later(self): # uzytkownik uruc...
Python
zaydzuhri_stack_edu_python
comment to read a number and print its corresponding day set day = integer input string Enter a number(1-7): if day == 1 begin print string Monday end else if day == 2 begin print string Tuesday end else if day == 3 begin print string Wednesday end else if day == 4 begin print string Thursday end else if day == 5 begin...
#to read a number and print its corresponding day day=int(input("Enter a number(1-7):")) if day==1: print("\n Monday") elif day==2: print("\n Tuesday") elif day==3: print("\n Wednesday") elif day==4: print("\n Thursday") elif day==5: print("\n Friday") elif day==6: print("\n Saturda...
Python
zaydzuhri_stack_edu_python
function _apply_to_values self entity function begin set value = call _retrieve_value entity _default if _repeated begin if value is none begin set value = list call _store_value entity value end else begin comment NOTE: This assumes, but does not check, that ``value`` is comment iterable. This relies on ``_set_value`...
def _apply_to_values(self, entity, function): value = self._retrieve_value(entity, self._default) if self._repeated: if value is None: value = [] self._store_value(entity, value) else: # NOTE: This assumes, but does not check, that ...
Python
nomic_cornstack_python_v1
function configProject projectName begin if projectName == none begin return end set filename = encode join path projectsfolder call unicode projectName string project.cfg string utf-8 end function
def configProject(projectName): if projectName==None:return filename=os.path.join(projectsfolder,unicode(projectName),u"project.cfg" ).encode("utf-8")
Python
nomic_cornstack_python_v1