blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
4f13bb5075143f5ec495aabc8ef8be02abf2058c
ShashikantBhargav/max_element
/max_element.py
122
3.734375
4
arr=[30,20,15,40,10] max=arr[0] n=len(arr) for i in range(1,n): if arr[i]>max: max=arr[i] print(max)
211029ea902c3cc1613b96812947fdce35b00e5e
workhardforcoding/github-upload
/brian.py
1,623
3.640625
4
books = ['A234', 'A675', 'A212', 'B671', 'B534', 'B777', 'B778', 'B812', 'C101', 'C102'] borrowers = ['L34', 'L22', 'L19', 'L84', 'L77'] #The book that has been checked out will be stored in this dictionary together with borrower id. #The book that has been returned will be deleted in this dictionary together with borr...
24925b03b54c280bdd25703de4e6963f1b954284
Barathkumar-09/Hacker-rank-solutions
/Python/Easy/Find the Runner-Up Score!.py
817
4.125
4
""" Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up. Input Format The first line contains . The second line contains an array of integers each separated by a space. Con...
0fb8d716bf61506458234605f636bca7f951b529
hhratcliffe/480MajorProjects
/Backend Files/output_writing.py
646
3.65625
4
##James Kaufman ##import our packages import csv import os import os.path import io import pandas as pd from pandas import DataFrame, read_csv ##Create two mock columns for the spreadsheet names = ["Sam", "Tim", "Jon", "Elizabeth", "Magnus", "Kazuma", "Axelle", "Magdalena", "Geoff"] ages = ["21", "45", "32", "13", "16...
8d5717ff28a4d0d380e7bae17b2893db33accb4b
sdwfrost/SeqAnalTools
/FindSeqsInFasta.py
5,943
3.59375
4
#!/usr/bin/env python from __future__ import print_function ## Author: Chris Wymant, c.wymant@imperial.ac.uk ## Acknowledgement: I wrote this while funded by ERC Advanced Grant PBDR-339251 ## ## Overview: ExplanatoryMessage = '''This script retrieves searched-for sequences from a fasta file. Output is printed to stdou...
a3f970f16005929132987572e9bcbf87f234e805
MagQ98/haunted-house
/run.py
27,786
4.15625
4
# Users potential responses yes = ["Yes", "YES", "yes", "y", "Y"] no = ["No", "NO", "no", "n", "N"] answer_a = ["A", "a"] answer_b = ["B", "b"] answer_c = ["C", "c"] # Start the game def start(): print("Would you like to start the game " + name + "? \n") answer = input("Please enter Yes or No: \n") if ans...
8321c1e8903dc73235fee9ff02bf6c69421d565f
Albert-learner/Python
/second.py
418
3.96875
4
print("국어 점수 입력 : ", end="") kor=int(input()) print("영어 점수 입력 :", end="") eng=int(input()) print("수학 점수 입력 :", end="") mat=int(input()) avg=(kor+eng+mat)/3 if avg>=90: print("Your grade is A") elif avg>=80: print("Your grade is B") elif avg>=70: print("Your grade is C") elif avg>=60: p...
180ccc783761adac8ea154f212fa1f0962d693cc
Sinoh/CalPoly-CPE-103
/Lab 6/priority_queue.py
4,099
3.984375
4
import sys sys.setrecursionlimit(5000) # A comes_before is # A boolean # Takes two numbers and return true if the first value is comes before the second def comes_before(val1, val2): if val2 == None: return True if val1 == None: return False if val1 < val2: return True else: ...
8bb942ddd2a487f25fd4cd54e90dcf5276fdc913
Lucasbertilima/TCC-Cedup
/app/Interfaces/teste.py
4,796
3.703125
4
import sqlite3 from tkinter import Frame, GROOVE, Label, Entry, Text, Button, END, Tk # import ttk # from Tkinter import * # import tkMessageBox # Criar conexão e cursor con = sqlite3.connect('banco.db') cur = con.cursor() # Criar tabela clientes cur.execute("""CREATE TABLE IF NOT EXISTS clientes ( nome V...
82cb089ae9d96a51ebd7649fd3f86212714a5fcb
Epic-Doughnut/Dictionary-Subset
/dictionarySubset.py
551
4.03125
4
from english_words import english_words_lower_set import sys if len(sys.argv) == 1: print('You must include a list of letters to include!\nFormat: <include> [exclude]') exit() # include words with every letter from include, exlcude words with any letter in exclude # to leave include empty, type '' include ...
40a670e2a12ef1d076c02e416241f23895d63a2b
StanleyUng/calendar-py
/shift.py
1,418
3.90625
4
import datetime wage = 13.13 class Shift: """ Shift Class - The date of the shift - clock in time - clock out time - total number of hours worked that day - the amount of pay for that day """ def __init__(self, date, start, end): self.date = date self.start_time = ...
e3f363a24e24e81b380e908fdd2ff892dbe6e5c7
adqz/interview_practice
/leetcode/p47.py
1,144
3.734375
4
''' @author: adnan Problem No. 637. Average of Levels in Binary Tree (Easy) Runtime: 52 ms, faster than 83.14% of Python3 online submissions for Average of Levels in Binary Tree. Memory Usage: 14.8 MB, less than 100.00% of Python3 online submissions for Average of Levels in Binary Tree. ''' from typing import List imp...
ffd12f2744583d539d8dc18d625d4e030022003d
Mustafatalib/Python-Crash-Course-Exercises
/3.10-3.11 Every Function.py
695
4.21875
4
countries = ['pakistan', 'china', 'indonesia', 'europe', 'india'] print(countries) print("\nLength of list") print(len(countries)) print("Reversed countries: ") countries.reverse() print(countries) print("Sorting Alphabetically: ") print(sorted(countries)) print("Removing India from the list by value") countries.remove...
cbb574713bbcd6534bcd82d9ddd3323b5e4d4dc4
tektips/python
/greet.py
265
3.671875
4
# greet.py def greet(name): print("Hello, " + name + ". Good morning dude!") greet("Mat") Hello, Mat. Good morning dude! ## If we intend the greet method, we get the below errors ** IndentationError: unindent does not match any outer indentation level **
5e56d0b23cd2ee316ddc526fb252dbbd4051d257
u-kan/python_practice
/pandas_lesson7.py
2,500
3.53125
4
import pandas as pd """ 統計の知識がたくさん出てきて難しい grupbyの仕方によって平均も標準偏差も違ってくるから、そこは試行錯誤が必要 lambda のところは、Revenueカラムに対して働く(それしかcolumnがないから) 統計の正規分布とかその辺りの知識をもうちょっとつけたいと思った。 棄却域とかのあたりがいまいちわからぬ """ # Create a dataframe with dates as your index States = ['NY', 'NY', 'NY', 'NY', 'FL', 'FL', 'GA', 'GA', 'FL', 'FL'] data = [1.0, 2, 3...
df20cc91c4d808d484d4f58706c8096cb4fc2d98
harrifeng/Python-Study
/Leetcode/Powx-n.py
907
4.0625
4
""" Implement pow(x, n). """ class Solution: # @param x, a float # @param n, a integer # @return a float def pow(self, x, n): if x == 0 or x == 1: return x elif x < 0 and n % 2 == 0: return self.pow(-x, n) elif x < 0 and n % 2 ==1: return self...
36535d1be4467a7461f966dd8317290110d43179
kielkow/Desafio-16-35-Pyhton
/Desafios 22,23,24,25,26,27.py
1,285
4
4
#EXERCICIO 22 nome = input('Digite seu nome inteiro:') nome = nome.upper() print(nome) nome = nome.lower() print(nome) print(len(nome.split(' ')[0])) nome = ''.join(nome.split()) print(len(nome)) #EXERCICIO 23 num = input('Digite um numero de 0 a 9999:') print('Milhar:{}' .format(num[0:1])) print('Centena:{}' .format(...
f457397a3d8ddd8e32b275931a9f172e570e9500
motaz-hejaze/lavaloon-problem-solving-test
/problem1.py
939
4.125
4
print("***************** Welcome ********************") print("calculate persistence of integers function") print("python version 3.6+") print("run this script to test the function by yourself") print("or run test_problem1 for unittest script ") counter = 0 def multiplicative_persistence(x): global counter ...
c837c230a18d382d19dfe680068928e9b775ec1e
Giovanacarmazio/Modelacao-Retangulo
/codigo.py
701
3.875
4
class Retangulo(): def __init__(self, comprimento, largura): self.setComprimento(comprimento) self.setLargura(largura) def setComprimento(self, comprimento): self.comprimento = comprimento def setLargura(self, largura): self.largura = largura def getComprimento(self): return self.comprimento def getL...
71a49efacd41108e6aea73862d7c2096f292f8a1
DarkCron/PythonBvP
/Oefenzitting1/6-6Cartesische.py
240
4.3125
4
import math x = float(input("Enter the x-coordinate: ")) y = float(input("Enter the y-coordinate: ")) r = math.sqrt(math.pow(x,2)+math.pow(y,2)) theta = math.degrees(math.atan(x/y)) print("The radius is: ",r) print("Theta is: ",theta)
5358ff91328a996b1f959617617c8214f4fb3f7c
Pragati2512/Tutree
/tutree8.py
254
3.703125
4
list1 = [8, 5, 10, 7, 9, 4, 15, 12, 90, 13] list2=list1 K=2 subs=len(list1)-K +1 for i in range(0,subs,K): print(list2[i:i+K]) list2=list1 list1.reverse() for i in range(0,subs,K): print(list2[i:i+K]) list2=list1
a826b67101ecf618f1b1264ab5a61896b9932104
weiting1608/Leetcode
/543. Diameter of Binary Tree.py
919
4
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: # global variable self.res = 0 ...
f9fa83291733a7b98f5f2c280e45d2cba6024329
Arthur31Viana/PythonExercicios
/ex058.py
798
4.09375
4
#Melhore o jogo do DESAFIO 028 onde o computador vai "pensar" em um número entre 0 e 10. Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos palpites foram necessários para vencer. from random import randint from time import sleep print('-=-' * 19) print('Vou pensar em um número en...
a4eda6d21182b85329a5d5e60bcd8891560aa6f4
wzdnzd/leetcode
/python3/1281.整数的各位积和之差.py
1,103
3.53125
4
# # @lc app=leetcode.cn id=1281 lang=python3 # # [1281] 整数的各位积和之差 # # https://leetcode.cn/problems/subtract-the-product-and-sum-of-digits-of-an-integer/description/ # # algorithms # Easy (83.11%) # Likes: 123 # Dislikes: 0 # Total Accepted: 80.7K # Total Submissions: 96.7K # Testcase Example: '234' # # 给你一个整数 n,...
35cba0f827869baa278d99366211defdf3b6e2aa
green-fox-academy/Chiflado
/week-03/day-03/position_square.py
517
4.15625
4
from tkinter import * root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # create a square drawing function that takes 2 parameters: # the x and y coordinates of the square's top left corner # and draws a 50x50 square from that point. # draw 3 squares with that function. length = 50 def dra...
9328f4b88373134bc1f3b320436c205fd39ec120
memojl/curso-python
/Python/funcion.py
941
4.125
4
PI=3.141516 #Area del cuadrado def acuadrado(): lado=input("Cual es el valor del lado?") lado=float(lado) x=lado*2 print("El area del cuadrado es ",x," unidades cuadradas") #Area del triangulo def atriangulo(): base=input("Cual es el valor de la base?") base=float(base) altura=input("Cual es el valor de la alt...
33002475b9373bce787aaa07c8d389547dfa86ad
HaykSahakyan11/Machine_Learning
/Homework1/Digit Sum 3.py
78
3.9375
4
# Digit Sum 3 num = int(input()) print(num % 10 + num // 10 % 10 + num // 100)
c549c12fc27569cb0e0892ff8db99000be666e09
CrazyJ36/python
/crazyj36_libs/get_dir.py
839
3.59375
4
#!/usr/bin/env python3 from os import name, getcwd # When defining function, specify that the # parameter should be of string type when called # from user programs. def get_os_dir_append_name(a_file_name: str): # The next triple double-quote block specifies # A description for this program function. # An...
6b9fbd30ab51bfbf3779de68c4af496e914de4b9
RaRosh/Assignment-01
/Readingfile.py
368
3.6875
4
''' Modes of file r = read only w - write a - append x -create w -x -a - creates file if not exists ''' import os file_path = "Output.txt" list = [] if os.path.exists(file_path): file = open(file_path) print(file.read()) for eachline in file: list.append(eachline) print(li...
b75e1549750f3150e46994ad0a12dffb22ae4b11
gaetanV/python
/resolve/down.py
179
3.546875
4
import sys import math while True: max=0 p = 0 for i in xrange(8): m = int(raw_input()) if m > max : max = m p = i print p
ec4ded0fdc6aa261a066dd4a8ce66cba25bb9181
vittal666/Python-Assignments
/Second Assignment/Question-1.py
2,065
4.125
4
usersDetails = {} # Login authorization def loginauth(username, password): if username in usersDetails: if password == usersDetails[username]["password"]: return True return False # Checking username or email address is unique or not def checkForUniqueUsername(username): if username in...
542ef1b27158a7c21ad81380d2e31f1197aaeac4
knitinjaideep/Python_NK
/matplotlib_CSVRead.py
920
3.609375
4
# -*- coding: utf-8 -*- """ Created on Sun Sep 24 15:08:15 2017 @author: nitin.kotcherlakota """ #matplotlib - loading data from a csv file import matplotlib.pyplot as plt import csv import numpy as np #Two ways to read a file, read using Csv or read using numpy. Numpy reduces the number of lines of code. #1.To read ...
854fb446537c72290ab724ee6010458ff0841500
gustavo-Romero-Alvarez/proyecto-php-java-python-punto-net-c-
/programacion/python/trabajos cortos de python/abril/while con notas.py
680
3.9375
4
#notas con while alumnos="" nota1=0 nota2=0 nota3=0 continuar="" promedio=0 print "escribir salir si desea salir " while (True) : alumnos=(raw_input("ingrese nombre del alumno: ")) if alumnos=="salir": break nota1=float (raw_input("ingrese nota 1: ")) while nota1<1 or nota1>7: nota1=float (raw_input("i...
f94d265b7c8b3977f2d5b9539329dfec2233fe7c
wgf5544/wugaofeng
/python/thread_demo.py
534
3.59375
4
''' Args: Returns: ''' import threading import time e=threading.Event()#事件 def goevent(): # e=threading.Event()#事件 def go(): while True: # e.wait(3) #等待,后续代码不再执行,等待set再执行。让线程有序执行 print("go") time.sleep(3) threading.Thread(target=go).start()#开启一个线程 retur...
fe7c61097a360cbfb90bd418a092392a2368afc6
Ulvvo/NAPS-2021
/rough.py
7,288
3.8125
4
def combine_df_province(province,voc,province_data): ''' Combines data for different stations in a given province into a single DF for a given VOC with the columns being measurements for different stations. input: province (int) --> NAPS Station code for that province (eg. 6 --> Ontario). *See fun...
49b730d8c51faa3b0694fe04b98317c18f4fbbf8
dustinpfister/examples-python
/for-post/python-standard-library-tkinter/s4-text/basic.py
269
3.828125
4
import tkinter as tk root = tk.Tk() root.minsize(640, 480) # create a text widget text = tk.Text(root, width=60, height=25) # insert some start text text.insert(2.0, 'hello world\n') text.insert(1.0, '1234\n') text.insert(2.6, 'cruel ') text.pack() root.mainloop()
245e2a3f0e1e37cf4c27c52979a07627a3412ac6
ojhak02/kush-
/swap.py
84
3.765625
4
x=4 y=5 print("before swap",x,y) x=x+y y=x-y x=x-y print("after swap",x,y)
c25e3d1292f3054607463dd69571356bb5d8ca52
shamikbose/python_examples
/prime.py
285
3.84375
4
#!/usr/bin/python def prime(z): result = [] for n in range(2, z): for x in range(2, n / 2): if n % x == 0: # print n,' is non-prime' break else: result.append(n) return result x = prime(100) print x
593277885f91099e5000dfea6ef517c328c6c9e4
singhpia/PythonBeginner
/SmallProgramsInPython/eq triangle.py
188
3.9375
4
print("enter number of rows") n=int(input()) for i in range(n): for j in range(n): print(end=' ') n=n-1 for j in range(0,i): print("* ",end="") print("\r")
369c93d46b68392ce588ebf86ae5f3a95bd5c75c
chieh0421/Chieh
/大一/python/4/10.py
345
4.375
4
#!/usr/bin/env python3 # -*- coding:utf-8 -*- str1 = str(input()) if str1.isdigit() == 1: print(str1,"is a number.") elif str1.isupper() == 1: print(str1,"is a capital letter.") elif str1.islower() == 1: print(str1,"is a lowercase letter.\nswap to capital letter {0}.".format(str1.upper())) else: print(...
7f92cf0ff2f51057c7eec08981a374f24dc30c96
primowalker/Python_Training
/Linux_Academy/heads_or_tails.py
336
3.890625
4
#!/usr/bin/python import random heads_in_a_row_needed = 10 heads_in_a_row = 0 total_tries = 0 while heads_in_a_row_needed != heads_in_a_row: toss = random.randint(0,1) if toss == 1: heads_in_a_row +=1 else: heads_in_a_row = 0 total_tries +=1 print "It took %s tires to get %s heads in a row" % (total_tries, ...
88f336926f4890229d55595086ddc321778723df
Mirdev/Algorithm
/Tower_of_Hanoi.py
303
3.96875
4
# There are three poles: a, b, c # The first parameter of hanoi, the function name, is the number of plates. def hanoi(n, F, A, T): if n==1: print("%d, %s->%s"%(n,F,T)) else: hanoi(n-1, F, T, A) hanoi(1, F, A, T) hanoi(n-1, A, F, T) hanoi(3, "a", "b", "c")
4ab29e9fd1767491dce0438058d87d55d0be473e
fpgodoy/Exercicios-Python
/ex004.py
676
3.953125
4
c = input('Digite alguma coisa: ') t = 'O dado digitado' print('Você digitou {}.'.format(c)) print('O tipo primitivo do dado digitado é {}.'.format(type(c))) print(t, 'é alfanumérico?', c.isalnum()) print(t, 'é alfabético?', c.isalpha()) print(t, 'é ascii?', c.isascii()) print(t, 'é decimal?', c.isdecimal()) pr...
df5039098b8967fef80a161fb660926ee7be1cc4
anastasllc/leibniz-enc-py
/leibniz.py
5,766
3.734375
4
import sys from string import maketrans,translate class leibniz: def __init__(self, gear = None, alphabets_string = None, alphabet_delimiter = '\n', default_alphabet = "ABCDEFGHIKLMNOPQRSTUWXYZ \n"): """constructs class and either sets or reads from disk the alphabets and gear to be used, with the default character...
54fb96e5d14e037a4e6a8b9fff528ed41c45c377
vitalka12345/otus_basic
/8.DataClasses/cars/__init__.py
808
3.578125
4
from baseMachine import BaseMachine class Car(BaseMachine): type_model = 'Легковой автомобиль' wheel_count = 4 def moving(self, name): return print(f"{name} is a car and it goes.") class Nine(Car): type_model = 'Девятка' wheel_count = 4 def start(self, fuel): if fuel > 10: ...
6e22ae3a1803e7fc422a9da17a28fb91d712e1f0
abhisek08/Python-data-types-String-
/string to list.py
94
3.84375
4
''' Write a Python program to convert a string in a list. ''' str1='abhisek' print(list(str1))
023dae5d636712d60dc35db2ae80ae436c46293a
DKCisco/Starting_Out_W_Python
/speed_converter.py
486
4.28125
4
# This program converts the speeds 60 kph # through 130 kph (in 10 kph increments) # to mph. START_SPEED = 60 # Starting speed END_SPEED = 131 # End speed INCREMENT = 10 # Speed increment CONVERSION_FACTOR = 0.6214 # Conversion factor # Print the table headings. print('KPH\tMPH') print('------...
9a75c852b6c65001c5aa27d97f4d8d1b58d54e85
vishmango117/Travel-Tracker-2.0
/Places.py
1,912
4
4
"""CP1404 Programming-II Assignment-2 Travel Tracker 2.0 Places.py: File containing the class Place which comprises of name, country, priority, visited as the instance variables and methods like mark_visited(), mark_unvisited(), important_place() """ from operator import attrgetter class Place: def __init__(self...
9d2e28c3197cc3c823585744e81d744739b30915
a-pallotto/project-euler
/ex042.py
1,441
3.828125
4
# -*- coding: utf-8 -*- """ Created on Sun Dec 2 15:23:57 2018 The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical pos...
396cbd8acb4a94b830f5e1bb48ee82e0ade4fd2a
TinyAtoms/pIrrigation
/old-nondjango/UI_cmd.py
1,637
3.578125
4
user_input = 'random' crop_list = [''] #import from db growth_periods = ['early', 'developing', 'mature', 'late'] def menu_1(): print('Hello and welcome to the menu of your irrigation system.') print('What would you like to do?') print('1. Add a new CG (crop group)') print('2. Edit information of a CG'...
975f4554ad0383d921da3a9548cb5875613c0b9d
y-aiba/dp_py
/singleton/sample/singleton.py
946
4.3125
4
class Singleton(object): @classmethod def get_instance(cls, input_): if not hasattr(cls, "_instance"): cls._instance = cls(input_) else: cls._instance.input = input_ return cls._instance class MyClass(Singleton): def __init__(self, input_): self.inpu...
4242d704b0a688d75a9fefa28f4057a8fec939a3
jmsaini/PasswordGenerator
/generator.py
1,496
4.46875
4
import random import string def check_input(): """ Checks whether the user input is an integer and whether it is equal to 8 or greater than 8 """ user_input = input("Enter the desired length of the password: ") try: int(user_input) if int(user_input) >= 8: generate_...
f95201780ca532b9881a7aac3897b8ddf7cc9b26
4mina205/TIL
/Python/강의 실습/py210107.py
8,752
3.515625
4
# # # print("8128".count('8')) # # # # sum=0 # # for i in range(10001): # # sum+=str(i).count('8') # # print(sum) # # # # print(str(list(range(1,10000))).count('8')) # # # # f=open("hello.txt","w") # # f.write('hello world') # # f.close # # # # f=open("hello.txt","r") # # s=f.read() # # print(s) # # f.close() # # #...
a2e703cbad25fa54a9ce6e4bb403cb76a79d0fdf
zxzl/lc
/python/576.py
1,648
3.546875
4
""" option 1 iterate all possible paths 4^N -> infeasible option2 count the number of paths to each cell within N-1 times than we can use paths to edges to get answer corner : x2 not corner: x1 eg N=1 1 1 1 0 N = 0 0 1 0 => 2 N = 1 1 0 1 => 6 N = 2 0 2 0 => 4 ---- N = 3 2 0 2 => 6 """ class Solutio...
a4d58687e111ccbf1d717c1d1432c4d45cac9bf0
EduardoMachadoCostaOliveira/Python
/CEV/ex092.py
871
3.703125
4
# Crie um programa que leia nome, ano de nascimento e carteira de trabalho e cadastro-os(com idade) em um dicionário # se por acaso a CTPS for diferente de ZERO, o dicionário receberá tambem o ano de contratação e o salário. # Calcule e acrescente, alem da idade, com quantos anos a pessoa vai se aposentar. from datetim...
3171c989709950c333bccf1fc88075a144591209
znnznn/coursera
/week2/while/метод фаинд.py
201
3.84375
4
x = input() x2 = x.rfind('f') x1 = x.find('f') if 0 <= x1 < x2: print(f'{x1} {x2}') elif x1 == x2 != -1 or x1 >= 0 < x2: print(f'{x1}') elif x2 > x1 == -1: print(f'{x2}') else: print()
c7a57ee1f6efccc0506ea08489578633f1e77fbf
Trash-Bud/FPRO
/REs/RE12/Tic-Tac-Toe.py
1,064
3.59375
4
# -*- coding: utf-8 -*- """ Created on Wed Dec 18 12:36:46 2019 x1x 0o2 xoo @author: Joana """ def tic_tac_toe(board, player): h = [] count = 0 board = board.split("\n") diagonals = [[("A1", board[0][0]),("B2", board[1][1]),("C3", board[2][2])],[("A3", board[0][2]),("B2", board[1][1]),("C1", board[2][0...
6023c75ab09bb6999988396ac7f1a500bbcb22a9
shrikantpandey13/python-data-structure
/recursion/multiply_twoNumber.py
253
4.21875
4
def multiply(n,m): return product(n,m) def product(n,m): i=0 prod=0 while i<n: prod = prod+m i+=1 return prod if __name__=="__main__": n= int(input()) m= int(input()) print(multiply(n,m))
b090c5d58d0a7aeff71015a39d51d0b98d6ed783
Nikita-2007/HardChildhood
/Python/ВУЗ/ВУЗ_4.py
600
4.21875
4
print('Меняем значеиние А и В с использованием(и не использованием) временной переменоой') A = int(input("Введите число A: ")) B = int(input("Введите число B: ")) C = A A = B B = C print("Меняем значеиние А и В с использованием временной переменной") print("A =",A) print("B =",B) A, B = B, A print("Меняем значеиние А и...
bdc588562cc09b7faeaf033b82a3a63d4fbb3398
Nicolas1617/scuola
/python/nome.py
203
3.5
4
nome = raw_input("Scrivi il tuo nome ") utente = raw_input("sei femmina? ") if utente =="si": print "cara", nome, ", sei bravissima!" if utente == "no": print "caro ", nome, ", sei brravissimo!"
d3560ee12c4dc9bba45c2ccaa2363e0c9705c8ce
bigrob21/LearningPython
/AutomateTheBoringStuff/chapter4/listSlicing1.py
545
3.8125
4
aList2 = [1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100] startIndex1 = 10 print('Showing you the list - ' + str(aList2)) print('Showing the list via slicing from the 5th element to the end of it --> ' + str(aList2[startIndex1:len(aList2)])) print('First element in the list is = ' + str(aList2[0]) + ' .Now changing ...
0217ffce6df8084a1bf794f6a41281b91926d075
vsuomi/fibroid-classification
/save_load_variables.py
1,434
3.765625
4
# -*- coding: utf-8 -*- ''' Created on Fri Sep 7 09:30:00 2018 @author: Visa Suomi Turku University Hospital September 2018 @description: This function is used to save variables from workspace into a pickle file ''' #%% import necessary packages import pickle import os #%% save ...
0e8ac38e94c31df990fad7c688fd4a83b855b07e
cvva/Clases-Python
/3_Ejemplos_LecturaTeclado/ejem02.py
310
3.78125
4
#Lectura de numeros num1=input("Por favor, introduce un número : ") num2=input("Introduce otro, por favor : ") total=int(num1)*2+int(num2) print("El primer numero introducido es : "+num1) print("El segundo numero introducido es : "+num2) print("El doble del primero mas el segundo es : "+repr(total))
cc4e39bf4a0f0baca377b44c6ad4942b97071626
rallen0150/class_notes
/new_prac/datetime/week_number.py
245
4.1875
4
import datetime def week_number(date): x = date.split("-") week = (datetime.date(int(x[0]), int(x[1]), int(x[2])).isocalendar()[1]) return week date = input("Enter a date (format is 'Year-Month-Day'):\n>") print(week_number(date))
91a2c8849c113e84470e9a6020878fa755104428
mauriciosierrac/holbertonschool-higher_level_programming
/0x0B-python-input_output/1-write_file.py
203
3.53125
4
#!/usr/bin/python3 '''write in external file''' def write_file(filename="", text=""): '''that method write in external file''' with open(filename, 'w') as file: return file.write(text)
ba585532ea2bb36da8d5e3d1f5236f429a2029e3
gabriellaec/desoft-analise-exercicios
/backup/user_195/ch28_2019_03_02_20_01_16_846126.py
141
3.8125
4
velocidade=float(input("qual sua velocidade?")) if velocidade>80: multa=(velocidade-80)*5 print("voce foi multado") print (multa)
0b4cbc2c692f14287ce87182a3d11771f49b9ab2
eric496/leetcode.py
/greedy/435.non_overlapping_intervals.py
1,555
4.1875
4
""" Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Example 1: Input: [[1,2],[2,3],[3,4],[1,3]] Output: 1 Explanation: [1,3] can be removed and the rest of intervals are non-overlapping. Example 2: Input: [[1,2],[1,2],[1,2]] O...
c861a7e7adb4e06da0e51070be60f4ec677765ab
dodecatheon/UW-Python
/fall2011/week05/unlisted_words_solution.py
1,236
4.21875
4
""" Assignment for week 6 http://staff.washington.edu/jon/uw_python/fall_2011/assign_6.txt Write a function unlisted_words that takes two string arguments, a sample string and a reference string, and returns a list of all the words that appear in the sample string that do not appear in the reference string. ... """ ...
ec8180e87e595cdc9938bfcca82d2e75bab3d7c3
YYN117/Demo
/playstation/Tips/5.奇数位置的字符串.py
244
3.765625
4
''' 描述: 给你一个字符串 a, 输出a中奇数位置字符构成的字符串(位置编号从1开始)。 例如:a=‘xyzwd’ 则输出:xzd ''' a='xyzwd' for i in range(len(a)): if (i+1)%2 != 0: print(a[i],end='')
f1534871dc06d788407c9c421251a86d91e1b414
yja2397/chopsticks
/chopsticks2_noneComputer.py
5,853
3.53125
4
# coding: utf-8 # In[13]: ### 젓가락을 만들자 # Chopsticks game # In[14]: import random # In[15]: def gameStart(): # 게임 시작 # 사람 두명 만들기 player1 = player("세공사") player2 = player("땜장이") playerList = [player1, player2] random.shuffle(playerList) print("" + playerList[0].getName()...
1dca3a15fff6e8686168e9f622511f87df46f16c
rafaelperazzo/programacao-web
/moodledata/vpl_data/303/usersdata/299/80747/submittedfiles/testes.py
114
3.921875
4
x=input('num: ') if float(x)>0: print('POSITIVO') elif int(x)=0: print('NULO') else: print('NEGATIVO')
3060ecf62adcfd75d34aca2ba5b7a5dd25af74ce
RHZEnoxs/PyProjSE-v1.0.1
/com/tutorials/basic/files/FileOperateTask.py
7,271
4.34375
4
# Python 3 - Files I/O # Sample Example #Printing to the Screen def printToScreen(): # !/usr/bin/python3 print("Python is really a great language,", "isn't it?") #The input Function def inputFunc(): x = input("input something:") print('x : ',x) #The open Function def openFunc(): # Open a file ...
8b0611dd9543188fbcf151eaee65b738f1ba2e3b
melo4/jianzhioffer
/0~n-1中缺失的数字.py
576
3.5
4
# -*- coding: utf-8 -*- # @Time : 2019/4/16 下午10:08 # @Author : Meng Xiao class Solution: def GetMissingNumber(self, numbers, length): if not numbers or length <= 0: return -1 left = 0 right = length - 1 while left <= right: mid = (left + right) // 2 ...
3685ef6c55fa09011053f597a8ac4560d525d5ec
Leejieun3001/python_study
/workspace/example23_class_constructor.py
579
4.03125
4
""" 생성자 상속 //super() """ class Animal: def __init__(self,name): self.name = name def walk(self): print("걷는다") def eat(self): print("먹는다") def greet(self): print("{}이가 인사한다.".format(self.name)) #생성자는 반드시 상속 받아야한다. class Human(Animal): def __init__(self,name,hand): super().__init__(name) self.hand = ...
06ce5c4193bc09b604bd556f3a893430f8957506
peterdm/extractor
/extractor/ngramfilter.py
947
3.9375
4
""" Split a query into word n-grams """ class NGramFilter: def __init__(self, maxgram): """ maxgram -- the longest number of words allowed in an ordered permutation """ self.maxgram = maxgram def generate(self, query): """ query -- the phrase to split ...
f42a77151ddf68710959e65e3525d2d7a3e35df3
ezeutno/PycharmProject
/Data Project/TA_Assignment/Assignment_2/AliceNBob.py
162
4.09375
4
#input == remaining stone odd = alice even = bob def main(): w = int(input ()) if w%2 != 0 : print('Alice') else : print('Bob') main()
f4286e2dd9239a4c3d3bdef724efb5b4b956bffb
VitaliiHudukhin/ithub
/lesson6_tasks/task6_base_01.py
1,642
3.96875
4
from random import random,randint school = { '1A': 30, '1B': 30, '2B': 25, '6B': 31, '7C': 33, } print('Valuable commands in this program: ') valuableCommands = ['change number','new class','delete class','total amount','exit'] for i in valuableCommands: print(i) inputData = "" while inputData.l...
cd50c7ecf76e6dd6e0103b5da1b315209c6b9669
GoberInfinity/ExamplePython
/DataStructures/Set/counter.py
185
3.5625
4
# A Counter is a dict subclass for counting hashable objects. from collections import Counter letters = Counter(["a", "b", "c", "a", "b", "b"]) # >>> Counter({'b': 3, 'a': 2, 'c': 1})
cbea9439de7a42d22baf164d70f88df7caecddd5
NamanJain8/Machine-Learning
/ex3/ex3_nn.py
666
3.53125
4
import numpy as np from scipy.io import loadmat def sigmoid(z): return 1.0/(1.0+np.exp(-z)) def predict(theta1,theta2,X): a1=X.T a2=sigmoid(np.matmul(theta1,a1)) m=a2.shape[1] a2=np.concatenate((np.ones((1,m)),a2),axis=0) a3=sigmoid(np.matmul(theta2,a2)) h=a3 return 1+np.argmax(h,axis=0) if __name__=='__ma...
65ce5c43e2d8831f5df95f2133bb03d42526cf94
pratyushkhatait/coffee-machine
/coffee_machine.py
1,011
3.953125
4
from beverage import Beverage from singleton import singleton @singleton class CoffeeMachine: """ Implementation of a Coffee Machine class """ def __init__(self, N): """ Initialize the coffee machine with given number(i.e. N) of outlets :param N: """ self.outlet...
64f4ab1a63f5b341709c5ac86376c64a248e299c
Tuman1/Web-Lessons
/training.py
1,508
4.0625
4
'''Генерировать случайный массив из чисел 1-100. Написать функцию, которая найдет пару чисел с фиксированной суммой. Вход - массив и необходимую сумму Возврат - пара чисел `(сделать эту задачу с минимальной сложностью, минимальной используемой памятью, и сделай только один проход по массиву) ``(входной массив не сортир...
42882e5a4d73db6709aae24f2746bf7e80bc4f27
Amily-Wang/Python_Levelwise_Exercises
/Solution/63.py
89
3.65625
4
n=int(input()) sum=0.0 for i in range(1,n+1): sum += float(float(i)/(i+1)) print(sum)
74eb90db50e592d5985dd79afe74d9d62f40ed9b
qiuyixuan/Data-Analysis-and-Visualization
/project2_matrix transformations/data.py
12,967
4.25
4
'''data.py Reads CSV files, stores data, access/filter data by variable name Yixuan Qiu CS 251 Data Analysis and Visualization Spring 2020 ''' import numpy as np import csv class Data: def __init__(self, filepath=None, headers=None, data=None, header2col=None): '''Data object constructor Parameter...
d9d4e021c4166d8b089f76890960aceaed635ca5
ansh8tu/Python-for-Beginners
/python103/25_tuples.py
320
3.796875
4
#tuples are similar to that of lists but the difference is that tuples are immutable #the word immutable means that you can't add ort remove items from a tuple #these are useful when you don't want to make changes in the list numbers = (1, 2, 3) moreNumbers =(4,5,6) idk =numbers.__add__(moreNumbers) print(idk)
30a30c23c96b4d593b2aef888c1f69c8e390e637
ThijsKonst/AdventOfCode2020
/day7part2.py
626
3.6875
4
def recursivesearch(rules, term): result = 1 for color in rules[term]: result += color[1] * recursivesearch(rules, color[0]) return result file1 = open("day7data") lines = file1.readlines() rules = {} for line in lines: line = line.split(" ") colors = [] first = False for i in ran...
a6c2a6a123a363e2e47859b7398d3ca2bd8dcc45
oicurp/Analytical-Instrument-Qualification
/Scripts/Auto-populate key words in documents PP.py
4,897
3.5
4
""" Author: Renhuan Huang This script will iterate through the files inside a given folder for each word document, the key words (contained in {} sign will be replaced by values read from csv file) """ from docx import Document from csv import reader import os import sys # preparation of files absolute_path = r"C:\...
d19394a4473df75d66152a1bedb30c423989a470
cdvillegas/datastructures
/datastructures/min_heap.py
2,577
4.03125
4
class MinHeap: """ A heap is a special tree-based data structure that satisfies the heap property. It's an important structure because it's efficient for priority queue operations, such as insertion, maximum extraction, and sorting. In a min heap, for any given node I, the value of I is less than or equal t...
8ca2580dd74371409810d5cbd4ab7ec206299e9d
Felixjie8088/pythonProject
/练习2(填写数字转英文单词).py
461
3.75
4
# -*- coding:utf-8 -*- """ @Author: Felix @File: 练习2(填写数字转英文单词).py @Desc: @Create: 2020/08/12 17:18 """ num_input = input('请输入数字:') lst_en_num = dict({'0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine', }) str_output = [] for n in num_in...
9115951c60658c8270757728da9b5f501308192a
ericjwhitney/pyavia
/pyavia/iter.py
5,990
4.0625
4
""" Handy functions for dealing with various iterables. """ from typing import Iterable, Sequence, Dict # ============================================================================= def all_none(*args): """Returns True if all arguments (or elements of a single iterable argument) are None.""" if len(ar...
c66bdc09a1fcfb33c861a49539011600d4e99c3f
betta-cyber/leetcode
/python/020-valid-parentheses.py
1,012
3.875
4
#!/usr/bin/env python # encoding: utf-8 class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ stack = [] print stack print(s) for i in range(len(s)): if s[i] == '(' or s[i] == '[' or s[i] == '{': s...
98318ac70ba7fa63cece38ee46bb3c413a59c742
gugajung/guppe
/fixação/Seção06/41-50/Sec06Ex45.py
630
4.09375
4
while True: opcao = valor = result = 0 print("1 - Converter KM/H -> M/S ") print("2 - Converter M/S -> KM/H ") print("3 - Sair ") while opcao < 1: opcao = int(input("Entre com a Opcao desejada :-> ")) if opcao >= 3: break if opcao == 1: valor = float(input("Entre coma velo...
c70a7f33c072a871d4f9a89c827fe5b9eac3637c
eopr12/pythonmine
/st01.Python기초/py10함수/py10_ex03_사칙연산함수.py
2,080
3.859375
4
# First num: 2 # Second Num: 4 # Add: 6 >>Add()함수 이용 / 매개변수 2개 사용 x,y # Minus: -2 >>Minus()함수 이용 # Mul: 8 >>Mul()함수 이용 # Div: 0.500000 >>Div()함수 이용 / 주의:Zero DivisionError 처리 def Add(x, y): result = None try: result = x + y except Exception as ex: pass return result def Minus(x, y)...
77b3404ed21f2e6f0b89715b0ad5b51f7e97565b
Harshit2009/My-Programs-
/general codes/fum17.py
300
3.8125
4
def fum17(n,j) : for i in range(2,n,+1) : if(n%i==0) : j=1 if(n==1) : print("1 is neither prime nor composite") else : if(j==0) : print("n is a prime number") else : print("n is not a prime number")
ad2e354a50a3aa90e826e2c30d3645a723d94233
Mohit130422/python-code
/61 membership in list.py
180
3.765625
4
#membership operation in list mylist1=[1,2,3,4,5,6,7,8,9] print(1 in mylist1)#true print(12 in mylist1)#False print(12 not in mylist1)#True print(2 not in mylist1)#False #run
e484b80c2c4fc24b1741c1d372af04ace40ede7b
maadscientist/Programming1Portfolio
/pigLatin.py
888
3.515625
4
#!/usr/bin/python3 while (1==1): userInput = str(input("Enter a string: ")) index = 0 indexLast = 0 wordList = [] i = 1 while i==1: index = userInput.find(" ", index, len(userInput)) if(index == -1): wordList.append(userInput[indexLast:len(userInput)]) i ...
1b8a043ab6ed182b7540608bd8ee777d5ab04e78
DominikaDudek/katy
/katy/9lucky_differently.py
418
4.15625
4
# Program to check if a given number is Lucky (all digits are different) # # A number is lucky if all digits of the number are different. How to check if a given number is lucky or not. # Examples: # # Input: n = 983 # Output: true # All digits are different # # Input: n = 9838 # Output: false # 8 appears twice def lu...
b58311ceed059672e6e6b147c1af08184c37d17b
fengyihuai/Learn_Python
/class6to7/I_exp_re1.py
469
3.59375
4
# -*- coding:UTF-8 -*- # 1、在氨基酸序列中查找给定的模式,并全部输出; import re pattern = re.compile('R.[ST][^P]') seq = 'RQSAMGSNKSKPKDASQRRRSLEPAENVHGAGGGAFPASQRPSK P' # findall returns a list of all matches matches = pattern.findall(seq) print(matches) # finditer returns an iterator of match objects match_iter = pattern.finditer(seq...
700c09e48dcbb8134d081196dd7bfcf4d51b330c
jobaamos/gap-year-club-code
/AMOS2.py
185
4.03125
4
#python program to add two digits firstnumber=int(input('what is the first number?')) secondnumber=int(input('what is the second number?')) sum=secondnumber+firstnumber print(sum)
0f15116312662e22fd11676902bc2e4d142f3e05
ryanatgz/data_structure_and_algorithm
/jianzhi_offer/23_顺时针打印矩阵.py
998
3.640625
4
# encoding: utf-8 """ @project:data_structure_and_algorithm @author: Jiang Hui @language:Python 3.7.2 [GCC 7.3.0] :: Anaconda, Inc. on linux @time: 2019/8/2 14:28 @desc: """ class Solution(object): def printMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: List[int] ...
f16ab30d6c841c289b3a9bc92ffc9c8180bbfa0b
vinh-ngoquang/NgoQuangVinh--D4E11
/Hw4/ex4.py
271
3.90625
4
z = [1, 6, 7, 2, 8, 1, 9, 3, 5, 6, 7, 9, 2, 8, 8, 8] number = int(input('Enter a number: ')) for i in range(len(z)): if number == z[i]: count = z.count(z[i]) print(number, 'appears',count,'times in my list') #code voi count. # print(z[i])