blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
051391efda8bddc0d6e068e7f8fb9ce2f27b8b62
rokrokss/baekjoon
/5373 - 큐빙/5373.py
4,588
3.609375
4
import sys def rotate_face(cube, side, direction): idx = 0 if side == "D": idx += 9 elif side == "F": idx += 18 elif side == "B": idx += 27 elif side == "L": idx += 36 elif side == "R": idx += 45 tmp = cube[idx:idx+9] if direction == "+": ...
f4cdaf2bd920c85fef0bfd1595c8c38b592b1e0b
nestormarlier/python
/condicionales/condicionalesif.py
194
3.671875
4
def examen(valor): if valor>=4: return True else: return False nota=input("Introduce nota: ") if examen(int(nota)): print("Aprobado") else: print("Desaprobado")
561b0d33ea4d9094d746a74d6227c391fecdd15e
nestormarlier/python
/Listas/list.py
1,109
4.15625
4
nombres=["Nestor",38,"Estefy",32,"Julia",4,"Mia",10] print(nombres) print("---------------------------------------") print(nombres[3]) # numero 32 print("---------------------------------------") print(nombres[-8]) print("---------------------------------------") milista=["Mia","Julia","Estefy","Nestor","Julia","Julia...
ee9351d64051777a913f2d948093460d0005db21
nestormarlier/python
/Funciones/defparametros.py
150
3.59375
4
val1=int(input("Ingrese primer valor")) val2=int(input("Ingrese segundo valor")) def suma(n1,n2): print("La suma es:" , + n1+n2) suma(val1,val2)
350141b934355faf14a0149d8363d48d72b6ce08
nestormarlier/python
/condicionales/ejerciciocondicionales.py
633
4.03125
4
salarioPresidente=int(input("Introduce salario Presidente: ")) salarioJefe=int(input("Introduce salario Jefe de area: ")) salarioEmpleado=int(input("Introduce salario Empleado: ")) salarioVigilador=int(input("Introduce salario Vigilador: ")) print("El sueldo del Presidente: " + str(salarioPresidente)) print("El sueldo...
c573a7e74d6de0a29c12bf90c33a29ee476297f9
muhkuh-sys/mbs
/deploy/deploy_version.py
3,822
3.578125
4
# -*- coding: utf-8 -*- import re # The version class accepts a version number either as string or three numbers. # A version object can be compared to another version. Addition and subtraction are # also possible. Furthermore the version components can be accessed with lVersion_Maj, *_Min and *_Sub. class version()...
86c5ee37da72317d0049808af7912b328733291c
compsciteacher/AdvancedProg2018
/midterm/midterm.py
7,508
3.5
4
''' 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT...
cd4bc8e95948ca397d2b2c613059fbef3bcb3078
faressoltani55/SecurityToolBox
/src/pages/symmetric_decryption.py
649
3.59375
4
import streamlit as st from src.logic.symmetric.functions import get_algorithm, decrypt def write(): st.title("Decrypt a message using a symmetric encryption algorithm:") cipher_text = st.text_input("Enter your cipher text here") if st.button("Get algorithm:"): algorithm = get_algorithm(cipher_t...
5ebdaad7351203d986f9f568c77b93b2c26147ce
jdzejdzej/authors_task
/main.py
3,403
3.9375
4
from typing import Optional import re import pandas as pd from collections import defaultdict import click def select_set_of_authors(df: pd.DataFrame) -> set: """ Extract all authors from `authors` column. Each row of authors column is string representation of list of authors. :param df: ...
23a7cfb246e7955c86726cf26b3518bcba7bda10
learnfromfail/MyLearningNotes
/python/function_3.py
184
3.65625
4
def say_hi(name): print("Hello User "+ name) def cube(num): return num^3 say_hi("Eric") if cube(99) <= 100-20: print(cube(99)) else: print("haha")
236a58d96f0355ff2c6d8d5b4f9c8db1934652ac
ghazi-naceur/python-tutorials
/1-data_structures/lists.py
922
4.0625
4
if __name__ == '__main__': int_list = [1, 2, 3] mixed_list = ["this is a string", 1, 5.0, "Netero", 5, 6] print(len(int_list)) print(len(mixed_list)) another_list = ["one", "two", "three"] print(another_list[0]) print(another_list[1:]) yet_another_list = ["four", "five"] concatenat...
79a9251f9424e9fd0ad74bdda77b2fdaf3ca4d6a
ghazi-naceur/python-tutorials
/11-advanced_modules/timing_python_program.py
963
3.734375
4
def func1(n): return [str(num) for num in range(n)] def func2(n): return list(map(str, range(n))) if __name__ == '__main__': import time start_time_func1 = time.time() func1(10000000) end_time_func1 = time.time() print(f"Elapsed time func 1 = {end_time_func1 - start_time_func1}") ...
90eed61f119d4863063548cde989e51a3794844b
ghazi-naceur/python-tutorials
/1-data_structures/tuples.py
313
3.859375
4
if __name__ == '__main__': tuple = (1,2,3, "four", 5.0, "four", "four") list = [1,2,3] print(tuple) print(list) print(len(tuple)) print(tuple[0]) print(tuple[-2]) print(tuple.count("four")) print(tuple.index(5.0)) # tuple[0] = "kfj" # Mutability is not allowed for a tuple
e3689632805da5164df9d6b12358201f981050a2
akashbhanu009/Simple-Inheritance
/Inheritance.py
426
4
4
class Engine: a=10 def __init__(self): self.b=20 def m1(self): print("This is engine class method m1()") class car: def __init__(self): self.engine=Engine() def m2(self): print("This is another class car which inherite the properties of class Engine") ...
7a760e430fdcec7370ec8f3ef04bb6a06b2fa11d
crivieccio/100days
/day_18/main.py
1,064
3.8125
4
from random import randrange from turtle import Screen, Turtle, heading timmy = Turtle() timmy.shape("turtle") timmy.speed("fastest") # for _ in range(4): # timmy.forward(100) # timmy.right(90) # for i in range(50): # if i % 2 == 0: # timmy.pendown() # else: # timmy.penup() # timm...
c6ab91f9e65f57fc71ab28fb8c53300ce245ca90
Morgan1you1da1best/unit3
/fives.py
109
4.0625
4
#Morgan Baughman #9/27/17 #fives.py num = int(input('Enter a number: ')) for num in range(0,num,5): print(num)
e75aaa4f8d8c7bc73f39ba46967485f809995f3e
Wprofessor/PythonNote
/python学习笔记/python编程基础/字符串/validateInput.py
331
3.890625
4
while True: print('Enter your age') age = input() if age.isdecimal(): # 如果年龄都是数字 break print('重新输入') while True: print('输入你的密码') password = input() if password.isalnum(): #如果密码仅由数字和字母构成 break print('重新输入密码')
9bd11c105b641e11a47e5853dbeeb328c1354533
Wprofessor/PythonNote
/python学习笔记/python编程基础/字符串/picnicTable.py
318
3.890625
4
def printPicnic(count, left, right): print('PICNIC ITEMS'.center(left + right, '-')) # just()和center()都是填充 for k, v in count.items(): print(k.ljust(left, '.') + str(v)) count = {'sandwiches': 4, 'apples': 12, 'cups': 4, 'cookies': 8000} printPicnic(count, 12, 5) printPicnic(count, 20, 6)
3922e3dd2772e9c6377d7aa42359c4328963c53d
Wprofessor/PythonNote
/python学习笔记/python编程基础/控制流/import.py
182
3.515625
4
import sys,os,math #直接3种模块 from random import * #调用random模块的函数可以不用前缀 for i in range(5): print(randint(1,10)) #randint属于random模块
2d0cbb255589fbf0743b5fad980517dddab8fc99
Vrushali-Kolhe/Assignments
/ass1/p4.py
477
4.09375
4
import random number = random.randint(1,100) print("You have 10 chance to guess the number correctly.The number is between 1 to 100") for i in range(10): guess_no = int(input("Guess the number :")) if guess_no == number : print(f"YOU WIN!!!\nYou guessed it in {i+1} times.") break else: if i == 9: print("YOU...
de55e8c576413217b24492c4ae23ba44c4001ab3
Vrushali-Kolhe/Assignments
/ass1/p9.py
328
3.515625
4
#to find harmonic divisor no. nos = [] print("Harmonic Divisor Numbers are:") for x in range(6,10000): if len(nos)>10: break list = [] for i in range(1, x+1): if x%i == 0: list.append(i) sum=0 for j in range(len(list)): sum=sum+(1/list[j]) har = len(list)/sum if har.is_integer() : print(x) nos.app...
cd1bf63d9f17b97459efcc3da5c505c4758f3e07
Levyathanus/Dijkstra
/dijkstra.py
5,451
3.71875
4
#!/usr/bin/env python3 import graph INF = float("inf") # G = (N, E): input graph (refer to graph.py). It must be a positive weighted graph! # root: starting node # end: arrival node # P: ordered list of connected nodes from root to end minimizing the total path cost ($1 returned value) # D: distances between the curr...
ce6b30c925e15852435fc066e96d6733a585aeb2
Aymen-haddaji-hub/holbertonschool-low_level_programming
/0x1C-makefiles/5-island_perimeter.py
473
3.609375
4
#!/usr/bin/python3 """Defines an island perimeter.""" def island_perimeter(grid): """Return the perimiter of an island.""" toul = len(grid) oordh = len(grid[0]) mourabamahsour = 0 mourabaa = 0 for i in range(toul): for j in range(oordh): if grid[i][j] == 1: ...
0ab0c2d8131d10011d5cb01258ab6a2d7c21866b
JoanaSouza02/Aula-python
/exercicio1.py
224
4
4
valor1 = int(input('Digite o valor 1:')) valor2 = int(input('Digite o valor 2:')) print(valor1 + valor2) print(valor1 - valor2) print(valor1 / valor2) print(valor1 + valor2 /2) print(valor1 % valor2) print(valor1 * valor2)
c1686d1074db20a2c4bcde4524d41ccfd2ddf3d5
jt-lanl/cov-voc
/insertdashes.py
1,461
3.546875
4
'''Insert dashes at a given site for these fasta files''' import argparse from verbose import verbose as v import intlist import readseq def _getargs(): '''parse options from command line''' argparser = argparse.ArgumentParser(description=__doc__) paa = argparser.add_argument paa("--input","-i", ...
0e197a3cadbf1b0c451f8a129af77b9794d4a823
alexpear/alexpear.github.io
/python/waffle.py
11,413
3.796875
4
#!/usr/bin/python ''' python object based representation of generated worlds simulation / stepping compatible for interactive fiction, games, sims, and toys 'waffle' name comes from the novel You by Austin Grossman ''' import pickle import random class Util: # Users count 1,2,3 while programmers count 0,1,2 # Ki...
c8002dc5b18cffb09d739101b1c02973a68121dd
Swathi-N-Shayana/CodeDump-Python
/day3.py
324
4.09375
4
#Task #Read two integers from STDIN and print three lines where: #1.The first line contains the sum of the two numbers. #2.The second line contains the difference of the two numbers (first - second). #3.The third line contains the product of the two numbers. a=int(input()) b=int(input()) print(a+b) print(a-b) print(a...
aff0a0daf2f91e5aa8f958c989bf4be59a26bd3b
jabertuhin/project-euler
/2-even-fibonacci-numbers.py
771
3.984375
4
""" Problem Link: https://www.hackerrank.com/contests/projecteuler/challenges/euler002/problem Resources: 1 - https://medium.com/@TheZaki/project-euler-2-even-fibonacci-numbers-2219e9438970 """ def get_sum_of_even_fibonacci_numbers(number): even_fn_1 = 8 #Fn-1 even_fn_2 = 2 #Fn-2 result = even_fn_1...
2917d8d0c63fb84d014cedbad96216a4e8066533
kienzen/Blackjack
/Blackjack.py
4,063
3.546875
4
import random class CardDeck(): def __init__(self): self.deck = {"2": 4, "3": 4, "4": 4, "5": 4, "6": 4, "7": 4, "8": 4, "9": 4, "10": 4, "Jack": 4, "Queen": 4, "King": 4, "Ace": 4} def disp(self): print(str(self.deck)) def pull(self, x): pull_set = [] ...
a33bec95d67cfacdee9c3a775c86c43f9415a505
mattstewie068/Path-Spline-Generator
/angle_move_and_visualize.py
2,568
4
4
import pygame # Define some colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) WindowHeight = 500 WindowWidth = 1000 radius = 30 def my_function(): print("Hello from a function") class Point: def __init__(self, pos_in, color_in): self.pos = p...
8c2ed7c4f43baed80e61b7574dc77790c11cb76c
Asael-Garcia/Bicicleta_POO
/bicicleta.py
6,775
4
4
import os #clase llanta con sus propiedades class Llanta: def __init__(self): self.__presion=0 self.__rodada=0 #clase suspension que hereda lo de llanta, en este caso el construcotr y las propiedades class Suspension(Llanta): def crear(self):#propiedades de las suspensiones ...
6780c3b8877e12d9f99ece3881afb52db1da3df5
klin4744/CtCi-Algos-Python-JS
/Arrays and Strings/URLify.py
756
3.625
4
def URLify(arr, length): num_of_spaces = getSpaces(arr) newIndex = length + num_of_spaces * 2 - 1 oldIndex = length - 1 while oldIndex >= 0: char = arr[oldIndex] if char is " ": arr[newIndex] = "0" arr[newIndex - 1] = "2" arr[newIndex - 2] = "%" ...
66931d4afb4df21b21fd5d6646bd36ae45269115
adiffloth/exercism-python
/research/ex.py
823
3.578125
4
""" Perform Run Length Encoding compression on a string. """ def compress(raw: str) -> bytes: """ Compress the raw string to bytes using RLE. """ if not raw: return b'' input_bytes = bytes(raw, 'UTF-8') compressed_bytes = bytearray() prev_byte = input_bytes[0] run = 1 for ...
45a1b6f720d081594dfab848585a33ef8ed85ee3
Ramsum123/Python
/baby_name.py
1,957
3.796875
4
from numpy import * import numpy as np import random2 from array import * import os ## to run the loop class Daughter(object): def take_input(self): h = input('What is your name?') g = int(input('Enter the number of character you want to be in your baby name.')) f = input("Enter your spouse...
97987f5f0777caa07bd8a98bc997a1c33ef81646
chapiiin/OSC
/OSC.py
5,717
3.828125
4
import sqlite3 from sqlite3 import Error from loginLogout import LoginView from loginLogout import LogoutView from DatabaseFile import DatabaseSystem from SystemFile import System #user login function def Login(connection): account_exists = False; username = input("Please enter a valid username: ") ...
d6f723ac20e113c83f73f4baa91c7334137f2fef
DoubleBlock/PythonCookbook
/Chapter1/1.6.py
729
4.09375
4
# 字典中的键映射多个值 # 值放到另外的容器中 选择使用列表还是集合取决于你的实际需求。如果你想保持元素的插入顺序就应该 # 使用列表,如果想去掉重复元素就使用集合(并且不关心元素的顺序问题)。 from collections import defaultdict # d = { # 'a' : [1, 2, 3], # 'b' : [4, 5] # } # e= { # 'a' : {1, 2, 3}, # 'b' : {4, 5} # } # d= defaultdict(list) # d['a'].append(1) # d['a'].append(2) # print(d['a']) ...
f2ea793f3b64f9cfa97292cfcbca3cd946c68db7
DoubleBlock/PythonCookbook
/Chapter5/5.7.py
576
3.703125
4
# 读写压缩文件 # 读写一个gzip或bz2格式的压缩文件 import gzip import bz2 with gzip.open('somefile.gz', 'rt') as f: text= f.read() with gzip.open('somefile.bz', 'rt') as f: text1= f.read() # compresslevel指定压缩级别 with gzip.open('somefile3.gz', 'wt', compresslevel=5) as f: text='hello' f.write(text) ''' gzip.open() 和 bz2....
ae0822979e7e9b8d899ad5b1942453704333d3fb
DoubleBlock/PythonCookbook
/Chapter1/1.10.py
991
3.890625
4
# 怎样在一个序列上保持顺序并消除重复的值 # 1.如果序列上的值是可哈希(hashable)类型,可利用集合和生成器解决 def dedupe(items): seen= set() # 创建一个空集合用set()方法而不是seen={},这是创建空字典 for item in items: if item not in seen: yield item seen.add(item) a= [1, 1, 1, 2, 4, 8, 9] print(list(dedupe(a))) # 2.不可哈希类型dict类型,也可用于单个字段、属性或者更大的...
5b9f85a868cbf3846ed677b2a92468edefe32f83
DoubleBlock/PythonCookbook
/Chapter1/1.1.py
688
3.65625
4
# 解压序列赋值给多个变量 # 现在有一个包含N个元素的元组或是序列,怎么将里边的元素同时赋值给N个变量 p= (4, 5) x, y= p # x=4 y=5 data = [ 'ACME', 50, 91.1, (2012, 12, 21) ] name, shares, price, date= data # name='ACME' date=(2012,12,21) # 变量的个数与元素的个数相等以上才生效,不等会报错 # 这种解压赋值可以用于任何可迭代对象上,还包括字符串,文件对象,迭代器,生成器 s= 'hello' a, b, c, d, e= s # 可以用任意变量名占位纸解压部分元素,不需要的舍弃掉部分元素...
cd61f826fe9980994f0f297c9218b1a6f94e7638
bradleybossard/python-pil-play
/draw_text_getsize.py
572
3.78125
4
from PIL import Image, ImageDraw, ImageFont """ Drawing text that exactly fits inside a rectangle""" def draw_text(text, size, fill=None): font = ImageFont.truetype('/Library/Fonts/Impact.ttf', 30) size = font.getsize(text) # Returns the width and height of the given text, as a 2-tuple. im = Image.new('RGB...
78b4a3a216ee7ada5f183c44124c2e017023aec6
AdrianWojewoda/Python-CodinGame
/ASCII ART.py
850
3.796875
4
#ASCII ART #Task URL: #https://www.codingame.com/ide/puzzle/ascii-art #Autor: #Adrian Wojewoda import sys import math # Auto-generated code below aims at helping you parse # the standard input according to the problem statement. l = int(input()) h = int(input()) t = input() alphabet = "ABCDEFGHIJK...
d0a58d654c32446a5f8dde267283d74cd628ada3
PujaNaval/Python-Programs
/listmethods.py
395
4.15625
4
list1= ['computr', 1991, 60] list2 = ['Mechanical',1987,120] list3 = [10,12,14,15] print (list1) print (list2) a = len (list1) #to find length of list print ('length of list is:',a) m = max(list3) #find maximum number print ('maximum number is: ',m) m = min(list3) ...
d796cb23c139cc58956a662abbf0571331e6e3f1
PujaNaval/Python-Programs
/for3.py
179
4.28125
4
number = [1,3,5,7,9] for n in number: if n%2==0: print("list contain an even number") break else: print("list does not contain an even number")
bea7a5c8ea1f3c5651d6b5c1dd52a87b62b52daa
PujaNaval/Python-Programs
/stringmethods.py
1,013
4.09375
4
str = (input('Enter string')) print (str) cap = str.capitalize() #first letter of string is capital print (cap) cen = str.center(10,'H') #total width of the string and fill character print (cen) l = len(str) print ("Length of string is %d"%(l)) #find length of the string c = str.count('s',0...
76bfaa665c75d1d442d4abea9927939ee7f1f305
shimano-yuuki/trump
/bakara.py
7,009
3.609375
4
import random def draw(deck): card=deck.pop() return card def calc(hand): s =0 for card in hand: if 9<card[1]: s+=0 else: s+=card[1] return s def make_deck(): deck =[] marks =["♡","♤","♢","♧"] for mark in marks: for kazu in range(1,14)...
de22fbb6375915a699b98cae95d437e641840d16
slg123/combat
/battleship.py
1,219
4.15625
4
#!/usr/bin/env python from random import randint board = [] for i in range( 0, 5 ): board.append( [ "O" ] * 5 ) def print_board( board ): for row in board: print " ".join( row ) print_board( board ) def random_row( board ): return randint( 0, len( board ) - 1 ) def random_col( board ):...
684f2c53d83b28768429307fc9efe19d93a0ccc4
src8655/python_practice01
/prob05.py
560
3.859375
4
# 문제5. # 주어진 리스트 데이터를 이용하여 3의 배수의 개수와 배수의 합을 구하여 출력형태와 같이 출력하세요. listdata = [0, 1, 5, 6, 11, 15, 50, 70, 88, 89, 90, 91, 100, 150, 156] print(len(listdata), type(listdata)) list_cnt = 0 list_sum = 0 for i in range(0, len(listdata)): if listdata[i] % 3 == 0 and listdata[i] != 0: list_cnt += 1 list_...
1af61fcdfa1d7b0cf365a7f27a997a673753c3d2
CianOSull/BigDataAnalyticsAssignment3
/A03_Part2/my_reducer.py
3,381
3.78125
4
#!/usr/bin/python # -------------------------------------------------------- # # PYTHON PROGRAM DEFINITION # # The knowledge a computer has of Python can be specified in 3 levels: # (1) Prelude knowledge --> The computer has it by default. # (2) Borrowed knowledge --> The computer gets this knowledge from 3rd party lib...
0f905e9aefa3e03c69867fd67546d8317696325f
pooniavaibhav/dataStructureAlgorithms
/Stacks&Queues/Stacksimplelist.py
1,268
4.4375
4
""" We know that in stack insertion and deletion is done only at one end which is called the top of the stack. [3,4,6,8] In above list if we consider top before three at every pop and push we have to shift all the elements left or right. But if we consider top after 8 we need not to shift others. """ class EmptyStackE...
5a0581d22944148fe6edabb2b80479e540ed6205
matson/Crypto-Course
/secureSemantic.py
2,090
3.609375
4
#Semanitcally Secure Cipher import random import string #Semanitcally Secure Cipher #Need 5 pairs ctxt/ptxt #pair 1 plainText1 = "Hello!" key1 = "duh" #confirmed #pair 2 plainText2 = "cold weather" key2 = "fhtg" #pair 3 plainText3 = "chocolate" key3 = "eyhthgf" #pair 4 plainText4 = "butter" key4 = "thfbhh" #pair 5 ...
62ca173cfdad1e407ce1554aef79928519c610d3
harishbk77/python-challenge
/PyBank/main.py
2,083
3.640625
4
#********************************************** # # PyBank Homework 3/16/2019 # Harish Krishna # #********************************************** import os import csv csvpath = "./budget_data.csv" with open(csvpath, newline='') as csvfile: # CSV reader reads from current directory csvreader = csv.reader(csv...
2cf50c967701c3292e4ff615eedb0fd1a83b61b0
IonutPopovici1992/GIS
/ArcPy_part1/functions.py
242
3.640625
4
def greet(): return 'Hello, World!!!' def average(x, y, z): return (x + y + z) / 3.0 print(greet()) a = average(1, 2, 3) print(a) print(type(a)) b = average(10, 20, 30) print(b) print(type(b)) s = greet() print(s) print(type(s))
8d1e2def71488edb439f043b5677a0d9c59ca6db
liuyuqing11/mycode
/PythonCode/multiprocessing.py
2,014
4.125
4
#要让python实现多进程(multiprocessing),先要了解操作系统相关背景知识 #Unix/Linux操作系统提供了fork()系统调用,其和一般的函数调用相比特殊点在于:普通函数调用一次返回一次,fork()调用一次返回2次 #因为操作系统自动把当前进程(父进程)复制了一份(子进程),然后分别在父进程和子进程内返回. #有了fork调用,一个进程在接到新任务时就可以=复制出一个子进程来处理新任务 #子进程返回0,父进程返回子进程的ID,----这样做的原因:一个父进程可以fork出很多子进程,父进程需要记下每个子进程id,而子进程只需调用getppid()就可以拿到父进程的ID #windoes没有fork系统调用 ...
c2c7ff71a75f1b2e539df8dbb1c2235183993ee9
liuyuqing11/mycode
/PythonCode/gaoji.py
3,869
3.515625
4
import os #python 高级特性专题 #1.列表生成式:python内置的简单强大的创建list的生成式 #在写列表生成式时,生成的元素(x*x)要置于前面,后面跟for循环 res1 = [x * x for x in range(1, 11)] print(res1)#[1, 4, 9, 16, 25, 36, 49, 64, 81, 100] #for循环可以使用多个变量,列表生成式也可以使用多个变量来生成list test_d = {"a":"apple", "b":"blue", "c":"con"} res12 = [ k + '=' + v for k, v in test_d.items...
2241860c03f80c1a4f44147070af560bd63b5d22
phat071100/gioithieu
/Bai_1.py
435
3.71875
4
def cong(a,b): phepcong = a + b return phepcong def nhan(a,b): phepnhan = a * b return phepnhan while True: try: x = float(input("Nhập số thứ nhất:")) y = float(input("Nhập số thứ hai:")) break except: print("bạn đã nhập sai") continue Q = co...
4defc049f956e110d84d7cece9a7e598f955d18b
UmairHabib/Technical-Assesment
/Cheetay Logistics Assesment Solutions/Q3.py
937
3.578125
4
def longestSubstrDitinctChars(S): # Time Complexity required is O(N) where N is length of string # Space Complexity required is O(1) here only unique characters are stored which are constant i.e. 26 alphabets only try: length = len(S) left = right = result = 0 uniqueChar = set(...
7fb014aa71a06594dcea3b06b826251a3b9532e4
karolkrssk/Python-Lab3
/lab/ex1/observer_impl/observer.py
621
3.765625
4
from abc import ABC, abstractmethod class Observer(ABC): def __init__(self): super().__init__() @abstractmethod def update(self, *args, **kwargs): pass class FirstObserver(Observer): def __init__(self): super.__init__() def update(self, *args, **kwargs): print("...
6a90c60e55bc39669b81b472b149880b9a0ac000
Stephen-Kamau/Python_Music_Storage-system
/modify.py
2,967
4.03125
4
import sqlite3 import databaseCreate #this files is for making changes to the database db=sqlite3.connect("SongStorage.db") def ModifySong(): databaseCreate.createDb() print ("===============================") print ( "MODIFY A the database RECORD:") print ("===============================") songT...
420b330cdecb55ef9467585e0119b6f464bed5a7
sangeeta97/graph-algorithms
/graph.py
8,700
3.9375
4
#!/usr/bin/env python # coding: utf-8 # In[209]: from collections import defaultdict #This class represents a directed graph using adjacency list representation class Graph: def __init__(self,vertices): self.V= vertices #No. of vertices self.graph = defaultdict(list) # default dictio...
918e3753cc21c01768bba6fbba541601a6a5ca85
Alessandragr/Capgemini
/Desafio 1/Desafio 1.py
475
3.59375
4
from math import ceil visualizacao = None; cliques = None; compartilha = None; investimento = int(input("Digite o valor a ser investido:")); print("O valor investido é: ", investimento); visualizacao = investimento * 30; for i in range(4): cliques = ceil(visualizacao * 12 / 100); compa...
7f096cf315773030804ca01be07bfc9ec954e62b
aravindb212/python_basic_scripts
/1trails.py
270
4.15625
4
import math print("calculates LCM of two numbers \n ") a= int(input("Enter first number: ")) b= int(input("Enter second number: ")) gcd= (math.gcd(a,b)) GCD= str(gcd) print("GCD= "+ GCD) lcm= str(a*b/gcd) print("LCM= "+ lcm) input("\npress enter to continue")
024ec49814e56ab446f365086ff20959d4b19720
aravindb212/python_basic_scripts
/hello.py
282
3.96875
4
# hello program and asks my name print('Hello World!') print('whats your name ?') name= input() print('wow great..,'+ name) print('the lenghth of your name is:') print(len(name)) print('what z ur age') age=input() print('YOU WILL BE :'+ str(int(age)+1)+ ' IN A YEAR')
0f7cbeb930cb97a9934c0f36b8b9c9a42fddda40
fishykz/ACTF_Junior_2020
/Crypto/中等题/crypto-rsa3/solution/anothersol.py
659
3.5625
4
import threading def isqrt(n): x = n y = (x + n // x) // 2 while y < x: x = y y = (x + n // x) // 2 return x def Fermat(num, x): y2 = x*x - num; y = isqrt(y2); if y*y == y2: print([x+y, x-y]); if __name__ == "__main__": num = int(input('n=')) x = isqrt(num) ...
b4a841d70d4104908887566e4872ec402cd17632
omivore/connect4
/rules/lowinverse.py
1,871
3.625
4
# lowinverse.py import computer import itertools def generate_solutions(board, me): # Find all combinations of columns. For each pair's columns, find all possible pairs of two vertically consecutive squares # that have an odd upper square and are empty. Find all combinations of these square pairs to each othe...
049cd796cff1b3a5599f215d1d05c4ea46a5454e
shahrulnizam/rpi-lesson
/basic.py
918
4.125
4
from datetime import datetime import random print "Hello! My name is Python. I am a programming language." name = raw_input("What's your name? ") print "It's nice to meet you " + name + "!" year = raw_input("What's your year of birth? ") age = datetime.now().year - int(year) print "You are " + st...
892ebcd41ec5a439244bde8a4ed679307d59076a
the-rectifier/TUC_labs
/4th_Sem/COMP202_labs/python_bst/bst.py
2,295
4.0625
4
""" This module contains 2 classes: Node: The node class having 3 arguments: private key public left child public right child Bst: The actual Tree representation with the basic methods search/insert/delete and its str representation """ class Node: def __init__(self, key): """ Node's Constructor:...
af9528f0ae338d4fca580d9a5587bb6a421864a0
Rishisaiganesh/Python_Coreprogram
/Flip.py
1,330
4.125
4
''' @Author : Rishisaiganesh @Date : 2021-11-09 @Last Modify by : Rishisaiganesh @Title : find head and tail percentage by using random() function ''' import random result = ("HEAD","TAIL") if_ITnot_Head = 0 if_Itnot_Tail = 0 i = 0 value = True while (value == True): try: print("Enter the n...
70423fec55a6dd24ec8cbad9c83dc307eba65b46
Rishisaiganesh/Python_Coreprogram
/Coupan.py
1,044
3.953125
4
''' @Author : Rishisaiganesh @Date : 11-11-2021 @Tittle : Taking Input and printing N Distance CoupanNumbers ''' import random class Coupannumber(): def __init__(self,coupan): self.choose_number = coupan def calculatingNumber(self): distinct_number = [] while len(distin...
6c356bb3cccb9dbb5b14f6ab63e06c6dd90473eb
objectrocket/python-client
/tests/utils.py
598
3.921875
4
def comparable_dictionaries(d1, d2): """ :param d1: dictionary :param d2: dictionary :return: True if d1 and d2 have the same keys and False otherwise util function to compare two dictionaries for matching keys (including nested keys), ignoring values """ for key in d1: if key ...
b073f7fcb57e3d4d33b589edd4285c7df81d614f
RubyEye7/Week-1
/Starwave.py
305
4
4
b = int(input("How wide do you want it: ")) c = int(input("How many waves: ")) count = 1 while(c >= count): print(count) print(b) print(c) count += 1 while(b >= count): count += 1 print("*" * count) while(count > 0): count -= 1 print("*" * count)
df6d5b95cc5fec28df216f83db85bc517b153671
nicole4520/python_intro
/lesson1.py
1,061
4.28125
4
# Madlibs : # 1. create a few variables that get certain bits from the user # 2. print out a string with a short story, using the info gathered # this will give me a way to get information from a user name = raw_input("what is your name?") number = raw_input("What is your favourite number between 1-10?") animal = raw_i...
7971cee41f443c50ff1d4ede64163da35586bcb7
grigorghazaryan/python-homeworks
/Homework Dict and Files/homework_01.py
169
4.1875
4
# 1. Write a Python program to read first n lines of a file. lines = 3 with open("file.txt") as file: for f in file.readlines()[0:lines]: print(f.rstrip())
2ee26037cf5ccded93940b90ecb736f2f1b755dc
grigorghazaryan/python-homeworks
/Homework Dict and Files/homework_04.py
447
4.5
4
# 4. Write a Python program # that takes a text file as input # and returns the number of words of a given text file. with open("file.txt") as file: lines = 0 words = 0 chars = 0 for line in file: line = line.strip("\n") lines += 1 words += len(line.split()) chars ...
c6e0e6a70edec32369c65b4f7325a1b9c74a51b0
hooverpty/hola-mundo
/Test.py
5,558
3.90625
4
# Notas sobre la libreria Tkinter de Python para la generacion de interfases graficas.# # Ing. Haim Martinez # jhaim04@gmail.com import tkinter # Esta es la libreria que estoy utilizando para realizar las interfaces graficas. from tkinter import * #Importamos todos los widgets que tkinter tiene para generar las inter...
d725feae781fc319d3d7e3e362a6af2b5e6988f8
pratyushpratik/pythonBasicsLCO
/basicsOne.py
394
3.890625
4
print("Hello World!") #dataTypes int_score = 3 float_score = 3.0 str_score = "Hey World" print(str_score) print(str_score[0]) print(str_score[2:6]) print(str_score[2:]) print(str_score[:6]) mylist = ['hulk', 3.87, 'spiderman', 4] print(mylist) print(mylist[1:3]) mytuple = ("text", 4.8) mydict = {"name": "Pratyus...
19d8efe2d70d81ea08a748eefd077041a5ad9d44
JMcWhorter150/2019-11-function-demo
/tic_tac_toe2.py
3,323
4.28125
4
# 1. Make a 3x3 board board = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]] # 2. Make a way to change the board def move(board, location, player): row, column = location if board[row][column] != " ": print("That location is already taken.") count_change = 0 return board, count_cha...
48d775df6fac44779582fe605ffb30d4e4bcf188
anaerobeth/advent_of_code_2015
/day5.py
778
3.78125
4
import re def enough_vowels(s): return sum(letter in 'aeiou' for letter in string) >= 3 def has_doubles(s): return re.compile(r"\w*(\w)\1\w*").match(s) != None def valid(s): result = True for chars in ['ab', 'cd', 'pq', 'xy']: if chars in s: result = False return result def...
356d23c008fb2a5e4201659a2c26bda9c4734454
anaerobeth/advent_of_code_2015
/day3.py
1,401
4.15625
4
def translate_symbol_to_move(value): ''' Moves are always exactly one house to the north (^), south (v), east (>), or west (<) ''' moves = { '^': [0, 1], 'v': [0, -1], '>': [1, 0], '<': [-1, 0] } return moves.get(value) def locate_house(x, y, move_x, mov...
086c7d4579fb1a918ef5791892117c28842975d4
christa-cheung/hello-world-python-PracticeOnboardingND
/madlib_solution.py
4,842
4.59375
5
""" python 3.7.4 madlib.py Program Description: This program will contain at least 10 variables that will be printed within a short paragraph to be a complete Mad Lib. Input: A short paragraph with blanks At least 10 variables that will store 3 different data types (string, integer, and boolean). [Opt...
f876ad36ff319c0585b043c78e7f7119c126fb14
man-group/microbit
/descender.py
3,291
3.828125
4
"""An old-skool scrolling game for the BBC microbit. You are in a spaceship decending to the surface of an unknown a planet. Use the buttons to manoeuvre left and right to avoid the accumulated space junk that is suspended in orbit around he planet. Your spaceship is the bright dot on the top line of the display. The t...
1fd45e243eb40c62f3d5fda4d5622417939657b1
tinynahran/Practical-Python-with-Applications-in-Finance
/Chapter3/3_3_2_main.py
1,364
4.09375
4
''' This module creates a division function which provides an Exception message for division by zero or input that is not float or int type. ''' def divFunc(num, den): if not isinstance(num, (float, int)): raise ValueError('Please enter a number') elif not isinstance(den, (float, int)): raise ...
0c24677ed0689390fe53294bb9729f6767fc2d63
tinynahran/Practical-Python-with-Applications-in-Finance
/Chapter2/2_1_5_main.py
1,271
3.703125
4
''' This module validates methods created as part of exercise 2.1.5. ''' from classFiles.loan import Loan from classFiles.car import Lexus def main(): # This is for validation of the static methods monthlyRate and annualRate. print('Annual rate converted to monthly rate for simple interest: ' + str...
f43390eba8e4a0a447361fd41af77469cebe6d22
tinynahran/Practical-Python-with-Applications-in-Finance
/Chapter3/3_2_2_main.py
391
4.28125
4
''' This module creates a list of 1000 numbers, converts it to a reverse iterator and iterates through it ''' def main(): lst = [i for i in range(1000)] print('verifying list type: ' + str(type(lst))) li = reversed(lst) print('verifying list_reverseiterator type: ' + str(type(li))) for i in ran...
bae2a4886e2293224da3b2d2b6132fcb555e4d13
tinynahran/Practical-Python-with-Applications-in-Finance
/Chapter5/5_2_2_main.py
1,410
3.75
4
''' This module creates a decorator that memoizes the result o function and the tests. ''' from functools import wraps from classFiles.Timer.timerdec import Timer import time # Here, I use a dictionary with a string for the keys of str(args) + str(kwargs). def memoize(f): cache = {} @wraps(f) def wrapped...
c45fa5199e4324b68dcc2b735b758e96b301dc6b
tinynahran/Practical-Python-with-Applications-in-Finance
/Chapter3/3_3_3_main.py
1,014
3.984375
4
''' This module contains a factorial function and provides exception handling for invalid input. ''' def fact(n): if not isinstance(n, int) or n < 0: raise ValueError('Please enter a nonnegative integer. ') else: i = 1 for j in range(1, n + 1): i *= j return i de...
af7b5b94e9fcc03ebc18901d615be414b7d058b0
stefanliemawan/StefanLiemawan_ITP2017_FinalProject
/players.py
2,722
3.609375
4
#Import Every Class and Modules That Will be Used import pygame import sys import random from pygame.sprite import Sprite class Enemy(Sprite): def __init__(self,screen,stats): #Initialize the Class super(Enemy,self).__init__() #Initialize the Sprite Class self.stats = stats self.scre...
04f6552df807e076cd5b9fce920c3b7c613908b3
Titchy15/HackerRankPython
/TextAlignment.py
66
3.578125
4
letter = input("Enter any letter: ") width = 9 print(letter*3)
5101a20e44f610c8275f2725a2825caa9ddca475
Lokeshrathi/Face_detection
/program.py
607
3.640625
4
from cv2 import cv2 # Load the cascade face_cascade = cv2.CascadeClassifier("/home/lokesh/anaconda3/envs/my_env/Detect/haarcascade_frontalface_default.xml") # Read the input image img = cv2.imread("/home/lokesh/anaconda3/envs/my_env/Detect/WhatsApp Image 2020-04-28 at 18.18.35 (copy).jpeg") # Convert into grayscale gr...
36f7e41c301aeb9570d97f00030e078c05e594c5
perlipavan/pyanalytics
/file2.py
524
4.03125
4
import sys print(sys.version) print(43+55) 22*5 a = 5 a = 5.0 print(type(a)) b = 'joe' print(type(b)) first_string_variable = 'test' x,y,z = 2,3,7 #Tuple is a collection of values which are immutable i.e you cannot change them# my_first_tuple = (23, 34.0, True, 'Hello') print(my_first_tuple) ...
94f784c22d466b21bb8d802e722b570b73a3896c
rizkyyz/Python3-OOP-LATIHAN-DASAR
/Operasi_Aritmatika.py
893
3.5625
4
#Para Ulama ahli fiqih sepakat atas haramnya harta seorang Muslim dan kafir dzimmi. #Harta mereka tidak boleh direbut, diambil, dicuri, dimakan dengan cara yang tidak dibenarkan #syari’at, walaupun sedikit. Allâh Azza wa Jalla berfirman: #يَا أَيُّهَا الَّذِينَ آمَنُوا لَا تَأْكُلُوا أَمْوَالَكُمْ بَيْنَكُمْ بِالْب...
8adf61860d154687a9987a48067620230018cc55
casperva/life
/tki_2.py
4,088
3.578125
4
from tkinter import * import numpy as np import random class Window(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master self.init_window() self.init_menu() #Creation of init_window def init_window(self): # changing the t...
feac6749a81c81f61ecc048ca263d5e7587dd0c7
AJPassDe/dataVisualization
/dataVisualizationMicroCourse/05-distributions-exercise.py
2,059
3.5
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 7 13:11:38 2020 @author: AJ """ import pandas as pd pd.plotting.register_matplotlib_converters() import matplotlib.pyplot as plt #%matplotlib inline import seaborn as sns print("Setup Complete") # ========================================================================...
86a062647d50711708c9bc19e5eb4be1fcc58165
Deakhadevi/pythonLearning
/utils_module.py
151
3.65625
4
from exercise_biggest_number_v2_module import find_max listi = [2,4,5,75,6,34,56] res = find_max(listi) print(f'The biggest number in list is: {res}')
636e9f46da458f7254828197f7319c5f1bb3cbe6
danker11/learngit
/ddmCase/public/common/encrypt.py
1,557
3.609375
4
# !/usr/bin/python3 # -*- coding: utf-8 -*- import hashlib from Crypto.Cipher import AES import binascii # 自动填充秘钥为16的整数倍 def add_to_16(text): while len(text) % 16 != 0: text += '\0' return text # 执行加密,传入加密文本和秘钥 def encrypt(data, password): if isinstance(password, str): ...
66523e0f9a851a7f0806968a23e6100526f59785
holmfridurge/Exam
/tkinterExam.py
5,341
3.640625
4
from tkinter import * # python3 #import Tkinter as tk # python from exam import * TITLE_FONT = ("Helvetica", 18, "bold") class Application(Tk): def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) # the container is where we'll stack a bunch of frames # on top of ea...
38a6dae49a2ed2d46beead131ee0f990436651fc
MeenaSiddharthan/Training
/ScrimbaPythontutorial.py
26,667
4.21875
4
# -*- coding: utf-8 -*- """ Created on Tue Jan 12 11:57:42 2021 @author: m.siddharthan """ import numpy as np import pandas as pd ##SCRIMBA PYTHON TUTORIAL #hold [shift] + down arrow to highlight #printing text print("Hammerboi") print("Why boys") dates=8 print(f'Meena has went on {dates} failed dates'...
c0024b23dd325e0c7b34097e44a605129e39def6
macrosity/py_dev
/ex11_adv.py
913
4.15625
4
# Start off by showing the menu print (30 * '-') print (" M A I N - M E N U") print (30 * '-') print ("1. Backup") print ("2. User Management") print ("3. Reboot Server") # Add some more robust error handling by only accepting int input is_valid = 0 while not is_valid : try : choice = int ( raw_input('Enter your c...
f2be68331b254be4229ba7b1e4a06507ef9079aa
Arpan61/Greedy-1
/Problem 2.py
1,117
3.734375
4
# Time Complexity : O(n) # Space Complexity :O(1) # Did this code successfully run on Leetcode : Yes # Any problem you faced while coding this : No class Solution(object): def jump(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) <= 1: return 0...
674bfc6ed296cef198a5cf0144ba41b797473ee7
prathameshtibile/Python
/Functional programs/SumOfInteger.py
588
4.03125
4
""" * AUTHOR : Prathamesh Tibile * Date : 29-07-21 * Time : 11.00 PM * Title : A program with cubic running time. Read in N integers and counts the number of triples that sum to exactly 0. """ def triplet(array, array_len, sum): for i in range(0, array_len - 2): for j in range(i + 1, array_len - 1): ...
806312c195d2f32f6984afc24b913dfb111fa02d
prathameshtibile/Python
/Core Programs/PowerOf2.py
442
4.21875
4
""" *Author : Prathamesh Tibile *Date : 27-07-21 *Time : 1-30 PM *Title : takes a command-line argument N and prints a table of the powers of 2 that are less than or equal to 2^N.x """ def power_2(n): if n > 30: print("since 2^31 overflows an int, So enter correct number which is less than 31") ...