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
f9e1251d704a08dc1132f4d54fb5f46fb171766e
BjornChrisnach/Edx_IBM_Python_Basics_Data_Science
/objects_class_02.py
2,998
4.59375
5
#!/usr/bin/env python # Import the library import matplotlib.pyplot as plt # %matplotlib inline # Create a class Circle class Circle(object): # Constructor def __init__(self, radius=3, color='blue'): self.radius = radius self.color = color # Method def add_radius(self, r): ...
5898bbd61b079321b016fbe5938f1a9e065c0d79
lcbc-epfl/comp_chem_py
/src/comp_chem_utils/mysql_tables.py
3,365
3.625
4
#!/usr/bin/env python """ Definitions of classes to work with molecular data. The mol_info_table class is used to store and manipulated information about a molecule. The mol_xyz_table class is used to store and manipulated the xyz coodinate of a molecule. The functions defined here are basically wrappers to MySQL e...
a0272dc35dbfd3bafa2c249db3ab67a0fef0e4bf
lcbc-epfl/comp_chem_py
/src/comp_chem_utils/utils.py
11,532
3.5625
4
#!/usr/bin/env python """Collection of simple functions useful in computational chemistry scripting. Many of the following functions are used to make operations on xyz coordinates of molecular structure. When refering to ``xyz_data`` bellow, the following structures (also used in :py:mod:`~comp_chem_utils.molecule_dat...
472a53f67d8c057ced1eb67feeb4e8e8bc992d92
chrishuynhc/scripting-practice
/guessing.py
820
3.859375
4
#Guessing Game import random randomNumber = random.randint(-100,100) guess = -1 count = 0 allowedGuesses = 7 print ("Guess a number between 100 and 200. You are allowed 7 guesses.") while guess != randomNumber and count < allowedGuesses: count = count + 1 countString = str(count) print ("Enter guess "...
7983852dbc9b3c11d23eb03e16e7771049ff09fe
cirnelle/TwitterML
/_utilities/remove_stopwords.py
1,445
3.5625
4
__author__ = 'yi-linghwong' ############### # single method to remove stop words from a list of tweets ############### import sys import itertools from sklearn.feature_extraction import text lines = open('../stopwords/stopwords.csv', 'r').readlines() my_stopwords=[] for line in lines: my_stopwords.append(line.r...
dfa1d88fc9e9dfc69dc8516e80a6e942e2a53beb
houssamzenati/HTTP-Traffic-Monitoring
/simulator.py
7,625
3.796875
4
# -*- coding: utf-8 -*- """ Created on Wed May 3 16:34:04 2017 @author: Houssam """ import datetime import time from datetime import timedelta from parsing import CHECKING_TIME, TRAFFIC_LIMIT # SIMULATOR PARAMETERS UTC = '+0100' # Paris UTC # If we write a line every time_reference=SPEED_LIMITATION, ...
d464f14a2220f85994965b12f35a8fd498b4f0c6
phayv/Python
/Real Life Sciences/coding_interview.py
1,904
4.03125
4
import re #regular expressions import os #system and files def get_frequency_of_words(input_file, output_file): """ Assuming nothing wrong with file like the problem suggests. This returns the frequency of all words in the file. """ freq = {} """ open file and lowercase everything to make ...
3135ed25fbeae040167f3cd17d421ddb74afbcf4
paulovitornovaes/Prog1
/uri/2651 - link.py
113
3.734375
4
entrada = str(input()).lower() if "zelda" in entrada: print("Link Bolado") else: print("Link Tranquilo")
2d5eb9c8b73cf412536e1ce1b2637839201b987b
Rossel/Solve_250_Coding_Challenges
/chal128.py
165
4.03125
4
x = [list(range(5)), list(range(5,9)), list(range(1,10,3))] if x[0][-1] > 3: print("True!") elif x[1][-1] < 9: print("False!") else: print("None!")
fd63f1f7eedf20a760744bc7c9a7dd0d0a049ed8
Rossel/Solve_250_Coding_Challenges
/chal248.py
126
3.546875
4
import itertools list1 = [1, 2, 3] list2 = [4, 5] result = list(itertools.chain(list1, list2)) print(result)
0cb9b3a92ae79da1e2aca06cabd4b2ec33929b9b
Rossel/Solve_250_Coding_Challenges
/chal154.py
146
4.0625
4
for i in range(5,25,5): if 10 <= i <= 21: print(i * range(5,25,5)[-2]) else: print("Outside!") else: print("The end!")
82db0d781c9e85f18b647e13d3c7bdfeebb1759d
Rossel/Solve_250_Coding_Challenges
/chal229.py
398
3.5
4
import re s = "Bitcoin was born on Jan 3rd 2009 as an alternative to the failure of the current financial system. In 2017, the price of 1 BTC reached $20000, with a market cap of over $300B. Bitcoin, Market Cap: $184,073,529,068, Price: $10,259.02, Volume 24h: $15,670,986,269, Circulating Supply: 17,942,600 BTC, ...
761fdba3ce3acbaf5aef76f7e195db382edebd58
Rossel/Solve_250_Coding_Challenges
/chal113.py
128
3.765625
4
x = "The days of Python 2 are almost over. Python 3 is the king now." if "z" in x or x.count("y") >= 2: print("True!")
21e094cfda53dda5698622118bf0a3cee5508ad6
jerrylee17/Algorithms
/KattisPractice/KattisChallenge/kattischallenge1.py
95
3.71875
4
c = input() c = c.split(' ') if len(set(c)) == len(c): print("yes") else: print("no")
987a02de30705a5c911e4182c0e83a3e46baecb3
littleninja/udacity-playground
/machine_learning_preassessment/count_words.py
1,201
4.25
4
"""Count words.""" def count_words(s, n): """Return the n most frequently occuring words in s.""" # TODO: Count the number of occurences of each word in s word_dict = {} word_list = s.split(" ") max_count = 1 max_word_list = [] top_n = [] for word in word_list: if word...
857692c3bf179c775cb1416fc7d742dfbb254a39
NCCA/Renderman
/common/Vec4.py
1,551
4.125
4
import math ################################################################################ # Simple Vector class # x,y,z,w attributes for vector data ################################################################################ class Vec4: # ctor to assign values def __init__(self, x, y, z, w=1.0): ...
d42696c2a6d8c36e25b8e3a1c06640907c3bf89c
kscason/Happy_Hands-EE3-
/ASL-Glove/learn.py
9,323
3.625
4
#!/usr/bin/python """ learn.py Program uses supervised machine learning to read in data and store it as a letter of the alphabet based on prompting by the user. """ from collections import defaultdict # So we don't have to worry about checking # if a key exists or catching a KeyError exception from string ...
5435ebe369c338c19987297e9f81a77c4db74b8f
EudesGuzman/Python-Loops-and-Lists
/exercises/07-Do_while/app.py
201
3.921875
4
#Your code go here: num = 21 while num > 0: num = num-1 if num == 0: print("LIFTOFF") elif num % 5 ==0: print(str(num)+ "!") else: print(num)
7f24e64a037c864f1c5b13f7b2301ddc0aed4151
sauravjain995/Competitive-Coding
/spoj/CANDY3.py
161
3.90625
4
for _ in range(input()): x = raw_input() a = input() sum = 0 for i in range(a): b = input() sum += b if(sum % a == 0): print "YES" else: print "NO"
6305a4daeffec70a7b8e156aa9dcc322e401e083
sauravjain995/Competitive-Coding
/spoj/WILLITST.py
72
3.515625
4
a= input() if(a<=1 or (a & (a-1)) == 0): print "TAK" else: print "NIE"
066414bcc7002fc85df35d9e2081c25b6b0d205c
viymak/data-cleaning-python-workshop
/data-cleaning/code-modules-backup.py
3,365
3.953125
4
#remove example import pandas as pd #create dataframe libraries = pd.read_csv('libraries.csv') bpl_branches = pd.DataFrame(libraries) # Drop Columns # Syntax: your_dataframe.drop('1st_dropped_column','2nd_column', 'n_dropped_column' ) - Use axis 0 for rows and axis 1 for columns drop_columns = bpl_branches.drop(colum...
c354e3ef2f2d7558686acb60b3da73c7be2ec0ba
easyfordev/algorithm
/leetcode/4.py
1,447
3.546875
4
""" Leetcode - 4. Median of Two Sorted Arrays # O(log (m+n)) 나와야 함 # 2개 배열의 median 리턴 - 그냥 merge sort처럼 구현하면 되는 문제 """ class Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ # 예외처리 ...
6e36ad26e64535b64e8e86cb5017ae27ed1e5de8
brulogatti/ApprendeCoderAvecPython
/quadrado.py
1,198
3.578125
4
""" import turtle turtle.up() turtle.goto(-150,-150) turtle.down() turtle.color("pink") turtle.begin_fill() turtle.goto(150,-150) turtle.goto(150,150) turtle.goto(-150,150) turtle.goto(-150,-150) turtle.end_fill() turtle.done() """ """ import turtle turtle.up() turtle.shape('turtle') turtle.goto(-80,0) turtle.color(...
082db0106bc64131f1a1a196b4a6ea97c7d078f6
ariefhirmanto/final-task-pplj
/gui/client.py
8,066
3.578125
4
# Client import requests import sys import json import variable as var from random import randint # Sign Up API # This api will post user registration to server and the server will save user registration in database # Param : # - Form : signup form in json format. def SignUp(form) : url = var._signu...
02ee2b49cf5d32e2fc4c84572b4c7e9a5a599041
zhaoly12/examplesOfMulti-Threads
/groupChat.py
3,077
3.703125
4
# -*- coding: utf-8 -*- """ Created on Sat Oct 24 16:58:26 2020 @author: 86156 """ ''' create a online group chat use TCP and multi-threads everyone in the group chat can share their thoughts with others and all the words and its teller can be seen for every memebers in the group ''' from socket import * import thre...
646606fb65e9e9e5a0365ecfee67c9623db8d921
samuelkaiser/Exercism
/python/high-scores/high_scores.py
1,092
3.96875
4
# return last added score # this assumes the score is appended and not prepended def latest(scores): return scores.pop() # returns the highest score in the list def personal_best(scores): return max(scores) # returns list of three highest scores in the scores list def personal_top_three(scores): # count s...
6d73747b5e6f6cf2f788d6ad6c593ec6c8cf71cc
PatrickVienne/PythonAssessment
/questions/q7.py
562
3.84375
4
############### # collections # ############### # what is a deque, write few lines: # -initialize with length 2 # -add entry 1 # -add entry 2 # -add entry 3 # -print container # -use/remove entry # -print container # -use/remove entry # what is a defaultdict, write 4-5 lines, with defaultdict return 0 if the key is ...
f6d6fce48a00f5af17044c4fafbcfef686ddd1f3
nikdom769/test_py111
/Tasks/a2_priority_queue.py
1,534
4.21875
4
""" Priority Queue Queue priorities are from 0 to 5 """ from typing import Any memory_prior_queue = {} def enqueue(elem: Any, priority: int = 0) -> None: """ Operation that add element to the end of the queue :param elem: element to be added :return: Nothing """ global memory_prior_queue ...
1a5944e3dc1474b5ecc09e7d446f667adb668060
luluba/cciscript3
/4.9.py
321
3.75
4
#!/usr/bin/python3 ''' BST Sequences: A binary search tree was created by traversing through an array from left to right and inserting each element. Given a binary search tree with distinct elements, print all possible arrays that could have led to this tree. EXAMPLE Input: 1<-2->3 Output: {2, 1, 3}, {2, 3, 1} ''' ...
0dbea7859927b1bbf872b5b0e42ab513f4054113
luluba/cciscript3
/4.4.py
265
3.546875
4
#!/usr/bin/python3 ''' Check Balanced: Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that the heights of the two subtrees of any node never differ by more than one. '''
3b05d804fcc1977c6ea591e837ce19d191d4146a
yasminhillis/sort_dictionary_python
/main.py
408
3.8125
4
stocks = { 'GOOG': 234.43, 'FB': 132.54, 'AAPL': 543.21, 'YAHOO': 23.34 } # get the minimum value print(min(zip(stocks.values(), stocks.keys()))) # get the maximum value print(max(zip(stocks.values(), stocks.keys()))) # sort the dictionary prices print(sorted(zip(stocks.values(), stocks.keys()))) # sort...
1e415caf237f77e59e13218ab583efdb567f0570
LordBars/python-tutorial
/python-tutorial/stringler-ve-methotları.py
753
4.125
4
## String'ler string = ' Merhaba, Dünya ' print("String'ler listedir. Elemanlara erişebilir ve değişterebilirsiniz") print(string) print("string[6]:", string[6]) print("len(string):", len(string)) print("Merhaba in string:", 'Merhaba' in string) print("Merhaba not in string:", 'Merhaba' not in string) print("string...
ba94bfb835f49fb92b28a4893deffe1b3c9fc225
Aveax/sokoban-py
/map.py
1,235
3.5
4
class Map: map = [] default_map = [] end_floors = [] def __init__(self, level): with open('maps/level' + level + '.txt', 'r') as f: for x in f.read().splitlines(): self.map.append(list(x)) self.default_map.append(list(x)) self.save_end_floors...
93238080b4cbc5d1cfe8e1fd2f080871e4610546
wengxuehao/flask_test
/testflask/可变类型和不可变类型.py
540
3.765625
4
# coding=utf-8 list = [1, 2, 3, 4, 5] # 可变类型列表字典,数据对象在变化,内存地址不变化,修改或者添加id不会改变 print('列表变化之前的id:', id(list)) # 元组字符串,数值是可变类型,对象在内存的值不能变化 # 元组不能修改和删除元素 tuple = (8, 9, 10) print('元组变化之前的id:', id(tuple)) tuple2 = (8, 9, 10, 11) print('元组变化之后的id:', id(tuple2)) list.append(6) # 列表添加元素之后,id不变化 print('列表变化之后的id:', id(list))
ff36020ff07e1fa2cb8aba7b0753f6ada708adc6
clandestine88/ProblemSolvingAlgorithms
/Algorithms/HW/Sorting/Assignment/Part1-4.py
1,490
3.609375
4
def topK(arr, k): def heapifyMax(arr, n, i): left = 2 * i + 1 right = 2 * i +2 largest = i if left < n and arr[left] > arr[largest]: largest = left if right < n and arr[right]> arr[largest]: largest = right i...
53542754d6f62cbf6bcd717f7d3bac6bf71e5b21
pavlo-melnyk/machine_learning
/reinforcement_learning/thompson_sampling.py
3,572
3.734375
4
''' An implementation of the Thompson sampling algorithm (Bayesian method) - a solution to the explore-exploit dilemma. The key is sampling! ''' import numpy as np import matplotlib.pyplot as plt class BayesianBandit: def __init__(self, true_mean): self.true_mean = true_mean # true-mean # parame...
f778fc77f3041df7cf5ede69a53ee48c5f02a693
pavlo-melnyk/machine_learning
/reinforcement_learning/monte_carlo_control.py
4,928
3.828125
4
''' An implementation of the First-Visit Monte Carlo without Exploring Starts algorithm for the Gridworld game (see 'gridworld.py' for reference). NOTE: this is a solution to the Control Problem, i.e., a method for finding the optimal policy. ''' import numpy as np import matplotlib.pyplot as plt from gridwor...
acb15381848047343fb68dc9ea5e9f15f83e120a
boneygithub/HighPeak
/Goodies.py
1,575
3.515625
4
# sample_size = (input("Hello")) # print(sample_size) Expected_items = [] Sorted_items = [] minimaldifference = float('inf') with open ("Item.txt", "r") as myitem: data_red=myitem.readlines() num_emp=int(data_red[0][-2]) # to select last member of the line for i in range(4,len(data_red)): temp_spit = data_re...
e60892ac4e1b8d5437a697fa013762110e8e88b5
MihaiSilinc/Artificial-intelligence
/Assignment3/test.py
739
3.75
4
from random import * import numpy as np from heapq import nlargest from utils import * # Initialize dictionary test_dict = {'gfg': 1, 'is': 4, 'best': 6, 'for': 7, 'geeks': 3} # Initialize N N = 3 # printing original dictionary print("The original dictionary is : " + str(test_dict)) # N largest values in dictionary ...
2ba56205b1236b4af13b6f9a25424f1e0c840539
MihaiSilinc/Artificial-intelligence
/Assignment2/taks1/domain/PriorityQueue.py
941
3.6875
4
class PriorityQueue: def __init__(self): self.__values = {} def __str__(self): out = '' for el in self.__values: out += str(el) out += ':' out += str(self.__values[el]) out += '\n' return out[:-1] def isEmpty(self): re...
ca7936678dde118afc90f548d68f222c6f1f26e8
sockster/metroCard
/metrocard/metroCard.py
4,598
4.125
4
# > > > > > > SECTION 1 # What is on card now: - money # - # of rides # new_card = 0 card_value = 0 new_card = raw_input("Is this a new card?\n") if (new_card == "Y") or (new_card == "y"): orig_amt = 1.00 # $1 charged for new card elif (new_card == "N") or (new_card == "n"): orig_amt ...
b987719be53b58979e02956773b4151b7ff13055
planrich/sos-ws-14
/ex3-protocol/hex_dist_verification.py
2,017
3.875
4
import math w = 1 #math.sqrt(3)/2.0 w2 = w/2.0 h = 2/math.sqrt(3) * 3.0/4.0 def calc(x1,y1,x2,y2): x1s = 0 if y1 % 2 == 1: x1s = w2 x2s = 0 if y2 % 2 == 1: x2s = w2 a = (w * x2 + x2s) - (w * x1 + x1s) b = (h * y2) - (h * y1) #return math.sqrt(a*a + b*b) return a*a + b...
ec3b4ece207c0d2d888601321179afae5e1c2f0d
ntceleste/AdventOfCode2020
/Eric/Day18/day18-2.py
2,545
3.59375
4
input = open('input.txt').read().split("\n") blank_line = input.pop() def calc(): global tokens total = 0 op = '' while True: if tokens == []: return total token = tokens.pop(0) if token == ')': return total if token == '(': token = c...
e5f893c9fc8ba30550129d98e4e60dd285c95720
adamA113/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python
/Problem Set - 2/ps2c.py
4,681
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 9 10:15:24 2017 course: MITx 6.00.1x: Introduction to Computer Science and Programming Using Python source: https://courses.edx.org/courses/course-v1:MITx+6.00.1x+2T2017 """ """ Problem Set 2 - Problem 3 - Using Bisection Search to Make the Progra...
fa006d2be7adb4ff9140d10f761976cfb5763456
i4leader/Python-Basic-Pratice-100-questions
/code/026.py
154
4.0625
4
#!/usr/bin/python3 def fact(num): sum = 0 if num == 0: sum = 1 else: sum = num * fact(num - 1) return sum print(fact(5))
ea0bb8e3127fdb6c61451436637a4ba088a9c858
i4leader/Python-Basic-Pratice-100-questions
/code/016.py
253
3.546875
4
#!/usr/bin/python3 import datetime # 返回当前系统时间 print(datetime.datetime.now()) # 日期格式转化为字符串格式 print(datetime.datetime.now().strftime('%b-%d-%Y %H:%M:%S')) # 打印指定日期 print(datetime.datetime(2020,4,24))
2be9e85741dc8553d4f6accc9f6bfd4f9ad545d1
jwex1000/Learning-Python
/learn_python_the_hard_way_ex/ex15_extra.py
865
4.4375
4
#!/usr/bin/env python # this imports the argv module from the sys libaray print "What is the name of the file you are looking for?" filename = raw_input("> ") #creates a variable txt and opens the variable passed into it from the argv module txt = open (filename) #Shows the user what the file name is print "Here's y...
469042ddb6e37fc7db06bb4fda776b3e0641fa07
jwex1000/Learning-Python
/learn_python_the_hard_way_ex/ex34_ex.py
3,045
4.03125
4
from sys import exit def gold_room(): print "This room is full of gold. How much do you take?" while True: try: next = int(raw_input("please enter a number> ")) break except ValueError: print "Ooops that was not a number, please try again!" ...
c22a0d15bd45d0f88a5f1b6ba45b8a6ebf4847e6
daesookimds/Algorithm
/string_manipulation/reverse_string.py
861
4.03125
4
from typing import List def reverse_list_string_using_swap(s: List[str]) -> None: left, right = 0, len(s) - 1 while left < right: s[left], s[right] = s[right], s[left] left += 1 right -= 1 def reverse_list_string(s: List[str]) -> None: s.reverse() def reverse_string1(s: str) ->...
41c47d817179b6789bff239d4e0cbf80c72f21d6
NekkittAY/L_Systems
/Sierpinski_Triangle.py
412
3.65625
4
axiom = input() # axiom = A itr = int(input()) tempStr = "" for i in range(1, itr+1): ln = len(axiom) for j in range(0, ln): if axiom[j] == "A": tempStr += "B-A-B" elif axiom[j] == "B": tempStr += "A+B+A" elif axiom[j] == "+": tempStr += "+" el...
d24ea133303688ac28522e84db273de2edbb9372
colbych/Data_Incubator_Q3
/loader.py
2,379
3.671875
4
import pandas as pd import numpy as np months = ['apr', 'may', 'jun', 'jul', 'aug', 'sep'] #=========================================================== def in_ipython(): try: __IPYTHON__ return True except NameError: return False #======================================================...
42b7b92df735b44731c1b8526556ee61db746655
omri08/simon_says
/model/model.py
3,013
3.9375
4
import random class Square: """ This class represent a Rectangle we show on the screen :param height,position,color :return: """ def __init__(self, height, position, color, width=None): self.height = height self.width = width self.position = position self.color = c...
1dc75c824cb3c75ae602cf97148a808fdff38d9f
demko/blockade-kafka-failure-examples
/ChaosTestingCode/KafkaUdn/client/command_args.py
769
3.640625
4
def get_args(args): args_dict = dict() index = 1 while index < len(args): key = args[index] value = args[index+1] args_dict[key] = value index += 2 return args_dict def get_mandatory_arg(args_dict, key): if key in args_dict: return args_dict[key] ...
14d16bcb001bbec19a4458fb55d550252815df9b
Gitforfun/PY-1-6388-tasks
/hard/01.py
1,727
3.5
4
""" Найти дубликаты файлов в файловой системе. Напишите функцию duplicate_files (), которая принимает один аргумент пути к каталогу (в виде строки) и возвращает список списков повторяющихся путей к файлам. Пример: >>> duplicate_files('foo/bar') [ ['foo/bar/picture_1.jpg', 'foo/bar/picture_1_copy.jpg'], ['foo...
33948a2bb9df7f8428cdb0435c6c4e17b27bc94c
Gitforfun/PY-1-6388-tasks
/normal/01.py
846
3.515625
4
""" Создайте функцию, которая читает файл CSV и возвращает список словарей, где ключами являются имена в первой строке Пример: {'DoB': '08/18/2007', 'Name': 'Annabel', 'Ordinal': '1'}, CSV файл лежит в 'data/data.csv' Проблема: что произойдет, если строка будет слишком длинной или короткими? Что происходит с повторя...
bc5ee0021f85deeb08b83907a3902a7c8101908c
3toe/BankUserClass
/AccountExample.py
1,238
3.859375
4
class BankAccount: def __init__(self, int_rate = 0.01, balance = 0): self.int_rate = int_rate self.balance = balance def deposit(self, amount): self.balance += amount return self def withdraw(self, amount): if self.balance < amount: print("Insufficient funds for that wi...
b279bb6bfef4b9690fc74fbbcdacb0dfcad40081
WellSantos/python_devops
/Section-02/if-04.py
433
3.953125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- so = input("Qual o melhor sistema operacional?\n" "1 - Linux\n" "2 - Windows\n" "3 - Mac\n" "Digite sua resposta: ") if so == 1: print "Linux é o melhor s.o. do mundo" elif so == 2: print "O Windows ...
45667bc90b655d757017bc8701ad16ce5060822c
codymlewis/Euler
/Nine.py
668
4.5625
5
''' A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. ''' def find_triplet_product(): a = 1 b = 1 c = 1000 - (a + b) ...
a9f4e270640d2c15fb23be652cddedcff3c78ff4
Valentoche/Spirale
/style carré triangle hexa.py
1,074
3.5625
4
from random import randint from turtle import * import time def carre (taille, couleur) : color(couleur) left(0) down() for c in range (0,4) : forward(taille) right(90) up() def triangle(taille) : down() c=0 while c<3 : forward(taille) ri...
7aa8d676ef01a2e8d6b69167a032ba3f7ab5d7e7
Alejandra-lab/lab111
/ecuaciones.py
300
3.953125
4
print('ECUACION DE 2DO GRADO') a= int(input('Variable1= ')) b= int(input('Variable2= ')) c= int(input('Variable3= ')) d= (b**2-4*a*c) if d>0: print('hay dos raices reales distintas') elif (d==0): print('hay dos raices iguales y reales') else : print('tenemos raices imaginarias')
9d7c26a7d324e48039bcf4e9a7adbfe3bd3edd71
ishucr7/Drone_project
/location.py
1,135
3.78125
4
import constants class Location: def __init__(self, latitude, longitude): """ Args: latitude: (double) Latitude of the location longitude: (double) Longitude of the location """ self.Latitude = latitude self.Longitude = longitude def ...
25de9952b05775dea923c9a8a92760ae77a8dd4c
johnj-hernandez/WaveFront
/waveFront.py
5,855
3.796875
4
import numpy as np #This function returns a vector refering to the possible directions the agent can move(nor obstacle nor out of bounds) def perception(matrix,row,col): #first position stands for the possibility of moving up #Second for down, third position for left and fourth for right array=np.array([Fa...
d32c72256bd122e74266341da1d6abc8748669d8
JuanCarlos-A01376511/Mision-04
/Software.py
1,534
4.03125
4
# Autor: Juan Carlos Flores García, A01376511 # Descripción: Programa que lee y muestra el número de paqeuetes comprados y calcula el total a pagar de la compra. # La siguiente función calcula el descuento dependiendo del número de paquetes comprados. def calcularDescuento(numeroDePaquetes, subTotal): if ...
e8a3fd34b1f6cd5ab4e9d4fde61cd2fe57805e83
katha-shah/Daily-Coding-Problem
/GasStationProblem.py
2,438
3.90625
4
""" Leetcode 134: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations. Return the sta...
0efc7700432c0317c656b4c0bbf57663643faafd
csfar/projetoBatalhaNaval
/Batalha Naval/GUI/menu_principal.py
1,232
3.875
4
from logica import main def mostrar_menu(): run_menu = True menu = ("\n+------------------+\n"+ "(1) Iniciar jogo --- \n" + "(2) Como jogar ----- \n" + "(0) Sair -----------\n"+ "+------------------+\n") while(run_menu): prin...
46401919ec9244d3dc034c46faa01ccc0bfec429
kaakdela/Practice_C1
/C1.9/rectangle_2.py
725
4.03125
4
from rectangle import Rectangle, Square, Circle # далее создаем два прямоугольника rect1 = Rectangle(3,4) rect2 = Rectangle(12,5) #вывод площадки двух наших прямоугольников print(rect1.get_area()) print(rect2.get_area()) square1 = Square(5) square2 = Square(10) print(square1.get_area_square(), square2.get_ar...
3701a03acf60f25c3eb9037343f0fc99ccf82d0e
manaleee/python-foundations
/age_calculator.py
764
4.3125
4
from datetime import date def check_birthdate(year1,month1,day1): today = date.today() if today.year < year1: return False if today.year > year1: return True def calculate_age(year1,month1,day1): today = date.today() #age = today.year - birthdate.year - ((today.month, t...
bda0e89071668a3a1fe99cfcf4496bf724a13af3
codefellows/whiteboard_demo
/reverse_array/reverse.py
164
3.921875
4
def reverse_list1(arr): return arr[::-1] def reverse_list2(arr): new_arr = [] for i in arr: new_arr.append(i) arr = new_arr return arr
9567bd60d8b8dcdae78abf5bd5d165d09dcb8ee0
lukfd/WorldsEarthQuake
/earthquake.py
4,324
3.859375
4
# Luca Comba import math import turtle def main(): earthquakes = ReadCsv("earthquakes_2013-2017.csv") data = ReadData(earthquakes) map = VisualizeQuake(data, earthquakes, DrawCircles) def VisualizeQuake (data, earthquakes, DrawCircles): # colors red = '#ff0000' orange = '#ff8800' green = '#00ac22' #setting...
66efbf4f5f6c20fe0a4a715e8f10bbf6d5690913
JMCCMJ/CSCI-220-Introduction-to-Programming
/HW 1/usury.py
1,750
4.34375
4
## ## Name: <Jan-Michael Carrington> ## <usury>.py ## ## Purpose: <This program calculates the priniple payments on a car or home ## purchase. It will tell exactly how much interest will be paid ## over the period of the loans. It also will tell the total payment.> ## ## ## Certification of Authenticity: ## ## I...
26660bdbfceeb98790ed7d34b397d07576a27c7b
JMCCMJ/CSCI-220-Introduction-to-Programming
/HW6/average_time_by_hour.py
7,461
3.765625
4
#Jan-Michael Carrington # average_time_by_hour.py # answers to T/F, Multiple Choice and Discussion on p194-196 (30% of hw grade) ##True/False pg 194 ##1. False ##2. False ##3. True ##4. True ##5. False ##6. False ##7. False ##8. True ##9. True ##10. True ## ##Multiple Choice ##1. B ##2. A ##3. A ##4. A ##5. D ##6. A ...
e26a1467f1d7ef5e0e65053fe827f108c82cb1fe
JMCCMJ/CSCI-220-Introduction-to-Programming
/HW11/delete.py
120
3.625
4
def main(): s1 = [2,1,4,3] s2 = ['c','a','b'] s2.insert(s1[0],'d') print(s1) print(s2) main()
19d1bbb897c2d00f9a80b06ab8ab6cd56c219ae3
Selidex/holbertonschool-higher_level_programming
/0x0A-python-inheritance/2-is_same_class.py
276
3.578125
4
#!/usr/bin/python3 """ THis module checks if a class is exactly a class""" def is_same_class(obj, a_class): """ checks if an object is a class. Args: obj(object): the object being tested a_class(class): the class """ return type(obj) is a_class
4228e426a742d16b2bcce4e767b4e792a82eddb2
Selidex/holbertonschool-higher_level_programming
/0x0A-python-inheritance/3-is_kind_of_class.py
302
3.890625
4
#!/usr/bin/python3 """Checks that a class is a subclass""" def is_kind_of_class(obj, a_class): """Checks if an object is a subclass of a given class. Args: obj(object): the object being tested a_class(class): the class being tested for""" return isinstance(obj, a_class)
34a9e5412383e13d2690175947b8669b05342248
Selidex/holbertonschool-higher_level_programming
/0x0A-python-inheritance/8-rectangle.py
545
3.515625
4
#!/usr/bin/python3 """This module contains a rectangle class inheriting from Base Geometry""" BaseGeometry = __import__('7-base_geometry').BaseGeometry class Rectangle(BaseGeometry): """A rectangle class""" def __init__(self, width, height): """Initializes rectangle Args: width(...
4a1a6da29e4f82941309eb3f7fc337a31a43f6f5
Selidex/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/0-select_states.py
500
3.546875
4
#!/usr/bin/python3 """This program lists the table of a database""" import MySQLdb import sys if __name__ == "__main__": MY_HOST = "localhost" MY_USER = sys.argv[1] MY_PASS = sys.argv[2] MY_DB = sys.argv[3] db = MySQLdb.connect(host=MY_HOST, user=MY_USER, passwd=MY_PASS, db=MY_DB) cur = db.curs...
0d359a3c30b12076205a4b030b7723ecf65b7ba0
asiguqaCPT/Hangman_1
/hangman.py
1,137
4.1875
4
#TIP: use random.randint to get a random word from the list import random def read_file(file_name): """ TODO: Step 1 - open file and read lines as words """ words = open(file_name,'r') lines = words.readlines() return lines def select_random_word(words): """ TODO: Step 2 - select rand...
9e61accfbcf3f90b64154369e8bcaa9575101c3a
S-Oktay-Bicici/PYTHON-PROGRAMMING
/9-String-İşlemleri/String-Startswith-Methodu.py
367
3.75
4
#################################################################### a = "Eğitim" #stringin belirtilen karakter ile başlayıp başlamadığını kontor eder #true(doğru) ve false(yanlış) değeri döndürür print(a.startswith("b")) print(a.startswith("e")) print(a.startswith("E")) ##########################################...
4d94f7809e935cfcebf874d37163f49abf581bf4
S-Oktay-Bicici/PYTHON-PROGRAMMING
/7-Metodlar-(Fonksiyonlar)/sqrt-karakök.py
1,333
4.5625
5
from math import sqrt # Kullanıcıdan değer alınıyor sayi = float(input("Sayı Giriniz: ")) # Karakök hesaplanarak kok değişkenine aktarılıyor kok = sqrt(sayi) # kok değişkenine sqrt fonksiyonunun sonucu aktarılmış print(sqrt(sayi)) # Sonuçlar yazdırılıyor print(sayi," sayısının karekökü" "=", kok) ########...
c7771f3e6c54d6ad3a33c0e804aac0782acc4220
S-Oktay-Bicici/PYTHON-PROGRAMMING
/9-String-İşlemleri/String-Find-Rfind-Methodu.py
511
3.96875
4
##################################################################### a = "sadık oktay biçici" #string içerisinde aranan karakterin kaçıncı sırada olduğunu bulmamıza yarar #soldan sağa arama yapar print(a.find("ı")) #istedğimiz aralıkda aramak istersek print(a.find("t",2,14)) #######################################...
474c4ebb5fc25a49391f27faf24f4a7d601677fc
S-Oktay-Bicici/PYTHON-PROGRAMMING
/6-İleri-Seviye-Veri-Yapıları/sözlük/Sözlük-Pop-Methodu.py
225
3.8125
4
print(35*"#"" ") sözlük = {"pazartesi":1, "salı":2, "çarşamba":3, "perşembe":4, "cuma":5,} sözlük.pop(salı) print(sözlük) #sözlük anahtar kelime ile bir veri silmemizi sağlar print(35*"#"" ")
2ef1c74851ed9e3ce5f4cba664875f8e0bf1b69f
S-Oktay-Bicici/PYTHON-PROGRAMMING
/7-Metodlar-(Fonksiyonlar)/özyineme-örnegi.py
728
3.90625
4
#Özyineleme ile faktöriyel hesaplama def faktoriyel(n): #Gelen n değerinin faktöriyeli alır. if n == 0: return 1 else: return n * faktoriyel(n-1) def main(): # Fonksiyonumuza çeşitli değerler ile test edelim print(" 0! = ", faktoriyel(0)) # 1 print(" 1! = ", faktoriyel(1)) # 1*1 print(" 6! = ", ...
3e0bdf967a20d12d87801a24fe783507dcd36a36
S-Oktay-Bicici/PYTHON-PROGRAMMING
/0-Uygulamalar/bilinmeyen-sayıyı-bulma.py
12,200
3.578125
4
# SADIK OKTAY BİÇİCİ 1180505018 import math def secim(a): #diziyi tarayarak bilinmeyen sayıyının konumunu buluyoruz yer = a.index('?') #bilinmeyen sayıyı '0' index de olduğunu kabul ederek işleme başlıyoruz if(yer == 0): #indexlerdeki değerleri değişkenlere atıyoruz işlemleri ko...
b98b29cc12bc8b99cf970e6dce63925b4f8d492f
S-Oktay-Bicici/PYTHON-PROGRAMMING
/0-Uygulamalar/Fibonacci.py
308
4
4
a,b = 0,1 i = 1 sınır = int(input("seri sınırını giriniz : ")) while(i<sınır): a,b =b,a+b print(b) i+=1 ################################################################# a,b = 0,1 fibonacci = [a,b] for i in range(20): a,b = b,a+b fibonacci.append(b) print("fibonacci serisi : ",fibonacci)
28ee36dd6ff812fe4e277bd07efe81507c608c41
S-Oktay-Bicici/PYTHON-PROGRAMMING
/5-Döngüler/While-Döngüsü.py
425
3.96875
4
############################################################ x = 0 while x <= 0: print("doğru") x += 1 print("x in değeri: ",x) ############################################################ a = 0 while a < 100: a += 1 if a % 2 == 0: print(a) ############################################################# tr...
5b3e5fdfced602c9ed474a074999aa9d32fc91d0
S-Oktay-Bicici/PYTHON-PROGRAMMING
/6-İleri-Seviye-Veri-Yapıları/liste/Liste-Append-Methodu.py
526
3.625
4
###################################################################### günler = ["pazartesi","salı","çarşamba","perşembe","cuma","cumartesi","pazar"] günler.append("perşembe") print(günler) #listenin sonu tek bir eleman eklememizi sağlar ############################################################################# g...
e7f7e64859b2e0de9a1335990114ccd815e7b651
S-Oktay-Bicici/PYTHON-PROGRAMMING
/7-Metodlar-(Fonksiyonlar)/Gömülü-Filter-Fonksiyonu.py
509
3.75
4
liste = [1,2,3,4,5] filter1 = filter(lambda sayı:sayı%2==0,liste) print(filter1) liste = [1,2,3,4,5] filter1 = filter(lambda sayı:sayı%2==0,liste) print(list(filter1)) liste = range(50) filter1 = filter(lambda sayı:sayı%2==0,liste) print(list(filter1)) liste = range(50) def asal_sayı(sayı): i=2 if(sayı==2): r...
7831b923350e010f6b60e417730b8c7a52c455c4
S-Oktay-Bicici/PYTHON-PROGRAMMING
/11.0.Object-Oriented-Programming(OOP)/11.4-Polymorphism/overriding.py
837
3.96875
4
class Okul(): def __init__(self,name,surname,age): self.Name = name self.Surname = surname self.Age = age def info(self): print("{} {} {} yaşında bir okul elemanıdır.") class Ogretmen(Okul): def __init__(self,name,surname,age,maas,uzmanlık): super().__ini...
a2309028a9807e6a806ae6978f54a986f3be3268
S-Oktay-Bicici/PYTHON-PROGRAMMING
/0-Uygulamalar/zaman-formatlama.py
523
3.65625
4
# ### Saniyeyi, saat-dakika-saniye formatına dönüştüren kodu yazın def time_formatter(seconds): mod = seconds % 3600 hours = (seconds - mod)/3600 mod2 = mod % 60 mins = (mod-mod2)/60 print(int(hours), "saat, ", int(mins), "dakika, ", mod2, "saniye") time_formatter(7300) def time_...
98420cbc69cb3080076e389a3ecd00e88fe957c8
S-Oktay-Bicici/PYTHON-PROGRAMMING
/9-String-İşlemleri/string-sıkıştırma.py
674
3.984375
4
# ### Girdi olarak kullanıcıdan bir karakter dizisi alan, ve frekansına göre sıkıştırma işlemi uygulayan Python kodunu yazınız. # ### Örnek: # ###### Input: aaaabbcccccdefffghhhhii # ###### Output: 4a2b5c1d1e3f1g4h2i def zipping(st): result = "" rep = 1 for i in range(len(st)): char = st[...
39ae3da5f1ed22350f4c48f3a9a54fac41a00c59
S-Oktay-Bicici/PYTHON-PROGRAMMING
/0-Uygulamalar/faktoriyel.py
301
4.03125
4
# Program girilen sayının faktöriyelini hesaplar faktoriyel=1 sayac=1 sayi=int(input("Lütfen bir sayı giriniz..")) while sayac<=sayi: faktoriyel*=sayac # faktoriyel = faktoriyel * sayac print(sayac,"=>",faktoriyel) sayac+=1 print(sayi," sayısının foktöriyeli:",faktoriyel)
dbcf39c93ba51a418ce062a4ae54ed6dc9bec35a
S-Oktay-Bicici/PYTHON-PROGRAMMING
/9-String-İşlemleri/String-rjust-ljust-Methodları.py
699
4.09375
4
########################################################################### b = "python" a = 10 c = "*" #belirtilen miktarda stringin solundan boşluk bırakır veya karakter ekler print(b.rjust(a)) print(b.rjust(a,c)) #rjust methodu ##############...
7d11d6f988b347f081c1abb4ffe453f156f44ea7
S-Oktay-Bicici/PYTHON-PROGRAMMING
/6-İleri-Seviye-Veri-Yapıları/sözlük/Sözlük-Örneği.py
2,550
3.75
4
sözlük = {"home" : "ev", "pen" : "kalem", "book" : "kitap"} print(sözlük) print(sözlük["book"]) ######################################################################## karakter = {"ad" : "oktay", "güç" : 80, "silah": "kılıç", "can" : 100} karakter2 = {"ad" ...
32400fe9e053738397520ba2a2503f3bb2a8b47c
S-Oktay-Bicici/PYTHON-PROGRAMMING
/17-PyQt5/button_label_entry_messageBox.py
3,015
3.734375
4
from PyQt5.QtWidgets import * from PyQt5.QtGui import QFont class Window(QWidget): def __init__(self): super().__init__() self.setGeometry(50,50,1080, 640) self.setWindowTitle("PYQT5 App") self.button() self.label() self.entry() ...
d0805c54864c906229ff5fa550e84ea8d51f935d
LBarros77/Boot
/instagram_bot/Interface/__init__.py
7,419
3.5625
4
from DB import * def head(msg): print("-" * 60) print(msg.center(60)) print("-" * 60) def title(msg, msg2): print(msg.center(30), msg2.center(30)) print("-" * 60) def lin(): print("-" * 60) def tools_db(user): dates_list = ["Hashtags", "Comentários"] for n, i in enumerate(dates_l...
43b6d8557570618b6863c33c49d39c9902c28db0
tzerozo/IS211_Assignment14
/recursion.py
581
3.890625
4
#Lang Tuang | 11/22/2020 #A collection of 3 functions for each problems. #!/usr/bin/env python # -*- coding: utf-8 -*- #Part1: Nth element of fibonnaci sequence def fibonnaci(n): if n <= 1: return n else: return (fibonnaci(n-1) + fibonnaci(n-2)) #Part2: Euclid GCD Algorithms def gcd (a,b): ...
7ede33c6d68657c4556a1d7da85d6071eb19e62d
usnish/learningcode
/rosalind/bioinfstronghold/DNA.py
1,027
4.03125
4
#COUNTING DNA NUCLEOTIDES #Problem # A string is simply an ordered collection of symbols selected from some alphabet and formed into a word; the length of a string is the number of symbols that it contains. # An example of a length 21 DNA string (whose alphabet contains the symbols 'A', 'C', 'G', and 'T') is "ATGCTTCAG...
f28694c1271cb3c8780dc0d7fa2c25fd5c7a0f69
usnish/learningcode
/rosalind/bioinfstronghold/REVC.py
809
3.609375
4
# BIOINFORMATICS STRONGHOLD PROBLEM #3: COMPLEMENTING A STRAND OF DNA # Problem # In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. # The reverse complement of a DNA string s is the string sc formed by reversing the symbols of s, then taking the complement of each symbol (e.g., the ...
471c226ddd51e5f7fde0dd391ebf672b3104d342
usnish/learningcode
/projeuler/9.py
422
3.828125
4
#find the pythagorean triple that sums to 1000 #takes a while, but works! def ispyth(num1,num2,num3): if num1**2 + num2**2 == num3**2: return True if num2**2 + num3**2 == num1**2: return True if num1**2 + num3**2 == num2**2: return True else: return False for x in range(1,1000): for y in range(1,1000): ...
13dc840c52db72f1e4da207a263d9b9133f868dd
mashilot/P0_final_mashilot
/P0_Eggs_mashlot.py
780
3.765625
4
###################################################################### # Author: Siso Mashilo # Username: mashilot # # Assignment: P0: Eggs Class #Purpose: Practice breaking a larger problem down into smaller "mental chunks" using functions #Gain practice using loops and modulus (%) # ##########################...