blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
2413e32be23f1431fa3bf81f4d16d09f8e4b6c23
Python
furyash/nscLab
/3. ceaserCipher/server-socket.py
UTF-8
686
2.765625
3
[]
no_license
import socket def decode(message): message = list(message) #bytes(message.encode('ascii'))) for i in range(len(message)): message[i] = chr(ord(message[i]) - key) return ''.join(message) key = 3 format = 'utf-8' size = 1024 port = 8585 server = socket.socket() host = socket....
true
a3fadc1d0a796e5cd3eb230a226b29a4b509b48d
Python
shariqx/codefights-python
/MsgfrombinaryCode.py
UTF-8
364
2.875
3
[]
no_license
def messageFromBinaryCode(code): x = 0 out = '' while x +8 <= len(code): y = (x + 8) subst = code[x:y] #print(subst) theInt = int(subst,2) # print(theInt) asci = chr(theInt) out+=asci x = x+8 return out print(messageFromBinaryCode('0100100...
true
d8f0391c1e8d3bfef161d076b1529867332f28d3
Python
mvtmm/spaceInvaders
/Explosion.py
UTF-8
1,263
3.421875
3
[]
no_license
import pygame from Assettype import AssetType from Assetloader import Assetloader class Explosion(pygame.sprite.Sprite): def __init__(self, x, y): pygame.sprite.Sprite.__init__(self) # Bilder die nach einander angezeigt werden um eine Animation zu erzeugen self.images = [] # Alle Bi...
true
c598927e15617378a16d5c76602041660cc0e2d3
Python
anuj0721/jarivs
/jarvis.py
UTF-8
3,230
2.59375
3
[]
no_license
import pyttsx3 import datetime import speech_recognition as sr import wikipedia import webbrowser import os import smtplib from twilio.rest import Client from pytube import YouTube engine = pyttsx3.init('sapi5') voices=engine.getProperty('voices') engine.setProperty('voice',voices [0].id) def speak(audio): engin...
true
857bb4e8b24aec38b15b91aeaf761618061b4747
Python
Tribler/application-tester
/tribler_apptester/utils/asyncio.py
UTF-8
434
2.8125
3
[]
no_license
from asyncio import Future, iscoroutine, sleep def maybe_coroutine(func, *args, **kwargs): value = func(*args, **kwargs) if iscoroutine(value) or isinstance(value, Future): return value async def coro(): return value return coro() async def looping_call(delay, interval, task, *args)...
true
6b810024a7e0c8c95496102a4bcece07e1456530
Python
zszzlmt/leetcode
/solutions/506.py
UTF-8
698
3.25
3
[]
no_license
import copy class Solution(object): def findRelativeRanks(self, nums): """ :type nums: List[int] :rtype: List[str] """ ranks = copy.deepcopy(nums) ranks.sort(reverse=True) res = list() for item in nums: rank = ranks.index(item) + 1 ...
true
22552fb057b2665cb35804e524207a268c879c5d
Python
Wardar-py/Todo_list
/todo_list/models.py
UTF-8
1,011
2.546875
3
[]
no_license
from django.db import models from datetime import timedelta # Create your models here. from django.utils import timezone class Category(models.Model): name = models.CharField(max_length=100, unique=True) class Meta: verbose_name = 'Категория' verbose_name_plural = 'Категории' def __str__(...
true
d823f9006189c9d4cebb96248ab0ea4fd2897dfe
Python
OnurKader/CMP4501
/search/search.py
UTF-8
5,826
3.375
3
[]
no_license
# search.py # --------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # At...
true
9e42139dec5e830b3a4e35e222bee636aa02b03e
Python
jskerjan/programming
/programming.py
UTF-8
781
3.046875
3
[]
no_license
#I plan to get the comments competency checked off on this assignment # A sequence of assignments to generate a random problem : import random a = random.randint(5,9) e = random.randint(1,3) #range is kept between 1 and 3 to ensure b remains a single digit integer c = random.randint(1,3) d = random.randint(5,9) b = c ...
true
a4d8705e9b91a82a4d1a0e032e0ecc3a86246067
Python
Vaild/python-learn
/homework/20200707/59_字符串调整.py
UTF-8
371
3.625
4
[]
no_license
#!/usr/bin/python3 # coding = UTF-8 str1 = 'Hello, 我是David' str2 = 'OK, 好' str3 = '很高兴认识你' n = max(len(str1), len(str2),len(str3)) print(str1.ljust(n)) print(str2.ljust(n)) print(str3.ljust(n)) print('*'*50) print(str1.rjust(n)) print(str2.rjust(n)) print(str3.rjust(n)) print('*'*50) print(str1.center(n)) print(str2...
true
3ed772d863e1eecbc8578ef3d9be42134e5cab0c
Python
gmg2719/Geometry
/猜数字/匈牙利算法.py
UTF-8
355
2.90625
3
[]
no_license
from scipy.optimize import linear_sum_assignment import numpy as np from scipy.sparse import csr a = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 9]]) x, y = linear_sum_assignment(a, maximize=True) print(x, y) print(a) print(a[x, y]) a = csr.csr_matrix(([1, 2, 3], (0, 1, 2), (0, 1, 2))) print(a) x, y = linear_sum_assignmen...
true
6c8a1087221ed1fd3128eb20c5f8d24ce1c5091c
Python
khushaliverma27/Multi-modal-MER
/Feature Extraction and Data Analysis/lyric_features.py
UTF-8
8,794
2.765625
3
[]
no_license
#!/usr/bin/env python # lyric_features.py [DIRECTORY_NAME] prints an ACE XML 1.1 feature # value file to standard output with the features corresponding to the # lyrics in the specified directory import csv import os import os.path import string import subprocess import sys function_words = [["the"], ...
true
4f630b38c60c9197883a419d0b2b31f4653a7130
Python
nicomn97/Lab-Intermedio
/RelacionCM/graf.py
UTF-8
828
2.734375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt plt.figure(figsize=(8,5)) plt.errorbar(1,6.949, yerr=0.046, fmt='o',label="$Relacion B/I\ experimental$") plt.scatter(2,6.926, label="$Relacion B/I\ Teorica$") plt.ylabel("$B/I (T/A\\times 10^{-4})$") plt.xticks([]) plt.title("$B\ vs.\ I$") plt.legend(loc="best") plt...
true
6f75c570b5a9f5e6c5a5ac55cc42bf285481287c
Python
reachtarunhere/python-workout
/ch03-lists-tuples/test_e13_tuple_records.py
UTF-8
413
3.5
4
[]
no_license
from e13_tuple_records import format_sort_records, PEOPLE def test_empty(): assert format_sort_records([]) == [] def test_with_people(): output = format_sort_records(PEOPLE) assert isinstance(output, list) assert all(isinstance(x, str) for x in output) assert output[0][:10].strip() == 'Putin' ...
true
f52ddbe2251c1c850defdc9bdadedb082b5ce82f
Python
Asherkab/benderopt
/benderopt/stats/lognormal.py
UTF-8
3,715
3.21875
3
[ "MIT" ]
permissive
import numpy as np from scipy import stats def generate_samples_lognormal(mu_log, sigma_log, low_log, low, high_log, step, base, ...
true
34a99ed58ea13b6c899a22ad2aa833111fa7864e
Python
iccowan/CSC_117
/HW_2_20/p163_12.py
UTF-8
795
4.1875
4
[]
no_license
# Ian Cowan # Feb 20 2019 # Problem 12 on page 163 # Population # Prompts the user to input the appropiate fields start = int(input('Starting number of organisms: ')) daily_inc = float(input('Daily increase (percentage): ')) num_days = int(input('Number of days to multiply: ')) # Adds the headers to the table print('...
true
8bf2afd4d6a4770e89c1be94838115f1d4b54fc0
Python
152334H/aoc_2020
/2020/12/solve.py
UTF-8
746
2.640625
3
[]
no_license
from aoc import * def parse(l): return (l[0], int(l[1:])) def rotate(x,y): return (y,-x) s = sreadlines('input', parse) MOV, MOVDIR = [(1,0), (0,-1), (-1,0), (0,1)], 'ESWN' direct, loc = 0, (0,0) for act,v in s: if act in 'LR': direct = (direct+(v//90)*[-1,1][act == 'R']) % 4 elif act == 'F': loc = padd(loc, pm...
true
78400e4e8b49e708f343c1f7d78a84602d8e5b18
Python
calvinfroedge/erpnext
/erpnext/patches/before_jan_2012/remove_duplicate_table_mapper_detail.py
UTF-8
581
2.546875
3
[]
no_license
""" Removes duplicate entries created in """ import webnotes def execute(): res = webnotes.conn.sql("""\ SELECT a.name FROM `tabTable Mapper Detail` a, `tabTable Mapper Detail` b WHERE a.parent = b.parent AND a.from_table = b.from_table AND a.to_table = b.to_table AND a.from_field = b.from_fi...
true
36e0b4075fec730cfd383e64589cc933fb26316a
Python
damiendevienne/hgt-ghosts
/Prediction_ale.py
UTF-8
4,904
2.5625
3
[]
no_license
#!/usr/bin/python3 ########## ########### Utilisation ############ Python3 prediction_ale.py [uts complet] [arbre complet] [arbre prune] [numero de gene] ############# ############## ############################################################################### Importation #############################################...
true
cc0f9995f6fb0ae6658c011b87283fdeee64964b
Python
futotta-risu/JABA
/JABA/service/scraper/spam/filtering.py
UTF-8
1,508
2.765625
3
[ "Apache-2.0" ]
permissive
from math import ceil from sklearn.cluster import DBSCAN from scipy.spatial.distance import pdist, squareform import numpy as np from .metrics import jacard def filter_duplicated(data): ''' Filters the duplicated elements from the data. Parameters: data (list) List of strings. ...
true
f7709b841d2cf7a9c54c7a2015580ad9e47d93a0
Python
gaoliming123/learn
/seq2seq/models/linear.py
UTF-8
1,154
3.09375
3
[]
no_license
import torch.nn as nn class Linear(nn.Module): """ This context vector, generated by the encoder, will be used as the initial hidden state of the decoder. In case that their dimension is not matched, a linear layer should be used to transformed the context vector to a suitable input (shape-wise) for th...
true
b9a0808db0a8cf23d77601c9f212f2ce4dc2fd99
Python
tnzw/tnzw.github.io
/py3/def/posixpath2.py
UTF-8
14,296
2.65625
3
[]
no_license
# posixpath2.py Version 1.1.1 # Copyright (c) 2023 <tnzw@github.triton.ovh> # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as publishe...
true
85e4157b15c92eb318d6eed6c6763fd9384379de
Python
Sinan-96/BoligPrisTracker
/database/dataBaseFunctions.py
UTF-8
1,496
3
3
[]
no_license
import sqlite3 from datetime import datetime """ Functions that sends a variety of queries to the database. These queries are adding, altering and removing data from the different tables of the database. """ #Conn is the database def addBolig(pris:int,by:int,bydel:int,gate:int,conn): query = "INSERT INTO Bolig ...
true
1f8e3fce61404645c5f0554cda86dc6ad843ea0d
Python
teotiwg/studyPython
/200/pt3/084.py
UTF-8
195
3.15625
3
[]
no_license
txt1 = 'A' txt2 = 'Hi' txt3 = 'Warcraft Three' txt4 = '3PO' ret1 = txt1.isalpha() ret2 = txt2.isalpha() ret3 = txt3.isalpha() ret4 = txt4.isalpha() print(ret1) print(ret2) print(ret3) print(ret4)
true
11db749c6ace2fb754d543560c0035cf05cfb4f8
Python
seadsystem/Backend
/Analysis and Classification/Analysis/Code/Vince's_Code/Analysis/Testing Data/vince_Analysis.py
UTF-8
9,242
2.765625
3
[ "MIT" ]
permissive
## # Analysis.py # # Author: Vincent Steffens, vsteffen@ucsc.edu # Date: 16 November 2014 # # Produces a mean power spectrum of raw SEAD plug current # data, normalized by total current. # Outputs to spectrum in a numpy array to stdout or a text # file, each array element on a line. ## #For numerical analysis ...
true
1d364a408f91bac7b5fa6ba7287503445d0aa1b5
Python
geosaleh/Sorting_Algorithms
/sort_barchart.py
UTF-8
4,351
3.515625
4
[]
no_license
# Collection of sorting functions # # follow us on twitter @PY4ALL # import numpy as np import matplotlib.pyplot as plt import random plt.ion() x = np.arange(1, 20) fig, ax = plt.subplots(2, 2, dpi=120) plt.show() my_list = np.arange(1, 20) random.shuffle(my_list) bubble_rects = ax[0][0].bar(x, my_list, align='cent...
true
cafc150115a8a61f275bd8d764bdc9ff4e1d63a3
Python
ISmilingFace/weather
/wetapp/views.py
UTF-8
1,100
2.515625
3
[]
no_license
import json from urllib.request import urlopen import requests from django.shortcuts import render # Create your views here. class GetWeather(object): def __init__(self): self.weather_url = 'http://api.map.baidu.com/telematics/v3/weather?location={}&output=json&ak=TueGDhCvwI6fOrQnLM0qmXxY9N0OkOiQ&callbac...
true
2ccaf5429947bba985ea88a8264979357c1856dc
Python
topdeliremegagroove/Game-of-life-CPES
/Ancienne version/rapide.py
UTF-8
8,105
3.03125
3
[]
no_license
from tkinter import * from functools import partial from time import sleep root = Tk() root.title("Le Jeu de la Vie") # A faire : changer la taille de la grille ; # détecter la taille du fichier lu (ou en faire une par défaut, et dans ce cas, centrer les coordonnées) ; # --> faire avancer...
true
6d2803b80216de7df59c67840cf596ea93be4293
Python
valeriekamen/python
/rotate-image.py
UTF-8
3,322
4.15625
4
[]
no_license
# Rotate a square matrix clockwise one rotation import math def get_new_position(start_i, start_j, lim): # [0,0] -> [0,2] # print(start_j, lim - start_i) return start_j, lim - start_i def rotate_image(input_matrix, number_times=None, start_i=0, start_j=0): print(input_matrix, number_times, start_i, ...
true
1a46ffac355c4058bc6013f5f890188f188c83fc
Python
rickypeng99/codingDocFinder
/scraper_scripts/c_lib.py
UTF-8
1,867
2.875
3
[]
no_license
# coding: utf-8 # In[1]: from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options import re import urllib import pandas as pd options = Options() options.headless = True browser = webdriver.Chrome('./chromedriver',options=options) # In[2]: title = [] d...
true
62239e799006db9c164ea0ff849088958ad6a67e
Python
ztxm/Python_level_1
/lesson6/task4.py
UTF-8
3,149
4.46875
4
[]
no_license
""" 4) Реализуйте базовый класс Car. У данного класса должны быть следующие атрибуты: speed, color, name, is_police (булево). А также методы: go, stop, turn(direction), которые должны сообщать, что машина поехала, остановилась, повернула (куда). Опишите несколько дочерних классов: TownCar, SportCar, WorkCar, PoliceCar....
true
80112411c19ac07dad1cca8e6c543817f1d8ba36
Python
croguerrero/pythonexercises
/bisiesto.py
UTF-8
360
3.765625
4
[]
no_license
## Ano bisiesto year = int(input("Year: ")) if year % 4 == 0: if year % 100: if year % 400: print("This year {} is bisiesto".format(year)) else: print("This year {} is not bisiesto".format(year)) else: print("This year {} is bisiesto".format(year)) else: print("This...
true
e65bd24262ca1466d057bce241d1a2fb609da441
Python
swaroop1995/assignment
/ass2_12.py
UTF-8
330
3.796875
4
[]
no_license
print("1)Monkey A and B are smiling") print("2)Monkey A and B are not smiling") print("3)Monkey A is smiling") print("4)Monkey B is not smiling") option=int(input("select the option:")) if option==1 or option==2: print("we are in trouble") else: if option==3 or option==4: print("we are not in t...
true
adf4029fd1527714922d0171a51ec0f5a87ac762
Python
latufla/EventSystem
/models/forms/form_base.py
UTF-8
189
2.578125
3
[]
no_license
from wtforms import Form class FormBase(Form): def errors_str(self): error = "" for k, v in self.errors.items(): error += v[0] + '\n' return error
true
019406d342621ef9d77a4fd331576b064c8e299f
Python
linn24/mrt_route_suggestion
/mrt_app/initialize_data.py
UTF-8
1,964
2.859375
3
[]
no_license
import sys from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.sql.expression import true from sqlalchemy.sql.sqltypes import Boolean from mrt_app.models import Base, Line, Station, Traffic import pandas as pd from datetime import datetime SQLALCHEMY_DATABASE_URI = 'sqlite:///m...
true
5e84a310a962945b16094b60d409f60e1a2d1d01
Python
dionwang88/lc1
/algo/241_Different_Ways_To_Add_Parentheses/Q241.py
UTF-8
1,067
3.109375
3
[]
no_license
class Solution(object): def __init__(self): self.map = {} def diffWaysToCompute(self, inputs): if not inputs: return [] return self.helper(inputs) def helper(self, inputs): res = [] for i in xrange(len(inputs)): c = inputs[i] if c...
true
238fccf0aadd04f683e603fce07d8b07d133c132
Python
victorxuli/traitement-d-image
/tp4.py
UTF-8
5,497
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 23 14:10:42 2018 @author: victo """ from skimage import util as ut from PIL import Image import numpy as np import scipy.fftpack as sc import scipy as sp import skimage.io as skio from skimage import exposure as ske from skimage import color import matplot...
true
95941824cf8e93a55c61928b29564db7dfc73673
Python
yass0016/beagle-project
/python_client/index.py
UTF-8
579
2.609375
3
[]
no_license
import requests import Adafruit_BBIO.GPIO as GPIO import time import string import random GPIO.setup("P9_15", GPIO.IN) old_switch_state = 0 def id_generator(size=6, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for _ in range(size)) while True: new_switch_state = GPIO.in...
true
25319e241f385d1a7533e56559a17ca55872c633
Python
vivekaxl/CodeLab
/hacker_rank/6.py
UTF-8
1,391
3.40625
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT from __future__ import division class line_segments: def __init__(self, start, end): self. start = start self.end = end self.distance = end - start def __str__(self): return str(self.start) + " " + str(self.e...
true
0929e714f7306dc8dec50e00cbf65a46aae1cc16
Python
HoeYeon/Algorithm
/Python_Algorithm/Baek/1120.py
UTF-8
257
3.140625
3
[]
no_license
a, b = input().split(' ') if len(b) > len(a): a, b = b, a result = 0 for i in range(0,len(a)-len(b)+1): count = 0 for j in range(0, len(b)): if a[i+j] == b[j]: count += 1 result = max(result,count) print(len(b) - result)
true
071bf19b7be7c011c8d938bfeb8b1f3a17188cbf
Python
aleonnet/Vision_Marker_Chaser
/Mechanum Wheel Equations.py
UTF-8
1,132
2.890625
3
[]
no_license
from math import sin, cos, radians ''' VX is the Speed Multiplier for Wheel X Vd is mostly a constant - the max speed you want for this run T0 is Theta Zero the desired direction of travel, hopefully to be variable Vo is an offset to help change direction, I think? 0.7854 is Pi/4 ''' V1 = 0 V2 = 0 V3 = 0 V...
true
6b9a52705db44085a49a72d6ee07a4330723eec3
Python
changhw01/Maneki
/fr/test_ipca.py
UTF-8
11,619
3.28125
3
[]
no_license
import sys import os import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.decomposition import PCA import cv2 import time import pickle class CCIPCA(BaseEstimator, TransformerMixin): """Candid covariance-free incremental principal component analysis (CCIPCA) Linear dimens...
true
d445475903574783ae7dd99fc99e13da4a9c0521
Python
mstepan/algorithms-py
/excel2sql.py
UTF-8
324
3.703125
4
[]
no_license
def create_palindrome(value): for i in range(len(value)-1, 0, -1): if str[i] != str[i+1]: break value def main(): base_str = "test" palindrome = create_palindrome(base_str) print("str: %s, palindrome: %s" % (base_str, palindrome)) if __name__ == "__main__": mai...
true
e13b2e13beacd37dc48e6bc6debdc3cae863e9ad
Python
Sophie1218/IE221_L22_CNCL
/myprogram/option1/point.py
UTF-8
2,740
3.609375
4
[]
no_license
# import libraries from math import sqrt from pygame.draw import circle from pygame.draw import rect from myprogram.interface import BLACK, WHITE, COLORS, LIGHT_COLORS class Point: """ A class to represent a two-dimensional data point. ... Attributes ---------- x : float ...
true
bcfe054c1cbab0fa7b8609386c9e1d6ca2d8f00f
Python
KKainz/Uebungen
/UE1/3 - spaziergang.py
UTF-8
573
3.765625
4
[]
no_license
def wieweitSpazieren(gewicht: float, letzesMal: float, vertraegtsich: bool) -> float: if gewicht < 5: if not vertraegtsich: return "2 km" else: return "4 km" elif gewicht > 15 or letzesMal > 24: while vertraegtsich: return "8 km" else: r...
true
7983877722212be109f685c7cd6b8c38b84ec162
Python
bryantChhun/CardiacUltrasoundSegmentation
/imagePreprocess.py
UTF-8
1,101
2.671875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on 05 February, 2018 @ 11:16 PM @author: Bryant Chhun email: bchhun@gmail.com Project: BayLabs License: """ import glob import src.preprocess.mask_preprocess as mp import os def imagePreprocess(): ''' method to generate images, binary-interpolated-...
true
2ef0741d6ad84dda93349f1cc6f6e7c0b490acc6
Python
bmuftic1/ImageProcessing
/Extracting signatures/Boss/boss.py
UTF-8
2,754
3.078125
3
[]
no_license
#Student: Belma Muftic #Student number: D17127216 #Assignment number: 1.1 #Assignment objective: Find and crop the signature #importing needed packages import numpy as np import cv2 from matplotlib import pyplot as plt from matplotlib import image as image import easygui #opening the wanted image f = easygui.fil...
true
15455ebec4bd530467f70ba90e9ff84fa5f5d11c
Python
xioashitou/algorithm013
/Week_03/50.pow-x-n.py
UTF-8
1,311
3.546875
4
[]
no_license
# # @lc app=leetcode.cn id=50 lang=python3 # # [50] Pow(x, n) # # https://leetcode-cn.com/problems/powx-n/description/ # # algorithms # Medium (36.29%) # Likes: 466 # Dislikes: 0 # Total Accepted: 116.2K # Total Submissions: 319.9K # Testcase Example: '2.00000\n10' # # 实现 pow(x, n) ,即计算 x 的 n 次幂函数。 # # 示例 1: # #...
true
c03cfa1fdc134be5dcc832e78b8d8a011712b754
Python
hhy5277/LeetCode-9
/008_字符串转换整数/Solution.py
UTF-8
964
3.078125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/24 20:54 # @Author : zenRRan # @Version : python3.7 # @File : Solution.py # @Software: PyCharm class Solution: def myAtoi(self, str: str) -> int: s = str.strip() syb = 1 ptr = 0 res = 0 if len(s) == 0: ...
true
39c24221bdc9cce4195fbf6782e4265f5d038b98
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_8/33.py
UTF-8
1,916
3.046875
3
[]
no_license
#!/usr/bin/env python #-*- encoding: utf-8 -*- # # FILE.py # DESC # # Copyright (c) 2008 Pierre "delroth" Bourdon <root@delroth.is-a-geek.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, e...
true
0a03ea23892dca6618f540e1b8d5eb58a8c37bb5
Python
joysjohney/Luminar_Python
/PythonPrograms/collections/dictionary/emp.py
UTF-8
427
3.03125
3
[]
no_license
employee={ "eid":1002, "ename":"person", "desig":"tester", "salary":15000 } #print employee name print(employee["ename"]) #check for company is there print("company" in employee) #add new record comapany name Luminar employee["cname"]="Luminar" #update employee salary = current salary + 5000 emp...
true
8e25c1b7887435715c2fd9633442400fc77b78f7
Python
JamesWo/Algorithms
/topcoder/division2-2/PiecewiseLinearFunctionDiv2.l2.SRM586.py
UTF-8
3,265
3.8125
4
[]
no_license
""" # [PiecewiseLinearFunctionDiv2](http://community.topcoder.com/tc?module=ProblemDetail&rd=15698&pm=12698) *Single Round Match 586 Round 1 - Division II, Level Two* ## Statement F is a function that is defined on all real numbers from the closed interval [1,N]. You are given a int[] *Y* with N elements. For each i (...
true
3d54e2f77a0ff57a7ddd5661a50ddcef81b0b357
Python
AAO2014/promprog15_1
/lesson4/classwork_3.py
UTF-8
2,320
3.46875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function # для совместимости с python 2.x.x # Дата некоторого дня определяется тремя натуральными числами y (год), m (месяц) и d (день). # По заданным d, m и y определите дату предыдщуего дня. # # Заданный год может быть високосным. Год счита...
true
25d3e6a41dd86a216cf489e141c89b6d86b6a65d
Python
qmnguyenw/python_py4e
/geeksforgeeks/python/basic/18_9.py
UTF-8
2,872
4.28125
4
[]
no_license
Binary Search (bisect) in Python Binary Search is a technique used to search element in a sorted list. In this article, we will looking at library functions to do Binary Search. **Finding first occurrence of an element.** > bisect.bisect_left(a, x, lo=0, hi=len(a)) : Returns leftmost insertion point > o...
true
cab4316f300282c8c115f9361023210158c7ff9a
Python
thekrisharmon/Open-Street-Map-SQL-Project
/countyAudit.py
UTF-8
1,549
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 12:09:05 2018 My goal for this python file is to size up the counties listed in my data sample. I'm curious how many counties are covered and if any data clean-up is needed at this point. I utilized my code from the StreetNameAudit.py file and modified it to look fo...
true
40b00cba2d98af6009812c653eff3abad8fb682e
Python
srirambandi/AI_TAK
/AI_TAK.py
UTF-8
22,694
3.328125
3
[ "MIT" ]
permissive
# * AI TAK Bot # * Sri Ram Bandi (srirambandi.654@gmail.com) import sys import pdb import time import random from copy import deepcopy from collections import deque from math import exp class Game: class Player: def __init__(self, flats, capstones): self.flats = flats self.capsto...
true
aec8b0e5b7a9dceaead55424e965d40c2cd6d426
Python
hoatd/Ds-Algos-
/GeeksforGeeks/Random-problems/all_character.py
UTF-8
907
3.390625
3
[]
no_license
from collections import defaultdict def solve(s, lst): cnt1 = defaultdict() for i in s: p = ord(i) if i.islower(): p -= 97 else: p -= 65 if p in cnt1: cnt1[p] += 1 else: cnt1[p] = 1 ans = [] for l in lst: ...
true
402ca0908c4a1dfcb56bfc482621957778e92051
Python
lurak/Coursework
/SimpleSite/map_cities.py
UTF-8
315
2.59375
3
[]
no_license
import folium def get_map(place, path): m = folium.Map( location=(place.latitude, place.longitude), zoom_start=12, ) folium.Marker( location=(place.latitude, place.longitude), popup=place.name, icon=folium.Icon(icon='cloud') ).add_to(m) m.save(path)
true
33db14f4d5a9a39301ea0d465a51fc1d13fc6ad4
Python
Rajeshdraksharapu/Leetcode-Prblems
/BackTrackingProblems/islandBackTracking.py
UTF-8
1,208
3.328125
3
[]
no_license
island = [ [0, 1, 0, 0, 0], [0, 1, 0, 1, 1], [1, 1, 1, 0, 1], [0, 1, 0, 0, 0] ] grid = [ ["1","1","0","0","0"], ["1","1","0","0","0"], ["0","0","1","0","0"], ["0","0","0","1","1"] ] count=0 def findingIsland(row,column,island,visited): if row<0 or column<0 or row>len(island)-1 or column...
true
1a85de4bc3847c1550870232e52fcf6b95c79570
Python
SanchRepo/Intro-Python
/Ece 203/BugClass.py
UTF-8
913
4.1875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 25 13:51:09 2017 @author: szh24 """ class Bug: def __init__(self,initialPosition): self.initialPosition = float(initialPosition) self.pot=1 def move(self): self.initialPosition+=self.pot def turn(self): ...
true
0e6cc6d63ea07d43ec77db58b9006332a64ec0ed
Python
brenolemes/exercicios-python
/exercicios/CursoemVídeo/ex085.py
UTF-8
662
4.625
5
[ "MIT" ]
permissive
''' Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em uma lista única que mantenha separados os valores pares e ímpares. No final, mostre os valores pares e ímpares em ordem crescente. ''' num = [[], []] for c in range(1, 8): valor = int(input(f'Digite o {c}º valor: ')) if va...
true
e9e9293fd5506eb789a82f6a6d6dd8c5457ac743
Python
aishwarya202005/Decision-Tree-Classifier
/q-1-2.py
UTF-8
7,704
2.953125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[70]: import pprint import sys import numpy as np import pandas as pd eps = np.finfo(float).eps from numpy import log2 as log # In[71]: a=pd.read_csv('train_data.csv') a.describe() df = pd.DataFrame(a)#,columns=['Work_accident','promotion_last_5years','sales','salary','...
true
9e0df50a0df2a3cf99f86c88e8273d31196c6d69
Python
NuclearPython/OptimizeCassette_PC
/GnoweeNSGAPython3/MultiObjectiveTest.py
UTF-8
1,350
2.625
3
[]
no_license
# Gnowee Modules import Gnowee_multi from ObjectiveFunction_Multi import ObjectiveFunction_multi from Constraints import Constraint from GnoweeHeuristics_multi import GnoweeHeuristics_multi import numpy as np from OptiPlot import plot_vars import matplotlib.pyplot as plt # User Function Module from TestFunct...
true
3f8c14201772e3603d8e0d3c8a72df53eb53b70b
Python
lmorinishi/leetcode-practice
/solutions/lc_014_longestCommonPrefix.py
UTF-8
479
2.90625
3
[]
no_license
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if len(strs) == 0 or '' in strs: return '' if len(strs) == 1: return strs[0] result = '' min_len = min(len(k) for k in strs) i = 0 while i < min_len: if len(set(...
true
e5de1f9a9e702c3c3f7bdecfce9586963692f7cf
Python
Ehtycs/scicomp-project
/test_pod.py
UTF-8
4,203
3.234375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 4 20:47:53 2018 @author: marjamaa This is an invented toy example on how this POD works. Circuit has an input current and output voltage, four resistor values out of seven are adjustable. So the system formed from the circuit by nodal analysis...
true
e9a5d8b49025077cebef3d8f276e25869ab9227c
Python
TommyCpp/nx-poprank
/test/GraphTestCase.py
UTF-8
428
2.75
3
[]
no_license
from unittest import TestCase from heterogeneousgraph import HeGraph import networkx as nx class GraphTestCase(TestCase): def _setup(self, sub_graph_count=1, node_per_graph=3, probability_of_edge_creation=0.8): G = HeGraph() for i in range(sub_graph_count): sub_graph = nx.fast_gnp_ran...
true
f23f9fee270af5242b41e81cdef42554c38358a7
Python
skdy33/Video-Copyright-Detector
/Plagierism.py
UTF-8
8,744
2.765625
3
[]
no_license
# Input data의 파일형식에 따라 FPS가 안맞을수도 있다. # 안 맞는 경우 파일형식의(예.avi) Header의 문제인데, 실험 때는 그냥 되는 파일형식으로 convert해서 사용하자. class plagierism: """ 원본 영상을 받는다. input : self = str of the video out = str of the name of the output video, including """ codec = {'mp4':'H264','avi':'XVID'} def WriterC...
true
a1147e0cf00953fb903935bff9fdd58eb8f007f6
Python
mami-project/lurk
/proxySTAR_V3/certbot/venv/lib/python2.7/site-packages/pylint/test/functional/method_hidden.py
UTF-8
323
2.984375
3
[ "Apache-2.0", "MIT" ]
permissive
# pylint: disable=too-few-public-methods,print-statement """check method hidding ancestor attribute """ class Abcd(object): """dummy""" def __init__(self): self.abcd = 1 class Cdef(Abcd): """dummy""" def abcd(self): # [method-hidden] """test """ print(self...
true
5fab108b90adbf2f0c58b579e0826ee23a620390
Python
Mary-Li-shuangyue/wadlab
/tango_with_django_project/populate_rango.py
UTF-8
2,469
3.140625
3
[]
no_license
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tango_with_django_project.settings") import django django.setup() from rango.models import Category, Page def populate(): '''create lists of dictionaries containing the pages we want to add into each category then, create a dicti...
true
3c5dec1420458ba250d287744053707fee27ac20
Python
riki900/mySketches
/examples/coding-creative-examples/examples/cc_07_loops/cc_07_loops.pyde
UTF-8
142
3.140625
3
[]
no_license
size(600, 600) background(50) stroke(200) for i in range(5): line(random(width), random(height), random(width), random(height))
true
e2e9b20224e73478c08b728a0ec826a499cdd863
Python
Yakobo-UG/Python-by-example-challenges
/challenge 17.py
UTF-8
545
4.65625
5
[]
no_license
#Ask the user’s age. If they are 18 or over, display the message “You can vote”, if they are aged 17, display the message “You can learn to drive”, if they are 16, display the message “You can buy a lottery ticket”, if they are under 16, display the message “You can go Trick-or-Treating”. Age = int(input("Enter your a...
true
0be8c103b5bdbac9de542f4415890b105c21dd47
Python
Fleskimiso/MemoryPuzzle
/Puzzle.py
UTF-8
1,589
3.28125
3
[]
no_license
import pygame from Shapes import * class Puzzle: def __init__(self, shape, color, x_pos, y_pos): self.width = 50 self.height = 50 self.shape = shape self.color = color self.x_position = x_pos self.y_position = y_pos self.surface = pygame.Surface((self.width...
true
253fe3c4cebf63d7a8fbc16af75c303db241ca12
Python
g-ampo/Drone_RL
/Source/RL_Agent_old.py
UTF-8
3,804
2.6875
3
[]
no_license
import numpy as np from Source.RF_Env import RFBeamEnv, Generate_BeamDir, Gen_RandomBeams class RL_Agent: def __init__(self, env, alpha, gamma): self.env = env # Environment self.alpha = alpha # learning rate self.gamma = gamma #discount factor self.Q = {} # Q_table def sam...
true
170e211eadbf90e21eb4a08f5524a1e888a89409
Python
anish888/python-project2
/validate_angrams.py
UTF-8
411
4
4
[]
no_license
#function for valaditing angrams def anagram(word1, word2): word1 = word1.lower() word2 = word2.lower() #sorting word1 and word2 #if user word is validate angram it return true otherwise false.. return sorted(word1) == sorted(word2) #taking user input for valadating angrams word1=input("enter word1"...
true
030e589d4b0bbcc12ea5383f6ca624190f0acb35
Python
eric0890/ITC110
/HW3.py
UTF-8
776
4.46875
4
[]
no_license
#pizzaconverter.py #this file converts the price and size of a pizza into cost per square inch #note: I tested using 10" diameter and $8 which equals 78.5 square inches divided by 800 cents = 9.82 (rounded) from math import pi def main(): print("This program computes the cost per square inch of pizza. \n")...
true
c39f73d378d46a8380e2ed3d50650d0475ee20f8
Python
DaniilBelousov/Paintings-dataset
/picToGray.py
UTF-8
270
2.859375
3
[]
no_license
import cv2 as cv import os # Картинка в серый def pictureToGray(root, pics): os.chdir(root) for pic in pics: gray = cv.imread(pic, 0) cv.imwrite(pic, gray) print("Directory: ", root) print("Changed into gray --> Success")
true
9a23192c46335044aac4e89c618543c8a6a5df6c
Python
minhd2/advent-of-code-2020
/day8_handheld_halting/day8.py
UTF-8
828
3.078125
3
[]
no_license
def calculate_acc(filename): acc = 0 game_on = True game_steps = dict() index_set = set() with open(filename, 'r') as file: lines = [line.rstrip() for line in file] #print(lines) index = 0 while game_on: if index in index_set: print(index) game_on = False break elif lines[index][:3]...
true
4153681171496207027aedbfba05416528cc8b9e
Python
sven123/auxiliary
/aux/protocol/transport.py
UTF-8
2,934
2.78125
3
[ "BSD-3-Clause" ]
permissive
from socket import ( socket, AF_INET, SOCK_DGRAM, IPPROTO_TCP, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR) from ssl import wrap_socket, CERT_NONE TCP_DEFAULT_FRAME_SIZE = 1200 class Transport(object): def __init__(self, hostname, port): self.addr = (hostname, port) ...
true
6b9a791d54fee75423af97194a5a9c04ff81b93b
Python
blitzbutter/MyCode
/netCalc.py
UTF-8
1,718
4.03125
4
[]
no_license
### Jacob Bryant ### 12/8/2018 ### Program to calculate the network address # --- Takes a string to ask a user as input --- # def calc_bin(user_in): bin_f = "{0:08d}" # Pads binary numbers with 8 bytes # --- Formats the input IP address and converts it to binary --- # ip_in = input(user_in) ...
true
95d0eb1e30db3e1e72be1ae3562bee3d2b46a801
Python
DrRamm/mediatek-lte-baseband-re
/SoC/common/make_image.py
UTF-8
9,114
2.59375
3
[]
no_license
#!/usr/bin/env python3 '''\ Create "preloader" images suitable for booting on MediaTek platforms. Provide an ARMv7-A/ARMv8-A (AArch32-only) binary as an input, and this tool will convert it into an image that, depending on your selected options, will be able to be booted from either eMMC flash or an SD card. For exa...
true
ce96543e05919addfeca5d7e3cb1288781e7a8c2
Python
kinketu/FEM
/ElasticProblem/ElasticProblem.py
UTF-8
5,866
2.640625
3
[ "MIT" ]
permissive
# This program is to solve Linear elastic problem using FEM solver. # Use Triangular Element. # Asumption plane strain analysis. # Units of pressure to use MPa # Units of force to use MN from numpy import array, zeros, dot from numpy.linalg import solve import matplotlib.pyplot as plt from openacoustics.gmsh ...
true
53fb96c689a745594c62571edfd2104395c7ceb2
Python
Aasthaengg/IBMdataset
/Python_codes/p03439/s110811200.py
UTF-8
1,334
3.03125
3
[]
no_license
import bisect import heapq import sys import queue input = sys.stdin.readline sys.setrecursionlimit(100000) class V: def __init__(self, f): self.f = f self.v = None def __str__(self): return str(self.v) def ud(self, n): if self.v is None: self.v = n ...
true
6c38f1ca9636261cab363979cd5c1ab8c46a4a30
Python
NacerSebtiMS/GAN_MNIST
/dataset.py
UTF-8
3,148
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- import gzip import numpy as np import matplotlib.pyplot as plt import gzip test_image_path = 'data/t10k-images-idx3-ubyte.gz' test_label_path = 'data/t10k-labels-idx1-ubyte.gz' train_image_path = 'data/train-images-idx3-ubyte.gz' train_label_path = 'data/train-labels-idx1-ubyte.gz' #--------...
true
fc4daaa789e3fb4b620a82d5949b53a6979d34c1
Python
liuq4360/recommender_systems_abc
/preprocessing/netflix_prize/transform2triple.py
UTF-8
831
2.90625
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 # 将training_set转换为三元组(userid,videoid,score) import os cwd = os.getcwd() # 获取当前工作目录 f_path = os.path.abspath(os.path.join(cwd, "..")) # 获取上一级目录 all_files = os.listdir(f_path + '/data/mini_training_set') data = f_path + "/output/data.txt" fp = open(data, 'w') # 打开文件,如果文件不存在则创建...
true
5d9dfea2b95dbe3d48e05e6dc93f08237672a948
Python
adrianosferreira/python-algorithms
/study.py
UTF-8
1,217
3.015625
3
[]
no_license
adjacent_list = { 1: [2, 5], 2: [1, 3], 3: [6, 4, 2], 4: [5, 3], 5: [1, 4], 6: [3, 7], 7: [6, 8, 9], 8: [7], 9: [7], } def find_articulation_points(): visited = [False for x in range(len(adjacent_list) + 1)] dt = [0 for x in range(len(adjacent_list) + 1)] low_link = [0 ...
true
75104a69fcd4c02cf00847e242e5573e1f8907d4
Python
shawn-hurley/testproject
/inventory/models.py
UTF-8
1,432
2.75
3
[]
no_license
from django.db import models # Create your models here. class Category(models.Model): """Category for each item.""" name = models.CharField("Category Name", max_length=50) description = models.TextField("Description") def save(self): super(Category, self).save() def get_category(cate): return Category.objec...
true
3a267bb21aa82f8e57e754b4a442afc2e9dc7dd1
Python
ushahamsaraju/sampleproject
/EMS/submodules/add.py
UTF-8
2,045
3.25
3
[]
no_license
import re from randompwd import id_generator,get_emp_details import smtplib class employee(): def add_employee(self): Eid=raw_input("Enter Employee Number:") while True: if Eid in get_emp_details(0): print "NUmber Already exists" print "Enter a number once...
true
2990621417909474964bc9bf6e533fd8ae944164
Python
mhhennig/spikeforest
/spikeforest/forestview/recording_views/currentstateview.py
UTF-8
670
2.734375
3
[ "Apache-2.0" ]
permissive
import vdomr as vd import json class CurrentStateView(vd.Component): def __init__(self, context): vd.Component.__init__(self) self._context = context self._context.onAnyStateChanged(self.refresh) self._size = (100, 100) def tabLabel(self): return 'Current state' d...
true
f310e66f222609ac41b2284ce325a45a984281a5
Python
giuliano-sider/preparing-for-the-quantum-apocalypse
/ntru_implementations/python/ntru_a_new_hope.py
UTF-8
31,640
3.0625
3
[]
no_license
#!/usr/bin/env python3 """ntru: a new hope""" import secrets import hashlib import random import re import math import sys def extended_euclidean_algorithm(a, b): """purely iterative version of the extended euclidean algorithm. compute gcd of integers a and b, as well as integers x and y""" """ such th...
true
ba1af6eab9b9926669b68beacad631a68be6ec16
Python
daviddwlee84/LeetCode
/Contest/LeetCodeWeeklyContest/WeeklyContest334/3/Sorted3.py
UTF-8
581
2.78125
3
[]
no_license
from typing import List class Solution: def maxNumOfMarkedIndices(self, nums: List[int]) -> int: nums.sort() double_nums = [num * 2 for num in nums] left = len(nums) - 1 right = len(nums) - 1 while double_nums[left] > nums[right]: left -= 1 ri...
true
5ea8d6b5ab68f791cb948ebea915f2ec9369ab12
Python
l-henri/gan-movie-maker
/ganMovieMaker.py
UTF-8
2,235
2.546875
3
[]
no_license
import sys sys.path.append('./gantools/gantools') import cli as ganBreederCli import os import shutil import ffmpeg import json movieFrameRate = 5 workdir = "output/01_test_global" outputVideo = "output/test.mp4" if not os.path.exists(workdir): os.makedirs(workdir) ######## # An image is caracterized by a vecto...
true
3642063494aa7e39f65b69007a491d1eff2eb925
Python
roberzguerra/rover
/events/auth.py
UTF-8
446
2.515625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding:utf-8 -*- from django.contrib.auth.decorators import permission_required def events_permission_required(perm, login_url='/admin/login', raise_exception=False): """ Sobrescreve o metodo que exige login para acessar a view Usar com decorator sobre o metodo que desejar o login: @method_decor...
true
e452873f6304a88a7f6c28ac4a5a3deeb6627f51
Python
NoahViste/Chronon
/levels.py
UTF-8
1,813
2.8125
3
[]
no_license
from tiles import Tile from textures import Texture from matrix import Grid from settings import * import os def exporter(grid, name): with open(name, "w+") as file: file.write("{0},{1}\n".format(grid.width, grid.height)) for tile in grid.all(): file.write("|,{0}\n".format(int(tile[2]....
true
0630767b2c23d71a4cd35d7fabf8c860f9c07359
Python
ivanserendipity/SVM-on-iris
/SVM_iris.py
UTF-8
708
2.65625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Oct 12 19:24:50 2017 @author: Serendipity """ import numpy as np import pandas as pd from sklearn import datasets from sklearn.cross_validation import train_test_split from sklearn import svm from sklearn import metrics iris = datasets.load_iris() X ...
true
e36e5841261dd929d9f952f24d97f0fd3b5290b5
Python
DivineJK/Colorful_QM_Program
/Spin_Synthesizer.py
UTF-8
16,743
3.015625
3
[]
no_license
# issquare # bit_digits, issquare def bit_digits(n): tmp = n cnt = 0 while tmp: tmp >>= 1 cnt += 1 return cnt def issquare(n: int): l, r = 0, n + 1 d = (l + r) // 2 cnt = bit_digits(n+1) for _ in range(cnt + 1): if d * d <= n: l = d d = (l ...
true
bfff55e694c7ac494f1b79064bf9a8c8a423769d
Python
deepakdeedar/translator
/Translator/turtle.py
UTF-8
116
2.8125
3
[]
no_license
from turtle import Turtle, Screen timmy = Turtle() timmy.shape("turtle") timmy.color("coral") my_screen = Screen()
true
4e97199dc4908ce6d98a2df7a4a9b3b60ac9b296
Python
Valerii9123/Python111
/Lessons5/random_gen.py
UTF-8
276
3.140625
3
[]
no_license
import random # randrange for _ in range(15): print(random.randrange(1, 10 , 1), end=', ') print() # randint for _ in range(15): print(random.redint(1, 10), end=', ') print() # random for _ in range(15): print(random.random(1, 10), end=', ') print() # uniform
true
eaec74c4849283fe1934825624484630db7a4473
Python
surajshrestha-0/python-Basic-II
/Question3.py
UTF-8
822
4.34375
4
[]
no_license
""" Write code that will print out the anagrams (words that use the same letters) from a paragraph of text. """ from collections import defaultdict def anagramsWord(input_paragraph): words = list(set(input_paragraph.split())) grouped_words = defaultdict(list) # Put all anagram words together in a dicti...
true
e2ce552a024dff712e2b568b3daa9bab64eb00f1
Python
charu11/opencv
/demo10.py
UTF-8
1,271
2.78125
3
[]
no_license
import numpy as np import cv2 as cv def val_change(x): pass; cv.namedWindow('tracking') cv.createTrackbar('LH', 'tracking', 0, 255, val_change) # LH- lower hue cv.createTrackbar('LS', 'tracking', 0, 255, val_change) # LS- lower saturation cv.createTrackbar('LV', 'tracking', 0, 255, val_change) # LV- lower value ...
true
c3b56db7f9dbc015436523f3dc52ba32f9889f51
Python
shark1033/Python-Stepik
/list_summ.py
UTF-8
258
2.78125
3
[]
no_license
for i in range(0,len(s)): if len(s)==1: print(s[0]) break elif i==0: l.insert(i, s[1]+s[len(s)-1]) elif i==len(s)-1: l.insert(i, s[0]+s[i-1]) else: l.insert(i, s[i-1]+s[i+1]) print(l[i], '',end='')
true