blob_id
stringlengths
40
40
repo_name
stringlengths
5
119
path
stringlengths
2
424
length_bytes
int64
36
888k
score
float64
3.5
5.22
int_score
int64
4
5
text
stringlengths
27
888k
f49ca2d942f8d6e2f60237065859aaabcd85330e
forrestjan/Basic-Programming
/Week 03/oef06.py
241
3.59375
4
# Print alle getallen tussen 200 en 308 (grenzen inclusief) die deelbaar door 7 maar geen veelvoud van 5 # zijn. start = 200 stop = 308 for index in range(start, stop + 1): if index % 7 == 0 and index % 5 != 0: print(f"{index}")
13317fc83be9489d67ace031ccf33d31b2b0cf9b
natyarteagac/holbertonschool-higher_level_programming
/0x02-python-import_modules/3-infinite_add.py
214
3.625
4
#!/usr/bin/python3 if __name__ == "__main__": import sys count = len(sys.argv) number1 = 0 for i in range(1, count): number2 = int(sys.argv[i]) number1 = number1 + number2 print("{:d}".format(number1))
b80c5a36ca886c9deda84923226ae781e683fad9
kumaren14/CodesAndStrings
/crypto.py
1,402
3.953125
4
# transposistion cypher #encryption function def scramble2Encrypt(plainText): evenChars = "" oddChars = "" charCount = 0 for ch in plainText: if charCount % 2 == 0: evenChars = evenChars + ch else: oddChars = oddChars + ch charCount = charCount + 1 ...
27ff4f984772a49a497acc566a2f9b9f6601dd16
giokeyboard/CodingBat
/Python/List-2/sum67.py
702
3.96875
4
def sum67(nums): """ Return the sum of the numbers in the array, except ignore sections of numbers starting with a 6 and extending to the next 7 (every 6 will be followed by at least one 7). Return 0 for no numbers. sum67([1, 2, 2]) → 5 sum67([1, 2, 2, 6, 99, 99, 7]) → 5 sum67([1, 1, 6, 7, ...
28c0505956b48cdb111c2161461f5cd2d8689002
connormclaud/euler
/python/Problem 038/solution.py
1,463
3.984375
4
#!/usr/bin/python # -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distribut...
2dcff15ca14fc070ca2b4bd6ec67d61e7c70406c
csn-intern-choy/DoubleAuctionMarket
/double_auction_institution.py
5,934
3.734375
4
import time class Auction(object): """ A class that makes a market""" board = {"is_open": False, "orders": [], "contracts": [], "standing": {}} def __init__(self, name, ceiling, floor): self.name = name self.ceiling = ceiling self.floor = floor self.board["standing"]["bid"] ...
7dad4c2e0d3cc63e210f78f5d21620ad8f63619d
MarcosFantastico/Python
/Exercicios/ex067.py
591
3.78125
4
from emoji import emojize print(emojize(':symbols:\033[94mTabuada!\033[m:symbols:', use_aliases=True)) cont = 0 while True: n = int(input('Digite um número para calcular a tabuada: ')) print('-' * 30) if n < 0: break while cont <= 10: print(f'{cont:2} X {n} = {cont * n}') ...
0c4b94393594f8acfd1d9870d55316f8fd6d1b2d
SANDHIYA11/myproject
/B36.py
406
3.90625
4
n=input("Enter the number or character or special character:") c=0 for i in n: if(i=='!' or i=='@' or i=='#' or i=='$' or i=='%' or i=='^' or i=='&' or i=='*' or i=='(' or i==')' or i=='_' or i=='-' or i=='+' or i=='=' or i=='{' or i=='}' or i=='[' or i==']' or i=='|' or i=='\' or i==':' or i==';' or i=='"' or i=='''...
f8d4556c537f838ea973b86554e931036b0a9f32
kamilck13/Python2019
/Zadanie 3/zad3_8.py
320
3.859375
4
#3.8 if __name__ == "__main__": t = [0,1,2,3,4] print("Lista pierwsza:") print(t) e = [1, 'a', 'b','c', 'd'] print("Lista druga:") print(e) lista = list(set(t).intersection(set(e))) print("Lista wystepujacych w obu:") print(lista) lista = list(set(e + t)) print("Lista wszystkich elementow:") print(lista)
fc76dbe40b6532e419ed4ec615486ce6dd2097a1
Sky-zzt/lintcodePractice
/pythonAlgorithm/linklist/list_node.py
1,073
3.734375
4
class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next # self.head = self.constructLinklist() @classmethod def printLinklist(self, head): while head is not None: print(head.val) head = head.next # def construc...
130d2cd71d87ff8c62ccf22029c9caf5079eb610
lengxupa/polymerxtal
/simtool/polymerxtal/crystal/molecule.py
5,348
3.65625
4
""" Functions for calculating molecule properties. """ import numpy as np from polymerxtal.data import atomic_weights, atomic_radii from .measure import calculate_distance class Molecule: def __init__(self, name, charge, symbols): self.name = name self.charge = charge self.symbols = symb...
427cd11ea115cc1474a8b8d0567646351427df52
Igor-Victor/PythonExercicios
/ex067.py
456
3.71875
4
print('Exercício 67: Tabuada com loop while True') from rich import print print('[pink]~[/pink]' * 20) print('[red]Tabuada V3.0[/red]') print('[pink]~[/pink]' * 20) n = 0 while True: cont = 0 n = int(input('De qual número deseja ver a tabuada? ')) print('[red]=[/red]' * 30) if n < 0: break w...
dc5aae57815e366968ae5ac56468dfe0ed1fdad2
Heectorr/Act_2
/p3.py
673
3.921875
4
lista = [] numero = int(input("Cantidad de numeros que quieres ingresar(Positivos, Negativos): ")) negativo = 0 positivo = 0 ## Pedira la cantidad de numeros que ingreso el usuario for i in range(0, numero): while True: try: n = int(input("Escribe un número: ")) except Value...
6327b551e7b6c92485d085bfd34dc7f38d0898ac
panmaroul/Numeric-Analysis
/ex1.py
3,758
4.125
4
from matplotlib import pyplot as plt import numpy as np import math # function f(x) def fun(x): return np.exp(np.sin(x)**3) + pow(x, 6) - 2*pow(x, 4) - pow(x, 3) - 1 # derivative of f(x) def der_fun(x): return 3*np.exp(np.sin(x)**3)*np.cos(x)*(np.sin(x)**2) + 6*(pow(x, 5)) - 8*(pow(x, 3)) - 3*(p...
52a31aa7755bb4566552a763b51824538ab903ce
rahuldevgarg/pythongla
/numpy_program.py
137
3.625
4
import numpy as np L = list(map(int, input("Enter space separated value : ").split())) L.reverse() a = np.array(L,dtype=float) print(a)
cbf53ebe9178adf577a61f1a61209cd653e31f41
shellshock1953/python
/oop/4.py
395
3.765625
4
class Board(): def __init__(self): var1 = raw_input("Enter Value:") self.var1 = var1 class Player(): def __init__(self): name = raw_input("Enter Name:") board = Board() self.var = board.var1 self.name = name def show(self): print self.name + " " + sel...
bb4ec2129773058c53580aec271bb85558088bee
Nukeguy5/OOP
/Homework/complexnumbers.py
1,246
4.09375
4
class ComplexNumber: def __init__(self, real, imaginary): self.r = real self.i = imaginary def add(self, real, imaginary): self.r += real self.i += imaginary def subtract(self, real, imaginary): self.r -= real self.i -= imaginary def multiply(s...
e7df730508e1bf4c83fcd7ee7619b10414c5eaa6
ciscopony/pynet_exercises
/lesson1/jsonyaml_write.py
773
4.28125
4
#!/usr/bin/env python """ From the worksheet: 6. Write a Python program that creates a list. One of the elements of the list should be a dictionary with at least two keys. Write this list out to a file using both YAML and JSON formats. The YAML file should be in the expanded form. """ import json import yaml from pp...
8f7a753d2416141ff3b8c7f1ed2061fd54d3eac1
bezdomniy/unsw
/COMP9021/Quiz/binary_tree.py
9,087
4.25
4
# A Binary Tree abstract data type # # Written by Eric Martin for COMP9021 class BinaryTree: def __init__(self, value = None): self.value = value if self.value is not None: self.left_node = BinaryTree() self.right_node = BinaryTree() else: self.left_node...
4f162fbcd374f4c8f8f0eca61161a4e75a184da0
ouoam/CE_Data-Structures
/04.LinkedList/lab1.py
1,462
3.578125
4
from List import List from List import node n4 = node('D') n3 = node('C', n4) n2 = node('B', n3) n1 = node('A', n2) p = n1 while p != None: print(p.data, end=' ') p = p.next print('') q = node('A') print(q) r = node('B', q) print(r) print(r.next) print('------------------') l = List() l.addHead('1') prin...
c77193a3665b0aae485306fed770b0c190938681
oleg123987/FirstPy
/theory/generators.py
329
3.640625
4
lst = [i for i in range(0, 4)] print(lst) lst = [] for i in range(4): lst.append(i) print(lst) print(type(lst)) # list keys = {i for i in range(0, 4)} print(type(keys)) # set множество (только уникальные значения) dct = dict() dct.setdefault('key', 'hello') print(type(dct)) print(dct)
d6d6d8e28f6cee879ff311e187c09d29b2662694
sandeepvempati/python_examples
/exprac.py
662
3.84375
4
# print 'abcd'.isalpha() # print '12e4v'.isalnum() # print '12321'.isdigit() # print 'fdsafds'.islower() # print 'DSFDASFF'.isupper() # print 'TIJNLSA'.istitle() # print ' '.isspace() # x = [1,5,7,8,9,222,568] # # print any(i>500 for i in x) #if we want to check for single element in for loop we can use any functio...
32ab6daa4051fa3296f59125b24b79315793ed95
MandyKTT/learnPython
/05_if.py
1,513
4.125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- """ car='bmw' print(car=='bmw') requested_topping='mushrooms' if requested_topping!='anchovies': print("Hold the anchovies!") requested_toppings=['mushrooms','onions','pineapple'] print('mushrooms' in requested_toppings) banned_users=['andrew','carolina','david'] user...
bc024287ad235dd442c233bcba978bc576473ac1
Bassam-11/t3lem
/program_7/car_info_type.py
627
3.890625
4
right = ("false") i = 0 car_info = input ("your car company is :") car_type = input ("your car type is :") if car_info == ("honday") : print ("your car type is :") if car_type == ("sonata"): print ("good car") print ("the spare parts not so expensive") if car_type == ("acoord") or ("elintra") or ("acsint"...
44fa7eb876aeb00dcb5a23f6d27ccac78905d2ee
skhan75/CoderAid
/DataStructures/Trees/print_root_to_leaf_paths.py
1,441
4.34375
4
# binary tree node contains data field , # left and right pointer class Node: # constructor to create tree node def __init__(self, data): self.data = data self.left = None self.right = None # function to print all path from root # to leaf in binary tree def print_paths(root): # list...
2b6e872b8377ea4cc57255fd3c65bdd7fda4530d
dmxj/icv
/icv/utils/time.py
857
4.03125
4
# -*- coding: UTF-8 -*- from time import time,localtime,strftime class Time(object): def __init__(self,): self.running = False @staticmethod def now(): return time() @staticmethod def now_str(): return strftime("%Y-%m-%d %H:%M:%S", localtime(time())) @staticmethod ...
735f6a6dc9ab0d4c33007a4dad4204059bb729cb
LD1016/Data-Structures-and-Algorithms
/Coding_Challenge/Graph_DataStructure_Algorithm/bfs1.py
512
3.875
4
def bfs(graph, node, visit=None): if visit is None: visit = set() visit.add(node) queue = [node] while len(queue) > 0: curr_node = queue.pop(0) print(curr_node) for i in graph[curr_node]: if i not in visit: visit.add(i) queue.ap...
227a6a13d82d0ae4f93f74cf28e1dda85788d566
scheffeltravis/Python
/Geometry/Geometry.py
8,010
4.09375
4
import math class Point (object): # constructor with default values def __init__ (self, x = 0, y = 0): self.x = x self.y = y # get distance to another Point object def dist (self, other): return math.hypot(self.x - other.x, self.y - other.y) # create a string representation of a Point (x, y) ...
00972a4450debb7e4f0b48dfd59a603ae8ec4465
MartinHan01/MyPractices
/sicp/c1/c_2_6.py
2,428
3.703125
4
def make_instance(cls): def get_value(name): if name in attributes: return attributes[name] else: value = cls['get'](name) return bind_method(value, instance) def set_value(name, value): attributes[name] = value attributes = {} instance = {'g...
b352d95ec79c33a8e002c51be47bb1b434edd021
ykurylyak87/udemy
/methods/methodsdemo3.py
325
4.03125
4
""" Positional Parameters They are like optional parameters And can be assigned a default value, if no value is provided from outside """ def sum_nums(a=2, b=4): """ Get sum of two numbers :param a: :param b: :return: """ return a + b c = sum_nums(b=6, a=8) print(c) z = sum_nums(b=5) pri...
33ac96b69310043b3fd6d75d08046140a6c0d190
Jimminer/unlimited-grid-tic-tac-toe
/main.py
3,087
3.984375
4
size = int(input("Select the grid size (3-20): ")) end = False if size < 3 or size > 20: end = True values = [0 for i in range(size**2)] turn = "1" def start(): global values global turn global end drawgame() if checkwin(values, turn) == False: place = input("Select where you want to pl...
2118b10c71d07b3f309540827b52575fdfe88de2
ValentynaGorbachenko/cd2
/ltcd/transpose.py
815
4.5
4
''' Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. Example 1: Input: [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,5,8],[3,6,9]] Example 2: Input: [[1,2,3],[4,5,6]] Output: [[1,4],[2,5],[3,...
887246d29bc40ff2b497641179ad095040e25271
IgorKoltunov/rock-paper-scissors
/rockPaperScissors.py
2,293
4
4
""" Rock, Paper Scissors game against Random. """ import random CHOICE_LIST = ['Rock', 'Paper', 'Scissors'] RESULT_LIST = ['Draw', 'Human Wins', 'AI Wins'] def play_round(humanHand, aiHand): if humanHand == aiHand: result = RESULT_LIST[0] if humanHand == CHOICE_LIST[0] and aiHand == CHOICE_LIST...
f923c08b4044f16638e537a1fcfc125b33d5a6e8
sanghunBaek/algorithm
/algorithm/baekjoon/50_1427.py
365
3.84375
4
#문자를 하나하나씩 다 끊어서 하려면 그냥 문자를 list로 만들어주면 된다 # a.sort(reverse=True) 하면 내림차순 정렬 # join(b) 를 쓴다면 저기 b는 문자형태 리스트 여야함 import sys a = sys.stdin.readline().rstrip() b = list(a) b = list(map(int,b)) b.sort(reverse = True) b = list(map(str,b)) c = "".join(b) print(c)
884311d9a34f2491ffd3560e2e85550c930d61eb
rkpatra201/python-practice
/python_statements/101_ifelif.py
265
4
4
val = 2 if (val == 1): print('one') elif (val == 2): print('two') else: print('other') if True: print('welcome') val = 3 > 4 # True if val: print('valid') if (val): print("it is valid") if val: print('valid') else: print('invalid')
5a1977cc96eab024f5e4100a35d138e68cd976ad
A8IK/Python-2
/data struchture.py
1,455
4.3125
4
class Node: def __init__(self,value): self.next = None #Initally we will got nothing so we just let the name "None" self.prev = None self.val = value #Every nodes keep a value so we create it... class DoubleLinkedList: def __init__(self): ##We are create empty ...
438ae062b4dee05103c6e6ca9d76f80e29068b5a
mwhit74/practice_examples
/linuxtopia_python/C_to_F_Table.py
137
3.5
4
#Temperature Converstion Table print("Celcius\tFahrenheit") for c in range(-20, 30, 5): f = 32+(212-32)/100*c print("%r\t%r" % (c,f))
34498ddfb63a10df0e2ac7e783e92e872593b8cc
sminez/datools
/lib/ml.py
3,233
3.890625
4
''' My own personal implementations of common ML algorithms. Primarily intended for reference and personal understanding of how everything works. (Use Scikit-Learn...!) ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt class LinearRegressor: ''' A first try at a simple linear regressi...
d9edf792c662a60729d26907f588c43b18d0f0ff
idanielgarcia13/week10
/larger_than_n.py
446
4.125
4
def Return_Larger_Than_Asked(numbers, n): for num in numbers: if num > n: print(num) def main(): numbers = [] response = '' while response != 'q': response = input("Enter a number. Enter q to quit. ") if response != 'q': numbers.append(int(response)) ...
0289dfb62f11507cc01a88ebdcf8fa6a37c47d45
Dolores2333/Blackjack
/player.py
1,636
3.65625
4
# -*- coding: utf-8 _*_ # @Time : 4/10/2021 2:12 pm # @Author: ZHA Mengyue # @FileName: player.py # @Software: Blackjack # @Blog: https://github.com/Dolores2333 class Player(object): # Player has a name and a hand of cards # The points will be counted into the state def __init__(self, player_name): ...
0460e87fb2798c7ff8cf099f97f297a4bd28c526
JimenaVega/Sicomp-projects
/tp3/test/csv_plot.py
1,102
3.53125
4
import random from itertools import count import pandas as pd import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation DEVICE_FILE = "/dev/gpio_rbp" plt.style.use('fivethirtyeight') x_vals = [] y_vals = [] index = count() def prompt(): print("SEÑALES A MOSTRAR:") print("[0] Exit") ...
f66b49d424c2908032aa2c804e72f9c9b08a7aeb
shaheerkhan199/uni_ai_mini_projects
/First mini project A.I/myPriorityQueue.py
657
3.890625
4
class priorityQueue(): def __init__(self): self.priorityQueue = dict() def enqueue(self,dataElement,pathCost): self.priorityQueue[pathCost] = dataElement def dequeue(self): '''cost,data = self.priorityQueue.items() minCost = min(cost) maxPriorityElement = self...
a324e21a1809a4164353e34839a2cc564964db06
venkataramanab/InterviewbitSet1
/root_to_leaf_path_with_sum.py
1,472
3.84375
4
# Created by venkataramana on 09/02/18. # https://www.interviewbit.com/problems/root-to-leaf-paths-with-sum/ # Root to Leaf Paths With Sum # Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. # # For example: # Given the below binary tree and sum = 22, # return [ # [5...
b9e60b9aad937e3ac28d871ff227c1ed38950cf6
lugy-bupt/algorithm
/leet/0833-find-and-replace-in-string/find-and-replace-in-string.py
702
3.625
4
class Solution: def findReplaceString(self, S: str, indexes: List[int], sources: List[str], targets: List[str]) -> str: if len(indexes) == 0 or S == "" : return S def replace(S, start, source, target) -> str: if S[start: start + len(source)] == source: ...
2939321fb3d45afdf5812d4c5777bcf867efcf72
blad00/HPCTutorial
/02FlowStatemen.py
5,395
3.953125
4
ph = 51 if ph > 7: print('basic') print("other basic") elif ph <7: print('acid') else: print('Neutral') print('done') mass = int(input("Enter you weight (Kg): ")) height = int(input("ENter height: ")) BMI = mass / (height / 100) ** 2 print(BMI) #2.1 ISBN # read ten digits of an ISBN-10 code (each ...
2afe88f38f33383f8c4c475b7cd9626bc8d53553
buidler/LeetCode
/字符串/434. 字符串中的单词数.py
1,720
4.1875
4
""" 统计字符串中的单词个数,这里的单词指的是连续的不是空格的字符。 请注意,你可以假定字符串里不包括任何不可打印的字符。 示例: 输入: "Hello, my name is John" 输出: 5 """ class Solution(object): def countSegments(self, s): """ :type s: str :rtype: int """ if len(s.split()) == 0: return 0 # 设置计数器,初始值为1 index =...
9e33140d27224ff019e2b1614c239a957f5a564a
tylerbittner/learning
/HackerRank/Recursion - Fibonacci Sequence/solution.py
363
4.0625
4
# Problem statement: https://www.hackerrank.com/challenges/ctci-fibonacci-numbers def fibonacci(n, memo): if n <= 0: return 0 elif n == 1: return 1 elif n not in memo: memo[n] = fibonacci(n - 1, memo) + fibonacci(n - 2, memo) return memo[n] memo = {} # HackerRank's code n =...
c885f6f3493651239798c090157111f0785c8cd5
danielhermawan/reddit-daily-programmer-challenge
/python/subsets.py
626
3.765625
4
class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ res = [] self.backtrack(nums, res, 0, []) return res def backtrack(self, nums, res, start, path): res.append(path[:]) if start == len(nu...
0f191c50eae23fc96d0a369c5005934864ef3942
engemp/holbertonschool-higher_level_programming
/0x0B-python-input_output/0-read_file.py
271
4.21875
4
#!/usr/bin/python3 ''' Reads a txt file and prints it ''' def read_file(filename=""): ''' Read an UTF-8 encode file and print it ''' with open(filename, mode='r', encoding='utf-8') as filet0: contents = filet0.read() print(contents, end='')
7b1acc9ee7d7bf5c4195b71d26261b0fbe1e98e9
dm36/interview-practice
/leetcode/sum_bst.py
771
3.8125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTarget(self, root, k): """ :type root: TreeNode :type k: int :rtype: bool ...
ea8f774240df285a84016b255bdaf39fe3c91271
Angie-0901/t06_de_la_cruz
/ejemplo_03.py
952
3.734375
4
import os #Hallar la Tasa de mortalidad #DECLARAR VARIABLE muerte_natural,muerte_provocada,pob_total = 0,0,0 #INPUT muerte_provocada=int(os.sys.argv[1]) muerte_natural=int(os.sys.argv[2]) pob_total =int(os.sys.argv[3]) #PROCESSING tasa_mortalidad =(muerte_provocada + muerte_natural)/pob_total * 100 #VERI...
c4c0939d406b4fd83acf68dd015baf6a8f516bfe
simplewebby/python_hw
/HW0_TsaganGaryaeva.py
4,829
4.1875
4
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "copyright", "credits" or "license()" for more information. >>> """ Tsagan Garyaeva CS 100 2018F Section 01 HW 0, Sep 7, 2018 """ # Exercise 5b
 days_in_year = 356 age = 35 gramms_in_kg = 1000 # Exercise 5c
 cost...
34254961edfc55d3dea1e0cadc75f8e30c9c76fa
lazydevshubh/Computer-Graphics
/lineClip.py
1,488
3.53125
4
from line import bresenham as l from start import setaxis from polygon import polygon from graphics import * global t1,t2 t1=0 t2=1 def isClip(p,q): global t1,t2 flag=1 if p<0: r=q/p if r>t2: flag=0 elif r>t1: t1=r elif p>0: r=q/p ...
e7ca7f7adf286ba9db0719a2e6e4159f25d1a737
KushagraChauhan/7-day-challenge
/4.py
306
3.65625
4
''' Third Day- Rotate Array - Leetcode ''' def rotate(arr,k): arr_final = arr arr_final = arr_final[k:] + arr_final[:k] return arr_final def main(): arr = [int(x) for x in input().split()] k = int(input()) res = rotate(arr,k) print(res) if __name__ == '__main__': main()
90c1fd41c82adfcfd2cf1979eceadd1694d3bee9
Rubenia-Borge/_100DaysOfCode_1
/day79_2.py
903
3.953125
4
# Python program to explain cv2.imwrite() method # importing cv2 import cv2 # importing os module import os # Image path image_path = r'C:\Users\Rajnish\Desktop\GeeksforGeeks\geeks.png' # Image directory directory = r'C:\Users\Rajnish\Desktop\GeeksforGeeks' # Using cv2.imread() method # to r...
112b7ff9a45d6d78e64e44c3e98ed59a16586d20
spencrr/MSOE-Op-Comp-2018
/prob5.py
311
3.59375
4
file_name = input('Enter artwork filename: ') with open(file_name) as art: lines = art.readlines() output = '' for line in lines: for i in range(0, len(line) - 1, 2): for j in range(int(line[i])): output += line[i+1] output += '\n' print(output[0:-1])
5e59aed7cd7b65409b113de60673d14c74374ae5
erjimrio/Curso-CPP
/Comparativa Python/Ejercicio11-Condicionales.py
827
4.28125
4
# 11. Hacer un programa que simule un cajero automático con un saldo inicial # de 1000 Dólares. saldoInicial = 1000.00 print('\tBienvenido a su cajero virtual') print('1. Ingresar dindero en cuenta') print('2. Retirar dindero en cuenta') print('3. Salir') opcion = int(input('Digite el número deseado [1-3]: ')) if op...
9cb99b4747825f528658dcf70d21a74bf87f1847
nsudhanva/mca-code
/Sem3/Python/assignment7/2_time_conv.py
641
4
4
class Time: def __init__(self): self.time = int(input('Enter time in seconds: ')) def convert_time(self): full_hours = self.time * (1 / 3.6) * (1 / 1000) hours = int(full_hours) left_hours = full_hours - hours full_minutes = left_hours * 60 minutes = int(full_m...
a7ceb5211f66b97fc6bef5245a8139fed10b573c
nalssee/SICP
/lisp_parser/lp.py
1,723
3.53125
4
""" A simple lisp parser for SICP exercises """ import re __all__ = ["parse"] SPECIEAL_TOKENS = {"'": 'quote', ".": 'dot',} def tokenize(expr): regex = re.compile("""( '| # quote \(| # left paren \)| # right paren ...
859584e393d1e2b833808e3446dcc0dc552b8478
AlvaroMonserrat/app-comercial-kivy
/BasicThings/metodoEstatico.py
1,059
4.25
4
"""Metodos estaticos Es cualquier metodo declarado en la clase conteniendo a cualquier parametro Funcion staticmethod() Clase A: def func(): pass func = staticmethod(func) ----------------------------------- Clase A: @staticmethod def func(arg1, arg2, ...): pass """ class MEstatico...
019b048528388f1515aef5be10a4993b2855746f
Lbabichev17/python_practice
/courses/Adaptive Python (stepik.org)/2.18 Calculator.py
567
4
4
# -*- coding: utf-8 -*- n1, n2, op = (float(input()), float(input()), input()) result = None if op == '+': result = n1 + n2 elif op == '-': result = n1 - n2 elif op == '/': if n2 == 0: result = 'Division by 0!' else: result = n1 / n2 elif op == '*': result = n1 * n2 elif op == 'mod...
97e7f45b5ba0bdb599bed8f2e70dba35b0c45d10
reetubala/spychat1
/main.py
7,825
3.703125
4
from spy_details import spy ,Spy,ChatMessage,friends from termcolor import colored from steganography.steganography import Steganography #Let's start print "Hello!" print "Let's app get started" spy_name = raw_input("Welcome to spy_chat , you must tell your spy_name first: ") if len(spy_name)> 0 : print " W...
ba9693c12c862bf37335490d75ea18d2883fbbd5
phamquangthinhs/Tools-python
/Basic/Tamgiacvuong.py
218
3.625
4
while True: a = int(input('Hay nhap so tu 5 den 10 \n')) if a <= 10 and a >= 5: break i = 1 while i <= a : j = 1 while j <= i: print(j,end='') j += 1 print () i += 1
f86ff0416c507611757b63d35dbd636281cb0a5b
NijboerLars/lift
/lift.py
714
3.84375
4
class Lift: def __init__(self): self.current_floor = 0 self.customers_inside = 0 self.top_reached = False def move_up(self): self.current_floor += 1 print('Lift has moved up to floor ' + str(self.current_floor)) def move_down(self): self.current...
3f6135b28c49fa3851a9d2700ba1cbf5954010d1
JKChang2015/Python
/CJK/temp/enum_test.py
200
3.828125
4
# enum_test # Created by JKChang # 17/08/2017, 16:17 # Tag: # Description: from enum import Enum class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 print(Color.RED) print(Color.RED.value)
eb6e0978def02640c921bc7a8e55cf2d8320ec1f
vicky964/logical-programs
/keywordedvariables.py
134
3.5625
4
def person(name,**data) : print(name) for i,j in data.items(): print(i,j) person('vicky',age =18,city = 'chennai')
efd786694a4c9e389f2df35c9bb7c4c9bf0092c4
srinivasskc/Python-Programming-Learning
/Python150Challenges/ForLoops/35-44 Challenges/Challenge40.py
227
4.03125
4
# 040 Ask for a number below 50 and then count down from 50 to that number, making sure you show the number they entered in the output. num = int(input("Enter a number below 50: ")) for i in range(50,num-1,-1): print(i)
1c67393074a826f4b5268da33f0fdd306b395b77
wcdoster/python_exercises
/classes/employees.py
1,259
4.09375
4
class Employee(): def __init__(self, name, job_title, start_date, salary): self.name = name self.job = job_title self.start = start_date self.salary = salary class Company(object): """This represents a company in which people work""" def __init__(self, company_name, date_...
4e26cf36053b5a266b09a4199e5b094d77c2b93e
107318041ZhuGuanHan/TQC-Python-Practice
/_2_selection/210/main.py
608
3.796875
4
length_1 = float(input("請輸入三角形的第一個邊長: ")) length_2 = float(input("請輸入三角形的第二個邊長: ")) length_3 = float(input("請輸入三角形的第三個邊長: ")) state_3 = length_1 + length_2 > length_3 state_2 = length_1 + length_3 > length_2 state_1 = length_2 + length_3 > length_1 # 儲存3個判斷解果(布林代數) if state_1 and state_2 and state_3: # 在這裡把上面3個布林變數拿來...
efb83e6415bdd367c830f976a3e7812ed24d1421
Im1nvisible/learn_python
/home_work_1.py
354
3.6875
4
#task_1 l1 = [1, 2, 3] l1 = [x * 2 for x in l1] print(l1) #task_2 l3 = [1, 2, 3] res = 0 for num in l3: res += num ** 2 print(res) #task_3 time1 = 3 time2 = 6.7 time3 = 11.8 print(time1 // 2) print(time2 // 2) print(time3 // 2) #task_4 s = 'Hello World' if ' ' in s: s = s.upper() el...
2600d20faabe6f72de83011eceba4e0f46360e64
pylangstudy/201708
/14/00/0.py
271
3.8125
4
#!python3.6 #coding:utf-8 import re match = re.search(r'^ab', 'ABC', re.IGNORECASE) if match: print('一致した。') else: print('一致しない。') match = re.search(r'^ab', 'CDE', re.IGNORECASE) if match: print('一致した。') else: print('一致しない。')
19ad3dd7046a151f34d1e53094da202dd8435e05
boundary-conditions/aoc2020
/day_3.py
434
3.5625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 3 07:15:39 2020 @author: charleskeenan """ import aocmodule as aoc input_list = aoc.input_getter('day_3_input.txt') day_three_part_one_solution = aoc.arboreal_collider(input_list, 1, 3) PATHS = [(1,1),(1,3),(1,5),(1,7),(2,1)] product = 1 for do...
b207b59f1386f5b32b2159404a88f41d2baea0dd
adrian0398/Introytaller2018
/Código/Recursión de cola/matriz.py
559
3.765625
4
def suma_matriz(elemento,matriz): if isinstance(matriz,list) and matriz!=[]: return matriz_aux(elemento,matriz,len(matriz[0]),0,0) else: return "La matriz no es una lista" def matriz_aux(elemento,matriz,num_filas,num_columnas,fila,columna): if fila==num_filas: return matriz else...
28a3bd9662d373384ae2ef66d53c3fa446d50285
priya8936/Codewayy_Python_Series
/Python_Task_1/Python-Task-1.py
278
3.65625
4
#integer values a=10 b=20 print("SUM=", a+b) print("SUB=", a-b) print("MUL=", a*b) print("DIV=", a/b) print("MOD=", a%b) print() #float values c=20.5 d=10.3 print("SUM=", a+b) print("SUB=", a-b) print("MUL=", a*b) print("DIV=", a/b) print("MOD=", a%b) print()
35c3c988f432f4b3d16b3ddc429d405abe12a33e
m-ox/python_course
/challenges/average.py
742
3.578125
4
class Averager: number_list = [1, 2, 3, 4, 5, 6] def average_machine(num_list): result = 0 for num in num_list: result += num result /= len(num_list) return [] return result #print(average_machine(number_list)) def reducer_averager(num_list): ...
1ded7c9492b15ab6f4b4d53f47de05420569a977
indo-seattle/python
/Sandeep/Dictionary Examples/Companies started in which city.py
165
3.890625
4
mydict = {'Bellevue': 'Microsoft', 'Seattle' : 'Amazon','Everett':'Boeing'} mydict['Infosys']='Bengaluru' for i in mydict: print(mydict[i]+" started in "+i)
72af6eaa2d0e76f87cadd18b280eccfd45406e8f
muriloOliveira7/7001ICT-Programming-Principles
/5194077MAGO/ws07/problem1.py
747
4.09375
4
#7001ICT Programming Principles, Workshop 7, 3.1 Problem 1 #Program that copy all content from a source file to a target one #without empty lines and print how many lines were deleted #Recieve files from the user inputFile = input("Source file name: ") outputFile = input("Target file name: ") totalEmptyLines = 0 #Op...
759a285e452f5729b57131bfa94ae6cd1042aee8
kimjeonghyon/Algorithms
/Python/InsertionSort.py
273
4.03125
4
def InsertionSort(data) : for i in range(0, len(data)) : j = i for j in range (j, 0, -1) : if data[j] < data[j-1] : temp = data[j] data[j] = data[j-1] data[j-1] = temp else : break data = [1,2,3,5,4,6,8,7,9,0] InsertionSort(data) print(data)
b58c2915a4034aa20269fcc2953e0ac5213f4417
surbesh/FST-M1
/Python/Activities/Activity5.py
152
3.75
4
tablenumber = int(input("Input a table number: ")) # iterating 10 times for i in range(1,11): print(tablenumber, ' x ', i, ' = ', tablenumber*i)
271863515ecab1fc7d3fb351a1f37d5f6ddedf72
forAllBright/cs61a
/homework/hw05/hw05.py
8,453
4.1875
4
def countdown(n): """ A generator that counts down from N to 0. >>> for number in countdown(5): ... print(number) ... 5 4 3 2 1 0 >>> for number in countdown(2): ... print(number) ... 2 1 0 """ while(n >= 0): yield n class Coun...
3385153ddd51bffe35f90b0cae33c0bb0950a804
gabriellaec/desoft-analise-exercicios
/backup/user_343/ch32_2019_03_27_16_32_19_218948.py
111
3.578125
4
a=input('Duvidas?') while a != nao: print ('Pratique mais') a=input('Duvidas?') print ('Ate a proxima')
f916b742d9c77d334ebe41dfe17f62308d8c3f4f
tangcfrank/tang
/tang/circulation.py
526
3.65625
4
"""for i in range(10): if i%2 != 0: print(i) continue print(i) i += 2 """ '''print('--------------------------------circulaction-------------------------') nameval='谁最大谁做主' while True: result = input('输入一句最豪气的话表达一下自己心情:') if nameval == result: break print('呵呵') print('没有意思不玩了...
f49dd4500090df2ea09a8c566418c30e6afd92f8
CodeMythGit/Python-Tutorial
/pythonJoinSets.py
787
4.28125
4
#using union method # set1 = {"a","b","c","d"} # set2 = {"a","e","g","c"} # print("using union method") # set3 = set1.union(set2) # print(set3) # set1 = {"a","b","c","d"} # set2 = {"a","e","g","c"} # set1.update(set2) # print(set1) #example intersection # set1 = {"a","b","c","d"} # set2 = {"a","e","g"...
17ca1bb780395114900213cff376800ff88d0d1c
RebeccaLu9/Games-Adversarial-Search
/adversarial_search.py
4,729
3.578125
4
############################################################ # CIS 521: adversarial_search ############################################################ student_name = "Jingyi Lu" ############################################################ # Imports ############################################################...
b3b20d614786e0229366e9651460bb5e05d80b13
vishrutdixit/projecteuler
/p4.py
383
4.0625
4
#Find the largest palindrome made from the product of two 3-digit numbers. def isPalindrome(n): s = str(n) if s == s[::-1]: return True return False def main(): biggest = 0 for i in range(100,1000): for j in range(100,1000): if isPalindrome(i*j) and i*j>=biggest: ...
000da4c91991d2c4d2a74ef547e520740e8a9e68
pgThiago/saving-in-txt-python
/phonebook01/main.py
3,894
4.21875
4
''' - Creates a list and a dictionary - Starts a infinity loop that only breaks when the user want to - If txt is empty then the user only have 2 methods: Add(); Quit(that is not really a method, of course). ''' from contact import Contact from operator import itemgetter from os import system from time import s...
1a426917bb7b23299b5424f4483e9dfabec4e8dd
ZachZemo/python-homework
/FileReader.py
561
3.828125
4
import argparse parser = argparse.ArgumentParser() parser.add_argument("-f", "--file", dest="file", help="input housing data file") args = parser.parse_args() file = args.file data=open(file) my_file = data.read() my_file_lines = my_file.split('\n') print(my_file) for line in my_file_lines: if line != '': ...
e2638ddaf621804f647dac1d88ae50e1574e20f3
kitmehta77/PycharmProjects
/HTCS5604/introductionToPython/TestCalculator.py
634
3.515625
4
import unittest import HTCS5604.introductionToPython.calculation as g class TestCalculator(unittest.TestCase): def test_add(self): result = g.add(5,6) self.assertEqual(11,result) def test_subtract(self): result = g.subtract(8,2) self.assertEqual(6,result) def test_multiply...
e948a96ee2d8585f81dacc36511754c421bc3605
aleda145/projecteuler
/problem3.py
674
3.890625
4
# What is the largest prime factor of the number 600851475143 ? def find_prime_factors(number): # this range is obviously bad, there is no reason to check if divisible by 4, 6, 8, 9, 10 etc. for x in range(2, number+1): if number % x == 0: print("divisible with ", x) if number...
e53d54d7ee280f37ebfeaa5d996a4e2a8dd502c4
AdamZhouSE/pythonHomework
/Code/CodeRecords/2881/60761/237940.py
189
3.578125
4
n=int(input("")) j=1 while j<n: print("*"*int((n-j)/2)+"D"*j+"*"*int((n-j)/2)) j=j+2 else: while(j>=1): print("*"*int((n-j)/2)+"D"*j+"*"*int((n-j)/2)) j=j-2
11be88407b8efa3df4fc76763edcdc978f465805
Raghav-Bajaj/HacktoberFest-2
/python/Snakes_and_Ladders.py
3,923
3.90625
4
# -*- coding: utf-8 -*- """ Created on Sun Sep 15 13:07:38 2019 @author: SHAKESPEARE """ from PIL import Image import random end=100 def show_board(): img=Image.open('slb.jpg') img.show() def check_ladder(points): if points==8: print('Ladder') return 26 elif points==21: pri...
7e64cb27a901143b5b109fb2a51928c2729a5ee3
muthu048/guvi
/func1 caculator.py
412
3.859375
4
while True: a,c,b=input().split() def add(a,b): ad=int(a)+int(b) print(ad) if c=='+': add(a,b) def mul(a,b): mu=int(a)*int(b) print(mu) if c=='*': mul(a,b) def div(a,b): di=int(a)/int(b) print(di) if c=='/': div(a,...
afe9cfffcf98f60257885afa3efcd672b550c9e0
aole/boilerplate
/pythonopengl.py
1,407
3.65625
4
import pyglet from pyglet.gl import * from pyglet.window import mouse from pyglet.window import key __author__ = 'Bhupendra Aole' __version__ = '0.1.0' window = pyglet.window.Window() label = pyglet.text.Label('Hello, world', font_name='Times New Roman', font_size=...
54b5dca3da50c370127ff00a97e5ec59ee2ae602
supvigi/python-first-project
/Tasks/2020_12_19/Task0.py
185
3.78125
4
x = [1, 2, 3] y = [6, 5, 4, 5, 8] if len(x) > len(y): for i in range(len(y)): x[i] += y[i] print(x) else: for i in range(len(x)): y[i] += x[i] print(y)
0f7c75eeb05a097517b7211c70effdb08982477d
eddigavell/Data-IT-security
/src/Python/RSA_Exercise/Main.py
3,564
4
4
import RSA def generate_keys(): key_name = input('Enter key name:') RSA.generate_new_key(key_name) def encrypt_message_to_string(): is_it_sign = input('Is it for signature? (yes/what ever): ') key_name = input('Enter key: ') message = input('Enter message to encrypt: ') if is_it_sign == 'yes...
2dd667b9bc66a9c79f23bcdf9517d543bc00781b
deshearth/python-exercise
/chap3/makeTextFile.py
631
3.8125
4
#! /usr/bin/env python 'makeTextFile.py -- read and display text file' import os ls = os.linesep #get file name fname = raw_input('Enter the filename(include the path): ') while True: if os.path.exists(fname): print "ERROR: '%s' already exist" % fname break #get file content (text lines) all = [] print "\nE...
756e7085d957d4be07f0dccaf65267840e52c201
frontendcafe/py-study-group
/ejercicios/ejerciciosGeneral/ej7-pruebas/amit.py
1,520
3.96875
4
class FuncionesMatematicas: """Math Functions Class""" def average(self, a): """Average from list""" if a: sum = 0 for num in a: sum += num return 0 if sum == 0 else sum / len(a) else: return a def maximum(self, a): """Max value from list""" #return max(a) if a: max = a[0] ...
39e5152fe27a328cb27f696e92b3ebcf7ef3e953
yanioaioan/PythonTutoring
/task3/2/buySmth.py
2,650
4.09375
4
#2)create a program that executes essentially brings down the stock levels (sell/buy) (optional) # Updates the stocks file import csv #re-read csv r = csv.reader(open('stock.csv'),delimiter=',') # Here your csv file #lines will contain all rows of r lines = [l for l in r] print(lines) '''Iterate through the file...
b1ebd9160734dfbab08092811024f1be726a3a16
dpuman/CodeWithMoshPython
/PWM/Class2.py
146
3.921875
4
#Vaiables ''' name='Dipu' Age=20 isNew=True ''' name=input('What is your name? ') color=input('Your Favorite color? ') print(name+' Likes '+color)
f6cec2a2410195b5b253ae1b3656492157cee1e1
RashikAnsar/everyday_coding
/gfg_python/basic/8_prime_numbers.py
533
4.09375
4
# print all the prime numbers in an interval def prime_numbers(start, end): primes = [] for i in range(start, end): if i >= 2: for j in range(2, i): if(i % j == 0): break else: primes.append(i) return primes if __name__ ==...