blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
26632b1f2d6edb223e6ad0bf5f1db8ef794339c7
Farashi25/Python
/FindChar.py
306
3.859375
4
word_list = ['hello','world','my','name','is','Anna'] char = 'e' # new_list = ['hello','world'] def character(char, word_list): new_list = [] for word in word_list: if word.find(char)>=0: new_list.append(word) # print word print new_list character(char, word_list)
2f367963829aa271ae676053e3d6b039783a5dbf
BermetZ/binary_search_tree
/binary_search_tree.py
1,222
3.96875
4
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert(self, node): if node.value < self.value: if self.left is None: self.left = node else: self.left.insert(node) el...
c97d1439ef1dbb4d44010de38e3e4e9f0073abf5
odormond/adventofcode
/2020/3/three.py
960
3.65625
4
#! /usr/bin/env python3 import os.path import advent_of_code as adv test_map = """ ..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# .#........# #.##...#... #...##....# .#..#...#.# """.strip().splitlines() def count_trees(tree_map, dx, dy): height = len(tree_map) width = l...
83c40acdc4b065cf3a050402c36fbe9f6054fbe6
odormond/adventofcode
/2018/6.py
1,175
3.78125
4
#! /usr/bin/env python3 import itertools from advent import Inputs def manhattan(a, b): ax, ay = a bx, by = b return abs(ax-bx) + abs(ay-by) coordinates = [tuple(map(int, l.split(', '))) for l in Inputs(2018).get(6).iter_lines(decode_unicode=True)] MARGIN = 2 width = max(x for x, y in coordinates) + ...
69392c726ae37fd45381d2cc2b76b6dd506b13e1
odormond/adventofcode
/2020/16/sixteen.py
2,586
3.625
4
#! /usr/bin/env python3 import os.path import advent_of_code as adv TEST1 = """ class: 1-3 or 5-7 row: 6-11 or 33-44 seat: 13-40 or 45-50 your ticket: 7,1,14 nearby tickets: 7,3,47 40,4,50 55,2,20 38,6,12 """ TEST2 = """ class: 0-1 or 4-19 row: 0-5 or 8-19 seat: 0-13 or 16-19 your ticket: 11,12,13 nearby tickets...
a3bb3d42fb1ccabcbe39170bf1aa84f94fe097e4
odormond/adventofcode
/2022/4/four.py
1,012
3.78125
4
#! /usr/bin/env python import advent_of_code as adv test_data = """\ 2-4,6-8 2-3,4-5 5-7,7-9 2-8,3-7 6-6,4-6 2-6,4-8 """ def to_pair_of_sections(data): return [ tuple( tuple(int(i) for i in section.split('-')) for section in pair.split(',') ) for pair in data.spl...
a1108f09e273037f9a5a3a8a97aea1bc170d1775
odormond/adventofcode
/2022/2/two.py
1,076
3.765625
4
#! /usr/bin/env python import advent_of_code as adv test_data = """\ A Y B X C Z """ ROCK = 1 PAPER = 2 SCISOR = 3 LOSE = 0 DRAW = 3 WIN = 6 POINTS = { ('A', 'X'): ROCK + DRAW, ('A', 'Y'): PAPER + WIN, ('A', 'Z'): SCISOR + LOSE, ('B', 'X'): ROCK + LOSE, ('B', 'Y'): PAPER + DRAW, ('B', 'Z'):...
c9d2bd840779e528a902e04bc2ff2e3bbd4c934b
odormond/adventofcode
/2018/15.py
5,701
3.625
4
#! /usr/bin/env python3 import itertools from advent import Inputs HP = 200 ATTACK = 3 MOVES = ((-1, 0), (0, -1), (0, 1), (1, 0)) source = Inputs(2018).get(15).text.strip().splitlines() def reading_order(obj): return obj.y, obj.x def hp_reading_order(obj): return obj.hp, obj.y, obj.x class Fighter: ...
4b05da3e7293cf66d28f879b8eb878e671b5afca
odormond/adventofcode
/2021/12/twelve.py
1,862
3.546875
4
#! /usr/bin/env python from pathlib import Path import advent_of_code as adv def to_graph(text): nodes, edges = set(), set() for line in text.splitlines(): a, b = line.split('-') nodes.add(a) nodes.add(b) edges.add(tuple(sorted((a, b)))) return nodes, edges test_data_1 =...
2699742da7500f56858626be9c6369a58c96f0ed
jyoshnalakshmi/python_examples
/file_handling/file_write.py
691
4.25
4
#-------------------------------------------------------------------- #Description : Writing into the file #Used Function : write() #Mode : 'w' #-------------------------------------------------------------------- with open('file1.py','w') as f: print("write(This is write function using 'w')"); f.write("Hey this ...
5346a75f558624f59a75c1e3eb2dd94d5287bcb0
mahmoudimus/jcsa
/PCMuta/src/jcmuta/base.py
2,376
4
4
""" It defines the simplified model to describe the basic element in C program, including: CTokenType, CToken {bool, char, int, float, str, complex, ...} """ import enum class CTokenType(enum.Enum): boolean = 0 character = 1 integer = 2 real = 3 complex_number = 4 keyword = 5 operator = 6 punctuate = 7 ast...
3d4713900b299430e21663e850932462facb6862
ViniciusDeep/Answers-URI-Online-Judge
/Answers/Python/1009.py
164
3.6875
4
# -*- coding: utf-8 -*- nome = raw_input() salario = float(input("")) vendas = float(input("")) SALARIO = salario+(vendas*0.15) print("TOTAL = R$ %.2f" %SALARIO)
bae26395d26654f22a581c7eb898f26d8c61e68e
ViniciusDeep/Answers-URI-Online-Judge
/Answers/Python/1006.py
150
3.75
4
# -*- coding: utf-8 -*- A = float(input("")) B = float(input("")) C = float(input("")) MEDIA = ((2*A)+(3*B)+(5*C))/(10) print("MEDIA = %.1f" %MEDIA)
f79c884302039481cfe72d6a105dfbc4c75dfca1
ViniciusDeep/Answers-URI-Online-Judge
/Answers/Python/1014.py
102
3.59375
4
# -*- coding: utf-8 -*- X = float(input()) Y = float(input()) media = X/Y print("%.3f km/l" %media)
5eaa17d6c7d0893cad2d1ea3c22af7ab0c816d7d
ViniciusDeep/Answers-URI-Online-Judge
/Answers/Python/1040.py
544
3.6875
4
# -*- coding: utf-8 -*- a, b, c, d = map(float, raw_input().split()) media = ((a*2) + (b*3) + (c*4) + (d*1)) / 10 print("Media: %.1f" % media) if media >= 7: print("Aluno aprovado.") elif media < 5: print("Aluno reprovado.") else: print("Aluno em exame.") e = float(input()) print("Nota do exam...
4e07e4b488d4429ef5796ae463418b8ea47baf8c
ViniciusDeep/Answers-URI-Online-Judge
/Answers/Python/1018.py
382
3.5625
4
# -*- coding: utf-8 -*- n = int(input()) print(n) print("%d nota(s) de R$ 100,00" % (n/100)) n %= 100 print("%d nota(s) de R$ 50,00" % (n/50)) n %= 50 print("%d nota(s) de R$ 20,00" % (n/20)) n %= 20 print("%d nota(s) de R$ 10,00" % (n/10)) n %= 10 print("%d nota(s) de R$ 5,00" % (n/5)) n %= 5 print("%d nota(s) de R...
712f416a8a247ee77ecb6e4c1f5564960cbbc3a3
erachlin/Chess_AI
/make_legal_moves.py
76,466
3.671875
4
class game(): def __init__(self, in_possible_moves, in_state): self.state = in_state self.possible_moves = in_possible_moves self.check = False self.wK_pos = 'e1' self.bK_pos = 'e8' self.wK_moved = False self.wKR_moved = False self.wQR_moved = False ...
788e3c7985f8edf14f9761842d6e43ae433794e4
ZuuVOKUN/Python_learning
/PycharmProjects/hillel_python/src/task_2.py
201
3.984375
4
""" Module for sample tasks """ def print_name(name): """ Function to print some name""" return print(' * ' + name + ' * ') my_name = input('Enter your name please! ') print_name(my_name)
0e0af6d9ab76f0b0bbb0a3b6e30345ba7de0127d
CarloRossi18/Exercicios_Programa
/carinha.py
1,417
3.859375
4
x = float(input('Digite x: ')) y = float(input('Digite y: ')) if 0 <= x <= 4 and 0 <= y <= 4: if 0 <= x < 1 and 0 <= y < 2: print('branco') elif (x - 3)**2 + (y -2)**2 < 0.25: print('branco') elif 3.5 <= x <= 4 and 3.5 <= y <= 4: print('branco') elif 3 < x <= 4 and 1.5 < y < 2.5...
51cb6426043e80d07236b54b1d791252d09c3d28
devplutus/Python3
/Programmers/삽입정렬.py
281
3.734375
4
array = [8, 4, 7, 1, 11, 5, 3, 2, 4, 9] for i in range(0, len(array)): for j in range(i, 0, -1): if(array[j] < array[j-1]): temp = array[j] array[j] = array[j - 1] array[j - 1] = temp else: break print(array)
8a42a5a4055526d69133fcfbde77c1569669f516
Advait-Pade/Game-development-in-python
/Tic_Tac_Toe/TTT.py
2,690
3.875
4
board = {'1':' ','2':' ','3':' ', '4': ' ','5':' ','6':' ', '7':' ','8':' ','9':' '} bkeys = [] for key in board: bkeys.append(key) #print(bkeys) def printboard(board): print(board['1']+"/"+board['2']+"/"+board['3']) print('-+-+-') print(board['4']+"/"+board['5']+"/"+board['6']) p...
d1676ad47f6d112f2d2729b35337cc87b9a46c3a
jvillalp/Leetcodepractice
/LeetCode/FindtheStartofLinkedListCycle.py
740
3.921875
4
#https://leetcode.com/problems/linked-list-cycle-ii/ # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: #basially you want to see if a pointer is pointing to someth...
7b613d07ccc5a5f594eebfd6b1080e25e655b203
mlibos/sudoku_solver
/sudoku.py
5,056
3.875
4
import math import numpy import random import time class sudoku: #a sudoku objective contains information on difficulty, rows, columns, boxes def __init__(self,name,difficulty,rows,columns,boxes): self.name = name self.difficulty = difficulty self.rows = rows self.columns = columns self.boxes = boxes def...
10b02c26c2f09f703ce16eab5d8a0183677d8fb2
dhiraj1996-bot/Code-a-Thon
/list.py
502
4.125
4
#Question 2 list1 = ["aman","raj","ayush","gracie"] list2 = ["akshay","rakesh","raj","ram"] #creating a function to check for duplicate values and then removing them #and creating list without the duplicate values def find_common(list1,list2): for x in list1: for y in list2: if x == y : ...
7caf5f692788076fac58c7f15a007e71068b3876
kabitakumari20/calculator
/giy.py
3,429
4.125
4
import tkinter from tkinter import * root=tkinter.Tk() root.resizable(0,0) root.title("**WELCOME IN CALCULATOR***") e=Entry(root,width=40,bg="blue") e.grid(row=0,column=0,columnspan=3,padx=20,pady=20) e.insert(0," ") def button_click(number): current=e.get() e.delete(0,END) e.insert(0,str(current)+str(n...
dd52c000cd4d5d7a021449a7451de4fa84047042
nkuhta/Python-Data-Structures
/2. Files/average_spam_confidence.py
938
4.125
4
############################################################## ######### compute the average spam ############ ############################################################## # X-DSPAM-Confidence:0.8475 # Prompt for user input filename then search for the number and average fname=input('Enter file...
fc07f7be472a28015c2b45125eec4141519f5dea
nkuhta/Python-Data-Structures
/4. Dictionaries/day_of_week.py
623
3.734375
4
################################################################################ ################# Add up days of week for email ################ ################################################################################ # filename name = input('input filename: ') handle = open(name,'r') # d...
17601497f9bb20611bbca1bec0f8dcd40767db54
nitschmann/python-lessons
/07_dictionaries/exc_47.py
616
4.25
4
# dictionaries - exercise 47 country_rivers = { "China": "Yangtze", "China": "Yangtze", "China": "Ob-Irtysh", "Germany": "Elbe", "Germany": "Oder", "Germany": "Rhine", "USA": "Missouri", "USA": "Yukon", "USA": "Colorado" } country_river_li...
d51eecb6482c02653e0d0b529f59d9807ff79d60
nitschmann/python-lessons
/08_functions/exc_67.py
177
3.578125
4
# functions - exercise 67 def show_magicians(magicians = []): for magician in magicians: print(magician) show_magicians(["magician 1", "magician 2", "magician 3"])
b4846a2a1d6db0d4cbc3bb5a9097c509af4484a5
nitschmann/python-lessons
/04_list_manipulations/exc_18.py
374
4.25
4
# list manipulations - exercise 18 cities = ["St. Petersburg", "Moscow", "Buenos Aires", "New York", "Stockholm", "Amsterdam"] print(cities) print(sorted(cities)) print(cities) print(sorted(cities, reverse = True)) print(cities) cities.reverse() print(cities) cities.reverse() print(cities) cities.sort() pri...
cbbd1e84d2acb78d6419573b3acb15afce8e0ff3
nitschmann/python-lessons
/05_working_with_lists/exc_28.py
100
3.796875
4
# working with lists - exercise 28 for number in range(1, 11): cube = number**3 print(cube)
b4f4fbed31914ded48d438d0868debf447048ef1
nitschmann/python-lessons
/05_working_with_lists/exc_26.py
107
3.875
4
# working with lists - exercise 26 for number in range(1, 21): if number%2 != 0: print(number)
058596c252eaf726187130550b12f9a293035d6f
nitschmann/python-lessons
/05_working_with_lists/exc_30.py
335
4.53125
5
# working with lists - exercise 30 my_pizzas = ["mista", "salami", "pepperoni"] friend_pizzas = my_pizzas[:] my_pizzas.append("parma") friend_pizzas.append("magaritha") print("My favorite pizzas are:") for pizza in my_pizzas: print(pizza) print("\nMy friends' favorite pizzas are:") for pizza in friend_pizzas: ...
ceaac866eba0a476eeb09289a3d0910e0c66dbe8
tnstar/leetcode
/ReverseWord.py
273
3.5625
4
''' @author: TNSTAR ''' class Solution: # @param s, a string # @return a string def reverseWords(self, s): temp = s.split() temp = temp[::-1] return " ".join(temp) sol = Solution() print sol.reverseWords("the sky is blue")
0bc0872f7ffc80db3f430769a2966f77524efab2
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio070.py
290
3.53125
4
ageNinja = 32 ageRodrigo = 25 result = ageNinja == 32 and ageRodrigo == 15 print(result) # o resultado e falso porque com o operador AND e necessario que as duas condicoes # sejam verdadeiras para que o resultado seja verdadeiro, se tiver uma somente falsa # o resultado sempre sera falso
c23ffb1f2fcaabc3b0da98b6069fa6d853c1bc17
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio079.py
296
3.8125
4
ageNinja = 17 if ageNinja >= 18: print("Voce e velho o suficiente, ja pode votar") else: print("Voce e muito novo para votar") # aparece a segunda mensagem na tela porque a comparacao do if e falsa, fazendo # com que o compilador pule a linha ou bloco logo abaixo do if indo para o else
b5ce86649d75f4c46c2c960eac08f36aa14fe243
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio089.py
351
3.71875
4
recheiosPizza = ["mussarela", "tomate", "calabresa", "oregano", "farinha", "molho"] recheiosSolicitados = ["tomate", "molho", "salsicha"] for recheioSolicitado in recheiosSolicitados: if recheioSolicitado in recheiosPizza: print("adicionando " + recheioSolicitado) else: print("nao temos " + rec...
d540ff00a7a841f725e9507ce330cdc616a7498f
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio014.py
189
3.71875
4
arrayList = ["primeiro", "segundo", "terceiro", "quarto", "quinto"] print("Antes --> " + str(arrayList)) arrayList.insert(3, "no_meio_da_bagaça") print("Depois --> " + str(arrayList))
a4b00a1099405af06516d53b33c116a5856870a4
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio082.py
490
3.546875
4
ageNinja = 12 if ageNinja < 4: value = 0 elif ageNinja < 18: value = 5 elif ageNinja < 65: value = 10 else: value = 5 print("Seu custo de admissao e R$ " + str(value)) # como a verificacao esta na sequencia correta, do valor menor para o maior, ela # seguira a verificacao dos intervalos, por isso qua...
4c121de6f775600d6b0569f712f8bdc5a8262fce
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio097.py
212
3.640625
4
character = {'posicao_x': 0, 'posicao_y': 15, 'velocidade': 'medio'} print(character) del character['velocidade'] print(character) # o comando del remove a chave e o valor de acordo com a chave que e passada.
2c8c7529755c5d3b5ffed82e384315ffaf04bb40
atozzini/CursoPythonPentest
/PycharmProjects/ExerciciosGrupo/exercicio128.py
830
4
4
alpinistas = {} validador = True while validador: alpinista = raw_input('\nQual seu nome: ') montanha = raw_input('Qual montanha gostaria de escalar: ') alpinistas[alpinista] = montanha maisUm = raw_input('Outro alpinista gostaria de responder?(s/n)') if maisUm == 'n': validador = False ...
157766ef81fdaacd546e5763cb41a992abfc7f80
Algorithm-Class/Python-Training
/programs/hello.py
137
4.125
4
a=2; b=3; print(a+b) # CHeck number is less than 5 if ( a<5) : print("number a ",a) print("is less than 5"); print("after if")
75e55498f3bda41e0b18b92f4d11464093498391
Algorithm-Class/Python-Training
/programs/exp1.py
323
3.828125
4
a=int(input("enter number")) b=int(input("enter number")) try: c=a/b; print("res=",c) except TypeError: print("TypeError ....") except ZeroDivisionError: print("ZeroDivisionError") except ValueError: print("ValueError") else: print("no exception") finally : print("I am here") print("Hello")...
8da6003aa529b416cd9e834a98eabe5cf86757d1
Algorithm-Class/Python-Training
/programs/trd1.py
728
3.75
4
import threading import time; class thread1(threading.Thread) : def __init__(self,trdid,start,end): threading.Thread.__init__(self) self.tread_id=trdid; self.start=start self.end=end def run(self): add(self.start,self.end) def add (start,end): i=self...
6e0334242a876ac469a67f8aa80db329d7e909a1
codecookinging/Basic_Codeing_for_CNN
/Forward_backward/activate.py
918
3.53125
4
import numpy as np import matplotlib.pyplot as plt def sigmoid(x): A = 1/(1+np.exp(-x)) return A, x def relu(x): A = np.maximum(0, x) return A, x def leaky_relu(x): A = np.maximum(0.01*x, x) return A, x def tanh(x): A = np.tanh(x) return A, x x = np.linspace(-10, 10, 100) A_sig...
19ad72f52d8da3bf85697f3ba28f6a9d7cae924a
gabriel-goulart/controleAcesso
/moduloGateway/avaliador/Operacao.py
984
3.71875
4
class Operacao: def igual(self, valorRegra, valorAtual): print("Operação: IGUAL") if valorRegra == valorAtual: return True else: return False def diferente(self, valorRegra, valorAtual): print("Operação: DIFERENTE") if valorRegra != valorAtual: ...
ac4e8abac509ed5e8d47841868a97ddb1050ee66
AyahAlrifai/turtle
/12.py
308
3.5
4
import turtle import random import math win=turtle.Screen() win.bgcolor("black") win.colormode(255) pen0=turtle.Turtle() pen0.pensize(3) pen0.color("#DD8100") pen0.fillcolor("#DD8100") pen0.begin_fill() for x in range(24): pen0.circle(150) pen0.left(15) pen0.end_fill() turtle.done()
52fdfd224d9f175aff9370ff85f44eb44f175a78
Ntims/Nt_Python
/실습20190607-20194082-김민규/PDB10.py
754
3.609375
4
import sqlite3 connect = sqlite3.connect("sales.db") if (connect is None): print("sales.db 를 여는데 실패했습니다.") exit() connect.row_factory = sqlite3.Row cursor = connect.cursor() cursor.execute("select * from saleitems") rows = cursor.fetchall() print("[삭제전]\t품명\t판매수량\t재고") for row in rows: pr...
eb07732909e92ded2da3b6f8a853e879e4313b13
Ntims/Nt_Python
/실습20190419-20194082-김민규/P0601-2.py
224
3.6875
4
numbers = [11, 33, 55, 39, 21, 9, 41, 13] for num in numbers: if (num % 2) == 0: print("리스트는 짝수를 포함합니다.") break else: print("리스트에는 짝수가 없습니다.")
7728b6caa4403ef9898f0ae6c8bd06ea4ab7d4dd
Ntims/Nt_Python
/실습20190419-20194082-김민규/P0611-1.py
168
3.703125
4
dan = 1 while dan <= 9: num = 1 while num <= 9: print("%d*%d=%d" % (dan, num, (dan * num))) num = num + 1 dan = dan + 1 print()
0ab6b44d136041bc16f08f1fa4f1e76511cf99e2
Ntims/Nt_Python
/실습20190510-20194082-김민규/P0902.py
258
3.734375
4
heroes = ["아이언맨","토르","헐크","스칼렛 위치"] def myindex(sourceList, item): sn = len(sourceList) for i in range(sn): if item == sourceList[i]: return i return -1 print(myindex(heroes,"헐크"))
176a4b1c9ae3026deef18b839ce5c1744cba351b
Ntims/Nt_Python
/실습20190419-20194082-김민규/P0601-1.py
274
4.3125
4
for letter in "Python": print("Current letter :",letter) print() fruits = ["banana", "apple", "mango"] for fruit in fruits: print("Current fruit:",fruit) print("Using Index") for index in range(len(fruits)): print("Current fruit:", fruits[index])
ec962fffe9eb9ab7a1317d1ccd56c038509f035c
sahil150395/Blind-Auction
/main.py
847
4
4
from replit import clear from art import logo #HINT: You can call clear() to clear the output in the console. print(logo) bidder_dict = {} def bidders(bidder_name, bid_amt): bidder_dict[bidder_name] = bid_amt def bid_winner(): winner = "" max_bid = 0 for bidder in bidder_dict: if bidder_...
c55a1f6a822e777a7d0a2a910a9e190fd4061ee5
alteralver/TrigonometricFunctions
/FunctionTest.py
2,520
3.53125
4
""" @Project :TrigonometricFunctions-main @File :Operation_test.py @Author :ZouXuan @Date :2021/6/30 14:14 """ import unittest from TriFunctions.arcsin import asin from TriFunctions.arctan import atan from TriFunctions.cos import cos from TriFunctions.sin import sin class TestFunc(unittest.TestCase): # 测试类 ...
fc7970b457c9a0110137226c51378a02af08e156
ALXScript/CSCI-154-Project
/Files/main.py
2,286
3.640625
4
#Main page for the application, including UI import crater_math as cmath import calculations as calc import our_tools as tool import references as rf #boolean for verifying user data exit = False #UI while loop while exit != True: #String variable for the main menu UI str_UI = "\nMenu: \nA: Simulate Your Own ...
23501b076dfd13053a1f9dafff18caa7a7b60bff
vijaykumar10022/APSSDC-Django-Batch-4
/packages and modules(04-08-2020)/myModule.py
548
3.515625
4
class Calsi: def add(n1,n2): return n1+n2 def sub(n1,n2): return n1-n2 class Math: def power(bval,exval): return bval**exval def isEven(val): if val%2==0: return True return False def isOdd(val): if val%2!=0: return True...
0d11ed01285d6598ec84c5ebf3097f140be6f2a5
vijaykumar10022/APSSDC-Django-Batch-4
/packages and modules(04-08-2020)/single.py
220
3.546875
4
class ClassA: a,b=10,20 def display(): print("i am form classA") class ClassB(ClassA): c,d=23,78 def show(): print("i am from classB") obj=ClassB print(obj.d) obj.display()
dcad3e5eca9794f23244aa5967726390bf427d9e
cnorrisf18/compscichloe
/c15-turtles.py
1,735
3.5
4
import turtle wn=turtle.Screen() c=turtle.Turtle() c.color('blue') def applyRules(leftChar): """ apply rule transforming leftChar to rightStr """ rightStr = "" if leftChar == 'H': rightStr = 'HFX[+H][-H]' # Rule 1 elif leftChar == 'X': rightStr = 'X[-FFF][+FFF]FX' # Rule 2 elif l...
c0aa654b4d26e4329814a177a15b873e166de3b3
Arturo0911/AutomationTraining
/DataVisualitation/Data.py
1,092
3.984375
4
#!/usr/bin/python3 import matplotlib.pyplot as plt import numpy as np def main(): # creating data to plot in the chart # in this case we've built a exponential chart x = np.linspace(0,5,11) y = x ** 2 #plt.plot(x,y, 'r-') #plt.xlabel("axis") #plt.ylabel("ordenates") #plt.title(...
57729616b4299e9f699ae60c295fc5aeaf52b823
Arturo0911/AutomationTraining
/DataStructure/Data.py
794
3.984375
4
#!/usr/bin/python3 """ @description -> binaryTree: datastructure which contains values represents nodes connected by edges is a non linear datastructure Properties: - One node is represented as Root Node - Each other node associat...
2259528e78ea92e3b074f54438e62b0ca30c4b97
rodrigojgrande/python-mundo
/desafios/desafio-037.py
1,020
4.3125
4
#Exercício Python 37: Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão: 1 para binário, 2 para octal e 3 para hexadecimal. numero = int(input('Digite um número inteiro:')) print('Escolha uma das bases para conversão:') print('[ \033[1;33m1...
0273bfcd36fb3155e3affb97bac7ac18345b3fa5
rodrigojgrande/python-mundo
/desafios/desafio-103.py
613
4.1875
4
#Exercício Python 103: Faça um programa que tenha uma função chamada ficha(), que receba dois parâmetros opcionais: o nome de um jogador e quantos gols ele marcou. O programa deverá ser capaz de mostrar a ficha do jogador, mesmo que algum dado não tenha sido informado corretamente. def ficha(nome='<desconhecido>', gol...
30a64779a2aeb830ef34fdbaae0567c8a74f281d
rodrigojgrande/python-mundo
/desafios/desafio-009.py
656
4.15625
4
#Exercício Python 9: Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada. x = int (input('Digite um número para ver sua tabuada: ')) print('-' * 12) print('{} X {:2} = {:2}'. format(x, 1, x*1)) print('{} X {:2} = {:2}'. format(x, 2, x*2)) print('{} X {:2} = {:2}'. format(x, 3, x*3)) pr...
c29e337748ebb6a44c828b32230cba45d23a2f6e
rodrigojgrande/python-mundo
/desafios/desafio-002.py
263
3.96875
4
#Exercício Python 2: Crie um script que leia o dia, o mês e o ano de nascimento de uma pessoa e mostre uma mensagem com a data formatada dia = input('Dia:') mes = input('Mês:') ano = input('ano:') print('Você nasceu no dia',dia,'/',mes,'/',ano,'. Correto?')
ef0c38b2e597863d5945876107c64ea55a6e6d23
rodrigojgrande/python-mundo
/desafios/desafio-084.py
1,066
4.09375
4
#Exercício Python 084: Faça um programa que leia nome e peso de várias pessoas, guardando tudo em uma lista. #No final, mostre: #A) Quantas pessoas foram cadastradas. #B) Uma listagem com as pessoas mais pesadas. #C) Uma listagem com as pessoas mais leves. princ = list() temp = list() mai = men = 0 while True: t...
2b2625fe04bb29adab13f09c27b13bb322f3800a
rodrigojgrande/python-mundo
/desafios/desafio-094.py
2,103
3.9375
4
#Exercício Python 094: Crie um programa que leia nome, sexo e idade de várias pessoas, guardando os dados de cada pessoa em um dicionário e todos os dicionários em uma lista. No final, mostre: # A) Quantas pessoas foram cadastradas # B) A média de idade # C) Uma lista com as mulheres # D) Uma lista de pessoas com i...
723d340700ca905e39347669790211a631d58e4d
rodrigojgrande/python-mundo
/desafios/desafio-021.py
296
3.53125
4
#Exercício Python 21: Faça um programa em Python que abra e reproduza o áudio de um arquivo MP3. import pygame pygame.init() pygame.mixer.music.load('ex021.mp3') pygame.mixer.music.play() pygame.event.wait() input('Choice is an illusion, created between those with power, and those without')
25d0ab0c0367387131fa13c0167970936a056d0f
rodrigojgrande/python-mundo
/desafios/desafio-060.py
435
4.1875
4
#Exercício Python 060: Faça um programa que leia um número qualquer e mostre o seu fatorial. Exemplo: #5! = 5 x 4 x 3 x 2 x 1 = 120 from math import sqrt fatorial f = factorial(x) x = int(input('\033[1;34mDigite um número para calcular seu Fatorial:\033[m ')) print('Calculando {}! = '.format(x), end='') total = x whi...
7f450c58c03dd22b1f16d5b73bc5eb9642aae3cc
rodrigojgrande/python-mundo
/desafios/desafio-029.py
637
4
4
#Exercício Python 29: Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite. print('Vou pensar em um número entre 0 e 5. Tente adivinhar... ') velocidade = int(input('Qual a velocidade at...
0a62cedf249bbb68c169c046988e965d9c006927
rodrigojgrande/python-mundo
/desafios/desafio-093.py
1,253
4.03125
4
#Exercício Python 093: Crie um programa que gerencie o aproveitamento de um jogador de futebol. O programa vai ler o nome do jogador e quantas partidas ele jogou. Depois vai ler a quantidade de gols feitos em cada partida. No final, tudo isso será guardado em um dicionário, incluindo o total de gols feitos durante o ca...
cb4677bbbe8665c04dffdbd96cc034ddede64ad3
jfjlaros/tssv
/extras/annotate/annotate.py
3,458
3.5
4
"""Convert a csv files containing alleles and counts to HGVS descriptions of alleles and single variants. Also report statistics about the variant types. The input file is typically one of the output files of tssv. """ from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter from collections import ...
a5284b00566b15dbd4b352d23e27d2561b00690a
pocketgroovy/computer_vision
/CV/PS4/ps04/ps4.py
20,290
3.78125
4
"""Problem Set 4: Motion Detection""" import numpy as np import cv2 def show_image(img, img2=None): if img2 is not None: cv2.imshow("img", np.hstack((img, img2))) else: cv2.imshow("img", img) cv2.waitKey(0) def normalize_and_scale(image_in, scale_range=(0, 255)): """Normalizes and sc...
dee4225d946d1ac8399922437cfb51495525c6d2
TheBeigeProgrammer/Turing-Web
/Backup Folder (do not touch!)/Backup 1/splittest.py
3,312
3.515625
4
#Import the library for splitting the strings import re def replaceFunctions(fString): #===========Split String Into Array============ aSplit=re.split('(\n)', fString) #Split on enter for iCounter in range (0,len(aSplit)): aSplit[iCounter] = re.split('(")',aSplit[iCounter]) #Split on quotation...
7523c61d37b851f3b243e1320d35f43696870bd9
zsusswein/negative_binomial
/tests/test_negative_binomial.py
1,340
3.59375
4
''' Unit tests for negative binomial fitting ''' import unittest from context import * class BadInputTest(unittest.TestCase): ''' Class to test bad inputs ''' def test_r_param_neg(self): ''' r_derv should fail with negative values ''' with self.assertRaises(ValueError): ...
c6b204891b2357bc5773f4f8bcb519277bfb24bd
VitaliyYa/stepik-python
/1st_week/1.12-5_var-2.py
594
4.3125
4
""" task link: https://stepik.org/lesson/5047/step/5?unit=1086 Напишите программу, которая получает на вход три целых числа,по одному числу в строке, и выводит на консоль в три строки сначала максимальное, потом минимальное, после чего оставшееся число. На ввод могут подаваться и повторяющиеся числа. """ x = sorted([...
878c5917c220c5ff23138345d3f7245908589c47
VitaliyYa/stepik-python
/2nd_week/2.6-7.py
1,310
3.703125
4
""" Напишите программу, которая считывает с консоли числа (по одному в строке) до тех пор, пока сумма введённых чисел не будет равна 0 и сразу после этого выводит сумму квадратов всех считанных чисел. Гарантируется, что в какой-то момент сумма введённых чисел окажется равной 0, после этого считывание продолжать не нуж...
f9aa373d5928ace3f4b80cc76fb891df82fc9efe
VitaliyYa/stepik-python
/3rd_week/3.2-7.py
368
4.15625
4
""" link task: https://stepik.org/lesson/3373/step/7?unit=956 """ # Считайте, что функция f(x) уже определена выше. Определять её отдельно не требуется. n = int(input()) dic = {} for n in range(0, n): n = int(input()) if dic.get(n) == None: dic.setdefault(n, f(n)) print(dic[n])
a558f1322ed7d6f0c57939923ec7b45344937fdc
Chandan-97/gldb
/hackerearth/p21.py
2,054
3.65625
4
# Because You look Gorgeous in Black # Ref : https://www.geeksforgeeks.org/longest-common-subsequence-dp-4/ # Dynamic Programming implementation of LCS problem def lcs(X , Y): # find the length of the strings m = len(X) n = len(Y) # declaring the array for storing the dp values L = [[None]*(n+1) for i in range...
3792c6084c50c2faa6e39283b27ab7858618c37c
1MahdiR/AP_git_hw
/my_scripts/Calculator.py
85
3.5625
4
print("Hello World!") def divide(a, b): return a / b def mul(a, b): return a * b
98d0a52eebe1f1e7900ead7bebaefb8b2ebd2752
RAKUZ4N/HelloPython_1
/1.occupation/hellopython_1.7.py
559
3.78125
4
# PROBLEM 8: # Найдите, какой процент этого столетия мы прожили: # формула расчета процентов # (a/b)*100 # где a-прожитые года # b-сколько нужно(тк. это столетие, b-100) my_age = 18 print("Мне", my_age, "лет") years = 83 print("Я хочу прожить", years, "года") res = (my_age / years) * 100 print(res, "процентов я прож...
ba3feed540cb189ed77fdf8266f2a639e76fb149
RAKUZ4N/HelloPython_1
/1.occupation/hellopython_1.4.py
1,490
4.28125
4
#Создайте 4 условия: #1. Число А больше В но меньше С. #2. Результат деления по модулю числа 7 на 3 умножить на 4.8. #3. Создать два разных выражения которые равны друг другу. #4. Создать 2 выражения которые не равны друг другу. #Первое задание: print("1. Число А больше В но меньше С.") A = 50 print("A = 50") B = 33...
d299731c70b65190e427f0aa4ffa75f833a1505e
RAKUZ4N/HelloPython_1
/4.occupation/Цикл_4.4.py
400
4.03125
4
# 4. Напишите код, который выведет на экран список языков с нумерацией. # languages = ['go', 'java', 'php', 'python', 'javascript', 'ruby'] # Вывод: # 0 go # 1 java # 2 php # 3 python # 4 javascript # 5 ruby languages = ['go', 'java', 'php', 'python', 'javascript', 'ruby'] for i in range(len(languages)): prin...
bf01b625f245b45164d8c1610ed95ab6becd4365
RAKUZ4N/HelloPython_1
/1.occupation/hellopython_1.6.py
628
4.1875
4
# PROBLEM 9: # Создать 2 переменные. # В первой год вашего рождения, Во второй # 2020 год # посчитайте сколько лет вам должно быть через 2 года/и сколько лет вам было два года назад my_birthyears = 2002 print("Я родился в", my_birthyears, "году") this_year = 2021 print("Текущий год", this_year) res = this_year + 2...
120b6cb44008a2c6ce31ce73040c3c7590c276d0
RAKUZ4N/HelloPython_1
/5.occupation/TupleLists_5.6.py
571
3.96875
4
# Взять Лист №1 и посчитать сколько раз там встречается имя "Jack". # ЛИСТ №1: # NAMES = ['JACK', 'JIMMY', 'JACKSON', 'JHON', 'JACKSON', 'JHON', 'JIMMY', # 'JACKSON', 'JHON','JACK', 'JIMMY', 'JACK', 'JACKSON', 'JHON', 'JACKSON', 'JHON','JACK', # 'JIMMY', 'JACK', 'JACKSON', 'JHON',] NAMES = ['JACK', 'JIMMY', 'JACKSO...
8e065af488a6aac9384351faaf749d2d849a160c
RAKUZ4N/HelloPython_1
/3.occupation/Строки_3.3.py
622
3.796875
4
# Problem 11: # Взять строку №3 и сделать каждое её слово с большой буквы. # Строка №3: # 'хакеры слили в сеть данные пакистанской энергетической компании k-Electric' string = 'хакеры слили в сеть данные пакистанской энергетической компании k-Electric' print(string) print("Давайте сделаем каждое слово с большой букв...
91d7b234c678b208c72ff61e43ddda24ee189ed0
RAKUZ4N/HelloPython_1
/4.occupation/Цикл_4.3.py
353
4.125
4
# 3. Напишите код, который берёт цифру 7, умножает саму на себя же 5 раз. number = 7 print("У нас есть число", number, "надо умножит её саму на себя 5 раз") for i in range(6): print(number) number *= 7 print("Программа завершилась!!!")
6d5ac02a13a5b7a185fb96c5db94a2b0b4fa3fc0
nelsonjr86/GitHub
/Python/Exercicio/8_6.py
393
3.890625
4
def find_min_max(): user_responses = [] while True: try: user_input = input("Digite um número: ") print ("Digite break para sair.") user_input = int(user_input) except: break user_responses.append(user_input) print ("Máximo: ", max(user...
f6733d302c3a8382c255e0f61b216fc2d7b38b41
nelsonjr86/GitHub
/Python/Exercicio/2_3.py
141
3.9375
4
horas = int(input('Enter numero de horas: ')) valorhoras = float(input('Enter valor da hora:')) print ('Salário Bruto :', horas*valorhoras)
8918360bfe7ef170cc39e0edb60a8f67f0d08a42
nelsonjr86/GitHub
/Python/Exercicio/10_3.py
1,304
4.03125
4
file_name = input("Which book? ") # 'huck.txt' book = open(file_name, 'r') def prepare_text(raw_book): ''' Take file handler as input. Chop off the project Gutenberg header and footer. Remove non-alpha characters. Convert all letters to lowercase and finally return the entire book as a singe string ''' ...
5017916bee97d2567d2d1c010ddd8ddaff34875c
nelsonjr86/GitHub
/Python/Exercicio/7_3.py
577
3.5625
4
import sys dados_usuario = input("Digite o nome do arquivo: ") if dados_usuario == "na na boo boo": print ("NA NA BOO BOO TO YOU - You have been punk'd!") sys.exit(0) try: user_file = open(dados_usuario, 'r') except: print ("O arquivo não pode ser aberto: " + dados_usuario) sys.exit(1) Lista_linhas ...
a7eba94e5b590d732c9cc5a07a3840be87e84e16
LeeJoonkyu/gitreview
/dev/P.rogramming_python_lab1-master/lab2/groupper.py
1,001
3.65625
4
from random import randint class Groupper(object): def __init__(self, names): self.names = names self.dict = {} def random_group(self, group_count): for k in range(1,group_count+1): self.dict.setdefault(k) self.dict[k] =[] for k in range(1, group_count+1):...
7e7f101f5b8a011c6c36176a3213d42c302e3fca
joeraven0/DLA_progress
/#2_py38_Open&save_JSON.py
827
3.609375
4
import json import sys try: #Open file and read json with open('data_file.json') as f: data = json.load(f) checkinday = data['checkinday'] checkintime = checkinday['20200411'] checkoutday = data['checkoutday'] checkouttime = checkoutday['20200410'] print(checkinti...
cdab8b213b34d63ca7a3a7df8d5e88e5dbabe72c
Pierre-damase/Alignement-seq-reads
/bwt/files/read_fasta_files.py
2,086
3.65625
4
""" Ce module permet de lire les deux fichiers fasta passés en paramètre. - Le fichier <reference>.fasta de la séquence de référence - Le fichier <reads>.fasta des reads Le module permet de: - Lire les fichiers fasta - Pour la référence Renvoyer la séquence au format str - Pour les reads Renvoye...
cd50058520ea1246e7445a62ce6703b19f716528
jihongeek/Algo
/baekjoon/5637.py
398
3.984375
4
from sys import stdin longest = "" inputText = stdin.read().strip() newText = "" for char in inputText: if not ("A" <= char <= "Z" or char == "-" or "a" <= char <= "z"): newText += " " else: newText += char for word in newText.split(): isWord = True if word == "E-N-D": break ...
f2850768e42613be3bd4202353e34eb91b1aded7
jihongeek/Algo
/baekjoon/2362.py
235
3.53125
4
inputlist =[] for i in range(9): inputlist.append(int(input())) maximum = int(inputlist[0]) for i in inputlist: if int(i) > maximum: maximum = int(i) print("%d"%(maximum)) print("%d"%(inputlist.index(maximum)+1),end="")
db4f2b877e190091e9f56ce0c310a32376050495
jihongeek/Algo
/baekjoon/1967.py
1,084
3.671875
4
from sys import stdin """ dfs를 통해 각 노드에서 리프노드까지의 거리들을 구하고, 각 노드마다 가장 긴 두거리의 합을 지름으로 하여 최댓값을 구한다. """ def dfs(parent,weight): max_distance = 0 if len(tree[parent]) == 0: return weight for child,child_weight in tree[parent]: distance = dfs(child,child_weight) node_distances[...
4dd628023b5d532026f5e5c37cf6fe75b5358b5d
jihongeek/Algo
/baekjoon/1834.py
92
3.546875
4
n = int(input()) sumnum = 0 for i in range(1,n): sumnum = sumnum + (i*n+i) print(sumnum)
7d4700b5aa228836fe3680c3d92e950a5fd65996
jihongeek/Algo
/baekjoon/2908.py
166
3.8125
4
q = input().split() a = int("".join(reversed(list(q[0])))) b = int("".join(reversed(list(q[1])))) if a > b: print(a) elif a < b: print(b) else: print(a)
d3e41fe944fd5a3c6e62e8f5fa75f8aa80e247ac
jihongeek/Algo
/baekjoon/1259.py
255
3.734375
4
while True: inputstr = input() if inputstr == "0": break isPalindrome = "yes" for i in range(int(len(inputstr)/2)): if inputstr[i] != inputstr[-i-1]: isPalindrome = "no" break print(isPalindrome)
6efd7abb2ddb79175cc5fcf9f3cf8f3d031bcd1c
jihongeek/Algo
/baekjoon/2920.py
277
4.34375
4
inputlist = input().split() ascending = ["1","2","3","4","5","6","7","8"] descending = list(reversed(ascending)) if inputlist == ascending: print("ascending",end="") elif inputlist == descending: print("descending",end="") else: print("mixed",end="")