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 |
|---|---|---|---|---|---|---|
aea6b14967d2c4a68d6082ca11851f803fa4758c | saramissak/CSSI-labs | /python_files/payday.py | 191 | 4.15625 | 4 | hourly_rate = float(raw_input("What is your hourly rate? "))
hours_worked = float(raw_input("How many hours have you worked? "))
print("Wow! You have made $" + str(hourly_rate*hours_worked))
|
3fb27e2fc40333a799df6aa5519a74335bfe02a4 | saramissak/CSSI-labs | /python_files/pluralizer.py | 1,187 | 4 | 4 | number = int(raw_input("Number: "))
word = raw_input("Word: ")
if bool(word == "tooth") & (number > 1 or number ==0):
print(str(number)+ " " + word+"teeth")
elif bool(word == "mouse") & (number > 1 or number ==0):
print(str(number)+ " " + word+"mice")
elif bool(word == "ox") & (number > 1 or number ==0):
... |
9e05707f70aef0d4c2f60f5ce13838e4ec6b7638 | FahadTComsats/Cats-and-Dogs-Classification | /CNN_FAHAD.py | 2,416 | 3.71875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 28 15:11:13 2019
@author: fahadtariq
"""
#Part-1 building the CNN Model.
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
cl... |
d2a9c6fe612ef7083abf95a9a7015399e5a0660c | bvrpythondev/Python-code- | /manipulando.py | 336 | 3.765625 | 4 | print("\nRetornando somente as linhas que cotenham a palavra digitada")
palavra = input("Digite a palvra para busca:")
arq = open("arquivo.txt", "r")
contador =0
for linha in arq:
linha =linha.rstrip()
if palavra in linha:
contador = contador + 1
print(linha)
print("\n Foram retornados", contador, "linha... |
88e2eec65225f8483bf9ab5eec87791030d2bc39 | beny33333/MyRepo | /TicTacToe.py | 1,879 | 3.65625 | 4 |
A = ['.','.','.']
B = ['.','.','.']
C = ['.','.','.']
result_list = []
LISTA = [A,B,C]
# print(LISTA)
# def init_board():
list_to_dictionary = ['A1','A2','A3','B1','B2','B3','C1','C2','C3']
# def get_move():
while True:
guess = str(input('Please dawaj koordynaty dziwko!')).upper()
... |
a824c35b2adf8b86db70e73e46a08c75bf60a08c | iporkh/lesson2 | /ifelse_task_1_age_work.py | 290 | 4.0625 | 4 | age = int(input('Сколько тебе лет? '))
if age <= 6:
print('шкет из детсада')
elif 7 < age <= 17:
print('школоло')
elif 17 < age <= 23:
print('бездельник-студент')
elif 23 < age:
print('взрослая серьёзная работа') |
c2b6437c0aca47f04fc584b1df9b40cf8971e67f | NagarajRajula/Python | /prime1.py | 198 | 3.859375 | 4 | n1=input()
n2=int(n1)
n=int(n2/2)
c=0
print(n)
for i in range(2,n,1):
if ((n%i)==0):
c=1
if c==1:
print(n1," is not a prime")
else:
print(n1," is a prime")
|
f82caf672813de253beefd1e8899db65671845f9 | NagarajRajula/Python | /First_missing_positive_number.py | 312 | 3.5625 | 4 | n=input("enter no.of")
a=[]
for i in range(int(n)):
t=input()
a.append(int(t))
for i in range(int(n)):
for j in range(i+1,int(n),1):
if a[i]>a[j]:
temp=a[i]
a[i]=a[j]
a[j]=temp
print (a)
for i in range(int(n)):
|
f2c3f2298baf17e6c1e4b0dccf5ea4f6822cb3fb | mabotech/maboss.py | /libs/mabolab/mabolab/scheduler/later.py | 1,472 | 3.84375 | 4 |
from time import time, strftime, localtime, mktime
def weekly(days):
days = [1,2,3,4,5,6,7]
print days
pass
def daily(next):
#run_on = "17:01:02"
x = next.split(":")
if len(x) != 3:
raise Exception("time format is wrong")
y = map(lambda x : int(... |
fcb0e6fa60801da604e82c991804b3403f8e16f7 | ziymed/almusarref | /ar_ctype.py | 29,645 | 3.71875 | 4 | #!/usr/bin/python
# -*- coding=utf-8 -*-
import re, string,sys
from arabic_const import *
from verb_const import *
#!/usr/bin/python
# -*- coding=utf-8 -*-
#---
#--------------------------------------
def replace_pos (word,rep, pos):
return word[0:pos]+rep+word[pos+1:];
#--------------------------------------
def c... |
be0d9eb645a4aeadd0f5dc9e5c78336aba9d7527 | IvanKelber/plattsburgh-local-search | /Circles/circle.py | 2,119 | 4.15625 | 4 | # Created by Ivan Kelber, March 2017
import sys
import random
import math
def circles(points):
'''
- points is a list of n tuples (x,y) representing locations of n circles.
The point (x,y) at points[i] represents a circle whose center is at
(x,y) and whose radius is i.
This function retu... |
c22bb9d5dae6ddbf59f0f8bfeabed6c46c19af07 | amaankahmad/HarvardAIPython | /tictactoe_project0/tictactoe.py | 5,501 | 3.796875 | 4 | """
Tic Tac Toe Player
"""
from math import inf as infinity
import copy
import sys
import numpy as np
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
... |
92bdbdff74ca2c9e3e810d599ec6df607887247e | Marcus034/Python | /0305作業02.py | 270 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 5 20:35:27 2021
@author: USER
"""
import random
num = list()
while len(num) <= 5:
n = random.randint(1,49)
if num.count(n) == 0:
num.append(n)
print("這是您的電腦選號:",num) |
743606a3c25a96d1e7addb7ac6294bc04319f527 | NaughtyJim/learning-python | /2019-09-16/trees.py | 898 | 4.34375 | 4 | def main():
width = input('How wide should the tree be? ')
height = input('How tall should the tree be? ')
print("Here's your tree:")
print()
width = int(width)
height = int(height)
# this is the call if we omit the height
# print_tree(width, width // 2 + width % 2)
print_tree(widt... |
620049755adedcafd1811b86875a40ec5fd9d732 | nzoghb/summer-bootcamp | /Week 1/test.py | 1,612 | 3.984375 | 4 | # B@B Summer Bootcamp
# Assignment 1
# See Notebook 1 for help
import unittest
from assignment1 import *
class test1(unittest.TestCase):
def test_int_to_word(self):
self.assertEqual(int_to_word(1), "One")
self.assertEqual(int_to_word(2), "Two")
self.assertEqual(int_to_word(3), "Three")
... |
f26879b41048cab42dacac2a51063feeb9a65684 | EgorFray/diploma | /main.py | 3,325 | 3.5625 | 4 | import matplotlib.pyplot as plt
import numpy as np
d = float(input("Значення діаметра стеклопластикового стрижня: "))
pi = 3.14
LD = int(input("Лінійна щільність однієї нитки: ")) # 8750
p = 1.44
m = int(input("Кількість ниток : "))
Er = [0.05, 0.1, 0.2, 0.3, 0.4]
print("---------")
# Scc
def area_glass_tube():
... |
a136276cb3d9aadf7ed1c07852679b9c744d9a1e | rk0576/Instruc-iunea-FOR | /range5.py | 115 | 3.65625 | 4 | n=eval(input("Introduceti n="))
s=0
for x in range(1,n+1):
if (x%3==0 and x%5==0):
s+=x
print(s) |
8de325671d3b67f33373775844423c60ff2b7f89 | mattrighetti/leiserson-retiming | /algorithms/binary_search/binary_search.py | 692 | 3.875 | 4 | import numpy as np
def binary_search(search_algorithm):
"""
Binary search meant to be used as a decorator for algorithms OPT1 and OPT2
:param search_algorithm: OPT1 or OPT2 algorithms
:return:
"""
def bin_search(*args):
low = 0
high = len(args[1]) - 1
tuple_ = (np.in... |
de1deb6444bf7a19bcaa02a7475d09157ac56981 | mattrighetti/leiserson-retiming | /algorithms/clock_period.py | 2,312 | 3.609375 | 4 | import networkx as nx
__all__ = ['cp',
'delta_cp',
'all_delta_cp']
def cp(graph: nx.DiGraph) -> float:
"""
Returns the minimum clock period of a directed graph.
:param graph: A directed graph
:return: Minimum clock period of graph
"""
delta_vertices = all_delta_cp(grap... |
0535f0d2035e1954b0a49e212218212e69ed7888 | Pallavi2000/heraizen_internship | /internship/day2/filter2.py | 110 | 3.546875 | 4 | name=input("Enter your name")
lst = ['a','e','i','o','u']
print(len(list(filter( lambda x: x in lst,name ))))
|
a32ecf010adc0c1fde48a03a73def9282c101def | Pallavi2000/heraizen_internship | /internship/M_1/digit.py | 388 | 4.21875 | 4 | """program to accept a number from the user and determine the sum of digits of that number.
Repeat the operation until the sum gets to be a single digit number."""
n=int(input("Enter the value of n: "))
temp=n
digit=n
while digit>=10:
digit=0
while not n==0 :
r=n%10
digit+=r
n=n//10
... |
82b7d80de1f353d744906bbe3203149cad2299e2 | Pallavi2000/heraizen_internship | /internship/armstrong.py | 291 | 4.375 | 4 | """Program to check whether a given number is armstrong number or not"""
n=int(input("Enter the value of n: "))
temp=n
sum=0
while not temp==0:
r=temp%10
sum+=r**3
temp=temp//10
if n==sum:
print(f"{n} is a armstrong number")
else:
print(f"{n} is not a armstrong number") |
f91fb1aaa020747f561761169ae7d3092c690abe | Pallavi2000/heraizen_internship | /internship/mod2/labqns/qns8.py | 176 | 4.21875 | 4 | yr = int(input("Enter the year: "))
if (yr % 4 == 0 and yr % 100 != 0) or yr % 400 == 0 :
print(f"The given year {yr} is a leap year")
else:
print(f"Not a leap year") |
55d73f148ea7a7ae6a6df296fccc42b14684ae58 | Pallavi2000/heraizen_internship | /internship/day2/menulist.py | 974 | 4.09375 | 4 | lst=[]
def add(ele):
lst.append(ele)
def pop():
if len(lst) == 0:
print(f"List is empty")
else:
ele=lst.pop()
print(f"Popped element is {ele}")
def search(ele):
if len(lst) == 0:
print(f"List is empty")
else:
if ele in lst:
index=lst.index(ele)... |
54b56066579ec13920493a7a27ca7be34909c3ec | Pallavi2000/heraizen_internship | /python pgms/p2.py | 540 | 4 | 4 | #Checking if given 2 strings are anagrams or not
testCases = int(input())
for i in range(testCases):
flag = True
stringOne = input()
stringTwo = input()
if len(stringOne) != len(stringTwo):
print("False")
else:
for character in stringOne:
if character not in strin... |
5eed252ceca9277a0ea434f7290e80e9e3adbee9 | Pallavi2000/heraizen_internship | /internship/pali.py | 207 | 4.0625 | 4 | n=int(input("Enter the value of n: "))
rev=0
temp=n
while not temp==0:
r=temp%10
rev=(rev*10)+r
temp=temp//10
if n==rev:
print(f"{n} is a palindrome")
else:
print(f"{n} Not a palindrome") |
df713875cdf888219a2f3fcc704013df8acf8f2f | Pallavi2000/heraizen_internship | /internship/mod2/sumlist.py | 126 | 3.65625 | 4 | from functools import reduce
lst=[1,2,3,4,5,6]
res=reduce(lambda a,b:a+b,lst)
print(f"Sum of elements of the list is {res}") |
626888df8e315b01e73ed50b922cbf4cc3d3e97b | Pallavi2000/heraizen_internship | /internship/mod2/labqns/qns16.py | 269 | 3.84375 | 4 |
while True:
print(f"1.Check the stmt assertive or interrogative 2.Exit")
ch=int(input())
if ch == 1:
str = input()
if str.endwith('?'):
print(f"Interogative")
else:
print(f"Assertive")
else:
break |
12a4a145b894b0042ec099c21044f6d664762e6b | Pallavi2000/heraizen_internship | /python pgms/p5.py | 403 | 3.8125 | 4 | #Find missing numbers taking array 2 as base array
n = int(input())
arrayOne = list(map(int, input().split()))[:n]
m = int(input())
arrayTwo = list(map(int, input().split()))[:m]
missingNumbers = []
missingNumbers = []
for element in arrayTwo:
if element not in arrayOne:
missingNumbers.append(element)
... |
52cb2726637692cd21302b90f29593ab33d14f1d | Pallavi2000/heraizen_internship | /internship/M_4/4.py | 440 | 3.78125 | 4 | """try:
word_count = 0
with open("text1.txt") as f:
lines = f.readlines()
for line in lines:
word_count += len(line.split(" "))
or
words = line.split(" ")
for word in words:
word = word.strip().strip("\n").replace(',',' ').replace('.',','... |
40ac93b72c9244b3b4fe2dd07601dd2afd9a1324 | Pallavi2000/heraizen_internship | /internship/mod2/labqns/qns1.py | 313 | 4.1875 | 4 | """Program to calculate Simple interest"""
principle = float(input("Enter the principle value: "))
rate_of_interest = float(input("Enter the rate of interest: "))
time = float(input("Enter the time: "))
simple_interest = (principle * rate_of_interest * time) / 100
print(f"Simple interest = {simple_interest}")
|
5fa0ff5738f06c7171dea5093070db096b7fed40 | smile335042257/frame02iHRm | /case/Test_iHRM_Login.py | 2,703 | 3.5625 | 4 | """
封装unittest相关实现
"""
# 1.导包
import json
import unittest
import requests
import app
from api.login_api import Login
from parameterized import parameterized
def read_json():
my_list = []
with open(app.pro_path + '/data/login_data.json', encoding='utf-8') as f:
data = json.load(f)
for i in... |
9247f411454465ee2a872ddf0c33ca9a47a7aae9 | Zahu2018/PROGRAME | /matrice.py | 1,643 | 3.734375 | 4 | """MATRICE."""
import string
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""{'Author': 'Florian Zah',
'Contact': '',
'Copyright': 'Florian Zah',
'Credits': [],
'Date': 'dd.mm.yyyy',
'Description': 'creaza o matrice din cele doua siruri(1a, 1,b, .../ 2a, 2b,)',
'Last Modification': '24.09.2019y',... |
d6d13883deaedf3f3db0d95dda7a77fda53d5712 | CRaNkXD/PyMoneyOrga | /PyMoneyOrga/PyMoneyOrga/domain/account.py | 2,184 | 4.3125 | 4 | from dataclasses import dataclass
import datetime
@dataclass
class Transaction(object):
"""
Data class for transactions made from and to an account. Used in Account class.
"""
amount: int
new_balance: int
description: str
time_stamp: datetime.datetime
account_id: int = None # foreign... |
47c8166a0ae2e8c9ef5d2b38fefe83d2983e18d4 | as0113-dev/Python-Data-Structure | /mergeSort.py | 1,078 | 4.1875 | 4 | def mergeSort(array):
#base case
if len(array) <= 1:
return array
#midpoint of "array"
mid = len(array)//2
#split array in half
leftSplit = array[:mid]
rightSplit = array[mid:]
#recursively call the splitting of array
leftSplit = mergeSort(leftSplit)
rightSplit = mergeS... |
bc732950fe434e85cae236b75cbc92649e19620d | daozhangXDZ/Python_Studio | /CtypesEx/Base/Cytype_E1.py | 1,811 | 3.75 | 4 | # 基本信息和使用printf
from ctypes import * # @UnusedWildImport
print(windll.kernel32)
msvcrt = cdll.msvcrt
print(msvcrt)
print(msvcrt.printf)
msg_str = b"Hello world!\n"
msvcrt.printf(b"Testing: %s", msg_str)
# 强制刷新缓冲区,立即输出,
# 若无此句,会导致下面的python语句输出结束了才输出下面的字符串
msvcrt.fflush(0);
# 构建并使用C 数据类型
i = c_int(9)
print(i)
print(... |
94db81a05066e0e7af58a20ae9549aa22c73ce05 | khanshariqsk/testing | /py.py | 173 | 3.671875 | 4 | def closest(num):
closest=0
sum=0
start=1
while(closest<num):
sum=sum+start*start
start=start+1
if closest<num:
closest=sum
return closest
print(closest(18))
|
c1b7254f1425858f970a25d4d5844ea1a96ca224 | kvpallavi/pythontraining | /addition.py | 113 | 4.03125 | 4 | a = int (input('enter number a:'))
b = int (input('enter number b:'))
print( 'the addition of a and b is:'(a+b))
|
7a02f1b867f13b6588db9a90f0e6dee9e3c0ab2e | bryanbuiles/Python | /basic_python/0x03.py | 99 | 3.515625 | 4 | b = "Edward yesid Alvarez"
i = 0
for carac in b:
if carac == 'a' or carac == 'A':
i = i + 1
print(i)
|
2a864e64292354fb8f53cb697407dd8812ea0f3f | Veiko8/Chess | /venv/Города.py | 138 | 3.53125 | 4 | N = int(input())
a = set()
for i in range(N):
a.add(input())
x = input()
if x in a:
print('TRY ANOTHER')
else:
print('OK') |
dec0d075bb6b7de4faf3e876ac9054ceca1dc6d8 | abhishekshetye/competitive | /python/unique_email_address.py | 666 | 3.5 | 4 | class Solution:
def numUniqueEmails(self, emails: List[str]) -> int:
ans = set()
for email in emails:
val = ""
shouldIgnore = False
atDone = False
for each in email:
if each == '@':
val += each
... |
7130ef03a509ca84a9bd75e5a5b765bd6e61d58c | abhishekshetye/competitive | /python/kth_largest.py | 712 | 3.53125 | 4 | class KthLargest:
def __init__(self, k: int, nums: List[int]):
self._hp = []
self.kth = k
for num in nums:
if len(self._hp) <= k or self._hp[0] < num:
heapq.heappush(self._hp, num)
if len(self._hp) > k:
heapq.heappop(self.... |
eeee6730f798b09926285ad74b786f1deac28bed | daveymclain/Calculator | /calcbutton.py | 428 | 3.515625 | 4 | from tkinter import Button
button_width = 5
button_height = int(button_width / 2)
app_font = "Calibri {size}".format(size=str(int(button_width * 3)))
class CustomButton(Button):
def __init__(self, master=None, name_button=None):
Button.__init__(self, master, width=button_width, height=button_height, te... |
5f0e8d6a8454dff1eb25bd3dc923cac2a2ea0fe4 | kulugu2/2018_spring_ml | /lab1/show.py | 527 | 3.5 | 4 | import matplotlib.pyplot as plt
import numpy as np
import sys
def show(X, Y, l1, l2):
#X = []
#Y = []
#fp = open(sys.argv[1], 'r')
#for line in iter(fp):
# l = line.strip().split(',')
# X.append(float(l[0]))
# Y.append(float(l[1]))
x1 = np.linspace(min(X),max(X),100)
y1 = 0... |
818eee88448da542b8105c9b66cc330ec982d052 | SuperboGiuseppe/tcp_udp_client | /UDP_communication.py | 3,570 | 3.609375 | 4 | import socket
import struct
import encryption
def create_socket():
'''
Creating a new UDP socket to execute send/receive actions
:return: Socket ready to be used by the caller module
'''
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return s
def send_message(CID, UDP_port, host_addres... |
712ef851656fb64b3d7a324b49c0a4d7854e7269 | paulsilcock/prometheus | /main.py | 604 | 3.5 | 4 | from random import randint
BATCH_SIZE = 100
def generate_batch():
batch = []
for i in range(0, BATCH_SIZE):
r = randint(0, 100000000)
batch.append(r)
return set(batch)
def main():
batches = [generate_batch() for i in range(0, 10)]
unique_in_all_count = 0
unique_elements = b... |
32e8cbc32de0f0520b196d38feb18cd4000cd71c | trafo41/Hackerrank-python-domain-solutions | /class1_.py | 1,508 | 4.3125 | 4 | """ class Student:
message = "hello there"
def __init__(self,n,a,m=0):
self.name = n
self.age = a
self.marks = m
def display(self):
print("-----------------------------")
print("Your name : ", self.name)
print("Your age : ", self.age)
... |
3eb22676395dae24176a8606f60210d9e494707d | whitegreyblack/Procedural-Generation | /generate/color.py | 4,376 | 3.53125 | 4 | # COLOR FUNCTIONS
class Color:
def __init__(self, r=None, g=None, b=None):
self.color = (r, g, b)
@property
def color(self):
return self.__color
@color.setter
def color(self, rgb):
r, g, b = rgb
self.__color = combine_hex(
to_hex(r or 0),... |
9a397ffca181c1056563faac226c5349c71dc2da | Sunqg52/pythonwork1 | /Study_code/04_dictionaries.py | 2,023 | 3.765625 | 4 | # 字典:用于存储相关联的信息 类似于键值对数组
alien_0 = {'color' : 'green', 'point' : 5}
print(alien_0['color'])
print(alien_0['point'])
# 添加键值对
alien_0['x_position'] = 5
alien_0['y_position'] = 15
print(alien_0)
# 创建空字典,逐个添加键值对
alien_0 = {}
alien_0['color'] = 'green'
alien_0['point'] = 15
print(f"原字典:{alien_0}")
# 修改键值对
alien_0['colo... |
ac3ba52473cca2a5b17c4d7c7a767c062c06ca1b | Sunqg52/pythonwork1 | /Study_code/08_file.py | 954 | 3.8125 | 4 | # with(自动关闭) rstrip():去除多余空白行
# 在open函数中添加参数:r读取文件 w覆盖原有文件,写入新内容 a在原文件内容上添加新内容 r+读写模式
# 异常 try-except-esle
file_path = '/home/sunqg/test.txt'
def read_file(file_path):
# 读取
try:
with open(file_path) as file_info:
for line in file_info:
print(line.rstrip())
except FileNotFoundError:
print("你要打开的文件不存在")
... |
2475f39f1274f2c5cb4822e7aa9b8905be0fcabe | raminsaf/hokm | /Suit.py | 651 | 3.84375 | 4 | # -*- coding: utf-8 -*-
class Suit:
HEARTS = 0
SPADES = 1
DIAMONDS = 2
CLUBS = 3
SYMBOLS = { HEARTS:"♥", SPADES:"♠", DIAMONDS:"♦", CLUBS:"♣" }
NAMES = { HEARTS:"HEARTS", SPADES:"SPADES", DIAMONDS:"DIAMONDS", CLUBS:"CLUBS" }
@staticmethod
def getSuits():
return [Suit.HEARTS, Suit.SPADE... |
5f38cc6fc942f332b5112e8e7ef422f31aa2f3e4 | congduc13072k/python | /bai8.py | 1,401 | 3.828125 | 4 | #nhap 3 canh cua tam giac hay cho biet tam giac gi
a = input('canh 1 = ')
b = input('canh 2 = ')
c = input('canh 3 = ')
import math
if int(a) - (int(b) + int(c)) > 0 or int(b) - (int(a) + int(c)) > 0 or int(c) - (int(a) + int(b)) > 0 :
print('ko la tam giac')
elif a == b and b == c and a == c :
print('la tam g... |
2b93732d35dbee22032b49dc9968e6f07ad8ee89 | stavernatalia95/Lesson-5.2-Assignment | /Exercise #1.py | 781 | 4.34375 | 4 | # Assume you have the list xs = [12, 10, 32, 3, 66, 17, 42, 99, 20]
xs = [12, 10, 32, 3, 66, 17, 42, 99, 20]
# Write a loop that prints each of the numbers on a new line
for i in xs:
print(i)
# Write a loop that prints each number and its square on a new line.
for i in xs:
print(i,i**2)
# Wr... |
0f479f50a5bc3f9ef2ef68d8df4dbd2d9349798e | lakshya90/Cloud-Machine-Learning-APIs-Demo | /NaturalLanguage/entity.py | 1,116 | 3.53125 | 4 | from google.cloud import language
import six
def entities_text(text):
"""Detects entities in the text."""
language_client = language.Client()
if isinstance(text, six.binary_type):
text = text.decode('utf-8')
# Instantiates a plain text document.
document = language_client.document_from_te... |
fbb4df46b38748932aa3943a50ed5e39168637dc | TejasReddy9/UCI-Adult-2-Class-Dataset | /test.py | 308 | 3.71875 | 4 | import pandas as pd
import numpy as np
dataframe1 = pd.read_csv("cols.csv")
dataframe2 = pd.read_csv("data.csv")
dataframe = pd.DataFrame()
# print(dataframe1)
# print(dataframe2.head())
col = []
for item in dataframe1["column_name"]:
col.append(item)
dataframe2.columns = col
print(dataframe2.columns) |
586dc2b7d58986cb3e6cfe4a95c14a104bb449a3 | Avinandankhanda/python | /prime.py | 159 | 4.1875 | 4 | number=int(input('enter no'))
prime_number=[]
for a in range(0,number):
if a%3==0 :
print('divisible')
else:
print('not divisible') |
167a3cb0b5caa70624664af7ba35ad53996c977f | teguhsam/Covid19-dashboards | /other_functions.py | 1,838 | 3.5 | 4 | import math
import os
from os import path
from os import listdir
# ----------------------------------------------------------------------------------
def create_directory(path):
if not os.path.exists(path):
os.mkdir(path)
else:
print(path + ' folder already exists!')
# ------------------------... |
bb6d5ecf2f1ef70f5c8873420b9f768a967d83f6 | adichouhan14/DataScience | /assignment2/mymodule.py | 160 | 3.5625 | 4 | def oddSum(n):
s=0
for i in range(1,n,2):
s+=i
return s
def printSquares(n):
for i in range(1,n+1):
print(i**2,end=" ") |
1242154ed95a8d04ebc8f8b9843dd869e41b4259 | adichouhan14/DataScience | /assignment3/myfirstclass.py | 652 | 3.953125 | 4 | class Arithmatic:
def add(self,a,b):
return a+b
def sub(self,a,b):
return a-b
def mul(self,a,b):
return a*b
def div(self,a,b):
return a/b
a=int(input("Enter First No : "))
b=int(input("Enter Second No : "))
print("1. Addition")
print("2. Substraction")
... |
9f3c7fcc94f4f99854216f11825dffcbcbef5409 | abdelilahzaidi/CardGame | /utils.py | 2,280 | 4 | 4 | from random import random
colors=["red","green","blue","yellow"]
symbols=["*","?","<",">"]
class Card:
def __init__(self):
self.color = colors[round(random()*3)]
self.number = round(random()*10)
self.symbol = symbols[round(random()*3)]
# print(self.color,self.number,self.symbol)
cl... |
9d2276279aa5d57d5d30c06154f88ce965bc4538 | definitely-not-hoppsik/checkers | /validation.py | 936 | 3.765625 | 4 | import scanner as sc
def _is_in_board(coords: tuple) -> bool:
x_coord, y_coord = tuple(map(int, coords))
if 0 <= x_coord <= 7 and 0 <= y_coord <= 7:
return True
return False
def _is_piece_there(piece: str) -> bool:
if piece is None:
return False
return True
def is_input_valid... |
00b16e22c4808b5d5b5415c9302f65069b85a7df | Moorkopsoesje/music-cognition | /src/matchintervals.py | 1,474 | 3.671875 | 4 | # -*- coding: utf-8 -*-
import csv
def match_intervals(all_intervals, experiment_intervals):
#print [x for x in experiment_intervals]
indices = []
for interval in experiment_intervals:
index = find_closest(interval, all_intervals)
indices.append(index)
return indices ... |
9ed89c3b71368db3025759aca632eb1355267bcf | 100race/algorithm-study | /algorithm/퀵정렬.py | 1,014 | 3.84375 | 4 | ```python
array = [5,7,9,0,3,1,6,2,4,8]
def quick_sort(array, start, end):
if start >= end: #원소가 1개인 경우 종료
return
pivot = start #첫 원소를 피벗으로
left = start + 1
right = end
while(left <= right):
#피벗보다 큰 데이터를 찾을때까지 반복
while(left<=end and array[left] <= array[pivot]):
left += 1
#피벗보다 작은 데이터를 찾을때... |
440c4054d8bc6e59c714124ed469f75b470e60fc | cornelas90/brain-teasers | /left-rotation.py | 501 | 3.640625 | 4 | '''
Given an array of x integers, construct an operator which rotates elements by d positions to the left.
Sample Input:
6 7
1 2 3 4 5 6
Print as a string for some reason
'''
ad = [int(item) for item in input().split(" ")]
array = [int(item) for item in input().split(" ")]
new = [0]*ad[0]
st = ''
for i in range(ad[0... |
673cc951eaee26a32b70489e3482a78098e7b722 | teresaochodek/kurs_fabryka_testow | /homeworks/kalkulator2.py | 416 | 3.640625 | 4 | print("witaj w kalkulatorze")
a = int(input('podaj pierwsza liczbe: '))
b = int(input('podaj druga liczbe: '))
c = int(input('wybierz rodzaj działania: 1 - dodawanie, 2 - odejmowanie, 3 - mnożenie, 4 - dzielenie: '))
if (c == 1):
wynik = a + b
elif (c == 2):
wynik = a - b
elif (c == 3):
wynik = a * b
elif (... |
d3269a6bd55fa8f51ff2ecbae4ccd69ae3f6daba | martin-martin/yalescrape | /scrape.py | 1,607 | 3.65625 | 4 | import newspaper
from newspaper import Article
linklist = []
# 'links.txt' is copy-pasted from the 1st time running 'yalescrape.py', when it gave URLs as results
with open('links.txt', 'r') as f:
for link in f.readlines():
link = link.rstrip()
linklist.append(link)
failcount = 0
for url in linklist:
# the scri... |
d668d32bdae06ac0a1926e006ee73d3f4d925cc6 | rogigs/data_structure | /list/busca_linear.py | 482 | 3.703125 | 4 | def search(list, element):
"""
Retorna o índice do elemento que estiver na lista ou None, caco contrário
"""
for i in range(len(list)):
if list[i] == element:
return i
return None
list_test = [8, "5", 32, 0, "python", 11]
element = 11
index = search(list_test, element)
if ... |
7ed4d0bf32b6dc1b0667e624f733a03f8ef39d7d | HaoTsai/LC_python | /LC python/basictrack_2021_1a/how_to_think/chapter3/practice 3.1.3.py | 229 | 3.703125 | 4 | for friend in ["Joe", "Zoe", "Zuki", "Thandi", "Paris"]: #friend= loop variable
invite = "Hi" + friend + ". Please come to my party ^^" # loop body
print(invite) # loop body
|
1e115308f9323eedc23d46ba7e8bd06c7316ee30 | LuisMonsivais/LISTADO-DE-PRACTICAS-PARCIAL-2 | /LISTADO DE PRÁCTICAS DE LA SEGUNDA EVALUACIÓN PARCIAL - LUIS ARTURO MONSIVAIS VARGAS - 18550667/TRABAJOS EN FLOWGORITH - JAVA - C++ - PYHTON/Códigos en Phyton/EVA2_10_CARREREA_2.py | 195 | 3.625 | 4 | servicio = True
residencias = True
materias = True
if servicio == True and residencias == True and materias == True:
print("Te puedes titular")
else:
print("No te puedes titular")
|
52bcc0e5ec97b93826e7db6836b36448085b3f48 | mgist56/Engin4 | /Python/dice_roller.py | 690 | 4.0625 | 4 | # Automatic Dice Roller
# Written by Meg Gist
from random import randint #for chosing things randomly
global result #variable to temporarily hold result
print ("Automatic Dice Roller")
print ("Press Enter to roll for numbers 1 - 6.")
print ("Type Fred then press Enter for numbers 1 - 999.")
print ("Type x to quit Au... |
2b2f6266a0a4879430ea8c7e1965ce9d76aa1b88 | Felixshao/review | /DailyWork/python_Decorator.py | 3,894 | 4.125 | 4 | # _*_ config: utf-8 _*_
# python装饰器
# 理解装饰器的前提: 1.所有东西都是对象(函数可以当做对象传递) 2.闭包
import time
from functools import wraps
# 装饰器原型,传入对象为函数
def decorator_one(func):
# 闭包, 无参数
def decorator_one_in():
start_t = time.time()
func()
end_t = time.time()
print('spend {} secs'.format(end_t-star... |
5e0d49f316bcee08eec7a9e98b3f09fd081fc210 | skang35/Pycharm | /SecondMonth_01.py | 23,341 | 3.65625 | 4 | ################################## 1
# import matplotlib.pyplot
# matplotlib.pyplot.plot()
# matplotlib.pyplot.show()
#
# from matplotlib.pyplot import *
# plot()
# show()
#
import math
import matplotlib.pyplot as plt
# plt.plot()
# plt.show()
################################### 2
# types of plot
# 1. line plot
# 2. b... |
7f65ec7dcd35eb34d5058a9e7357b25406b79df7 | rajforum/zu | /Python/EMIcalculator.py | 1,055 | 4.09375 | 4 | l = input("Enter loan amount : ")
n = input("Enter time(month) to pay loan : ")
rate = input("Enter interest rate : ")
r = (1 + (rate/1200.0))
EMI = (l*(r**n)*(r-1)) / ((r**n)-1)*1.0
print "--------------------------------------------\n"
print "your EMI per month : ",round(EMI)
print "your total interest : ",round(E... |
424e0e87b57033b074f4828f65e175d96ad7b92b | kangyupeng/auto_operation | /chapter2/test_diff.py | 611 | 3.59375 | 4 | #!/usr/bin/env python
"""
比较2个字符串
"""
# coding=utf-8
__author__ = 'root'
import difflib
text1 = """text1:
This module provides classes and functions for comparing sequences.
including HTML and context and unified diffs.
difflib document v7.4
add string
"""
text1_lines = text1.splitlines()
text2 = """text2:
This ... |
2460befffb9eb476383c2394ad2073d5dc76c85d | makurek/leetcode-algorithmic-puzzles | /linked-list.py | 630 | 3.890625 | 4 |
class Node:
def __init__(self, next = None, content = None):
self.next = next
self.content = content
def addNode(self, node):
self.next = node
head = None
for i in range (0,10):
inp = input("Please enter a number: ")
if i == 0:
n = Node(next = None, content = inp)
... |
fd8764ef6652362660c5206cd3a29117c16f54d5 | the-raspberry-pi-guy/lcd | /demo_lcd_custom_characters.py | 3,864 | 3.8125 | 4 | #! /usr/bin/env python
# Custom characters string program. Writes strings with custom characters, that can't
# be found in the characters table. It is possible to use a custom characters by definig
# it's code on paseholder whyle useng and extended string.
# Appearance of the custom characters can be defined by redi... |
9101c2c52f2ffd4c19063d0845496c575c4d7bfd | byeonggukgong/algorithm | /boj/2577.py | 310 | 3.859375 | 4 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
first = int(input())
second = int(input())
third = int(input())
output = [0 for x in range(10)]
multiply = str(first * second * third)
for num in multiply:
output[int(num)] += 1
for num in output:
print(num)
|
408538edf80ec690dd114801af68dfe2956dc039 | byeonggukgong/algorithm | /boj/9498.py | 273 | 3.890625 | 4 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
input = int(input())
if input >= 90:
print("A")
elif input >= 80:
print("B")
elif input >= 70:
print("C")
elif input >= 60:
print("D")
else:
print("F")
|
fb6364bc3522b676c35fe90ce22b9f75e066ce7b | byeonggukgong/algorithm | /boj/1003.py | 754 | 3.84375 | 4 | # -*- coding: utf-8 -*-
import unittest
def fibonacci(number: int):
dp = [[0, 0] for _ in range(41)]
dp[0][0] = 1
dp[1][1] = 1
for n in range(2, number + 1):
dp[n][0] = dp[n - 2][0] + dp[n - 1][0]
dp[n][1] = dp[n - 2][1] + dp[n - 1][1]
return [dp[number][0], dp[number][1]]
cla... |
01221ae9450e55b1766f5c690ecd87d9a068c376 | byeonggukgong/algorithm | /mp/question-4.py | 745 | 3.96875 | 4 | # -*- coding: utf-8 -*-
""" 문제
정수(int)가 주어지면, 팰린드롬(palindrome)인지 알아내시오. 팰린드롬이란, 앞에서부터 읽으나 뒤에서부터 읽으나 같은 단어를 말합니다. 단, 정수를 문자열로 바꾸면 안됩니다.
"""
""" 예제
Input: 12345
Output: False
Input: -101
Output: False
Input: 11111
Output: True
Input: 12421
Output: True
"""
if __name__ == "__main__":
input = int(input())
output = ... |
074e9407cdbaba1980a62ab147d736478cc2da77 | SebastianJL/advent_of_code_2019 | /day03/day4_ex1.py | 2,590 | 3.875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/12/05
@author: johannes
"""
from dataclasses import dataclass
from typing import List
@dataclass
class Point:
x: int
y: int
@staticmethod
def from_instruction(p: 'Point', instruction: str):
direction = instruction[0]
... |
c2beb9e3beeb12a3e91f5189ea70fde4e4a07c87 | SHETU-GUHA/1st | /1st chapter.py | 1,128 | 4.375 | 4 | print('Hellow World!')
print ('What is your name?')
myName = input()
print ('it is good to meet you ' + myName)
print('The length of our name is :')
print (len(myName))
print ('what is your age?')
myAge = input ()
print ('You will be ' + str (int(myAge)+1) + 'in a year.')
#1. operator (*, -, / , +) values ... |
ffb2f29e0e270aec936bedfc4e80d4c68fbd2e35 | lrcortizo/ALSexercises | /clase3/sets.py | 246 | 3.859375 | 4 | # Conjuntos
s0 = set()
print(s0)
s1 = {1, 2, 3}# set([1, 2, 3, 3]) mejor así para distinguir con diccionarios
print(s1)
s2 = set([3, 4, 5])
print(s1 | s2)
print(s1 - s2)
print(s1 & s2)
elto = int(input("Elemento: "))
print(elto in (s1 | s2)) |
6c24097e7f79f64552a51b7ee99e712f6f94e438 | HristoMohamed/PythonStuff | /python-retrospective-hw/task1/solution.py | 1,535 | 4.28125 | 4 | #!/usr/bin/env python
def what_is_my_sign(day, month):
if (month == 3 and day >= 21) or (month == 4 and day <= 20):
print('Овен')
return 'Овен'
if (month == 4 and day >= 21) or (month == 5 and day <= 20):
print('Телец')
return 'Телец'
if (month == 5 and day >= 21) or (month... |
a125ac43b1119223017de50938fe8e1908aeca5d | johnnickell24/python-152 | /HW7/HW7v1.py | 3,017 | 4.09375 | 4 | """
Description: This program uses a menu function let the user work with a
company roster. They can add, delete, change, and find employees using
functions as well as print a reort with the entire roster.
"""
_author_="John Nickell"
_date_="11/7/14"
"""
pre-condition: None
Description: This is the menu where ... |
5377751dd2add93083ce484c8508cac89ac3563b | johnnickell24/python-152 | /HW8/HW8v1.py | 1,303 | 3.640625 | 4 | import os.path
"""
pre-condition: Hours and Payrate
Description: This calculates the gross pay of an employee in a text file.
"""
def calcGrossPay(tmpHours,tmpPay):
tmpHours = float(tmpHours)
tmpPay = float(tmpPay)
if tmpHours > 40:
tmpOverHours = tmpHours - 40
tmpOverPay = tmpPay ... |
ccbd0ecefdf3eb3a810439402bf695e838ed7279 | AlMamun-CSE/Python-Problem-Solving | /PicAreSquared.py | 80 | 3.6875 | 4 | import math
r = float(input())
circle_area = math.pi*r*r
print(circle_area)
|
e910aac12405eb8350a65d2596a08e4b26918af9 | richardtbrownjr/mystery_word | /mystery_word.py | 5,350 | 3.984375 | 4 | import random
import os
def check_word_length(word_length):
#based on word_length pull those words from the larger dict pass to word_choice
if word_length == 'e':
level_of_word = '1'
elif word_length == 'n':
level_of_word = '2'
else:
level_of_word = '3'
return word_choice_fr... |
1cbdf131adba4b0e632af81b3c89d1e4f827bfc9 | RuidsCosta/OML_Proj | /dual_meu.py | 7,473 | 3.6875 | 4 | #!python
'''
logistic classifier dual
'''
import csv
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
import math
# funtion to read the dataset (first function called of the script)
# primeira linha do dataset tem o nr de imagens e os seus pixeis
# 600 8 8 -> significa que tem 600 imagens ... |
126388935b98ecca1f6375eafb343afb5b0952ee | anjalisingh09/Python3 | /Assignment10.py | 3,644 | 4.21875 | 4 | #Ques1 Create a class Animal as a base class and define method animal_attribute.
# Create another class Tiger which is inheriting Animal and access the base class method.
class Animal():
def animal_attribute(self):
print('walk')
print('eat')
print('sleep')
class Tiger(Animal):
d... |
3bfb9c492d9e386615fda1f05d5a5c897f5aaf8a | anjalisingh09/Python3 | /Assignment6.py | 2,308 | 4.0625 | 4 | #Ques1 Take 10 integers from user and print it on screen.
list =[]
print("Enter integers")
for i in range(10):
a=input()
list.append(a)
for i in range(10):
print(list[i])
#Ques2 Write an infinite loop.An infinite loop never ends. Condition is always true.
'''j = 1;
while(j>0):
print("infini... |
9fb8dff71b2b32de76da788ea7976b52017bdf77 | paulot/uva | /interview/spiral.py | 727 | 3.671875 | 4 |
def spiral(matrix):
i, j = len(matrix) / 2, (len(matrix) - 1) / 2
print matrix[i][j]
j += 1
for l in xrange(2, len(matrix) + 1, 2):
for ii in xrange(0, l):
print matrix[i - ii][j]
i -= l - 1
j -= 1
for ii in xrange(0, l):
print matrix[i][j - ... |
9754e3658c8410aadee92074c80fa9c3197cea71 | paulot/uva | /interview/median_of_stream.py | 370 | 3.546875 | 4 | import bisect
def median(lis):
if (len(lis) % 2 == 0): return (lis[len(lis) / 2] + lis[len(lis) / 2 - 1]) / 2.0
else: return lis[len(lis) / 2]
def median_of_stream(stream):
taken = []
while len(stream) > 0:
bisect.insort(taken, stream.pop(0))
print 'Current median is', median(taken)
... |
52c71f55ef1b8844b5de4f8f63cdaa3f85e5ed6d | paulot/uva | /interview/total_rooms.py | 639 | 3.75 | 4 |
import queue
def total_rooms(appts):
appts, total = sorted(appts), 1
room_available_at = queue.PriorityQueue()
room_available_at.put(appts[0][1])
for appt in appts[1:]:
available_at = room_available_at.get()
if appt[0] < available_at:
total += 1
room_available... |
599ab7af80cab9c5b65959ce2f92d2da38bbce8b | paulot/uva | /interview/citadel/matrix.py | 514 | 3.765625 | 4 | # Multiply 2 matrices
matrix1 = [[1,2,3],
[4,5,6]]
matrix2 = [[7,8],[9,10],[11,12]]
def multiply(m1, m2):
if len(m1) != len(m2[0]) or len(m1[0]) != len(m2):
raise Exception('Matrix sizes dont match')
ans = []
for i in xrange(len(m1)):
ans.append([])
for j in xrange(len(... |
f90c66b44e67832678af9c7660a3c3868f5a5022 | paulot/uva | /interview/citadel/spiral2.py | 854 | 3.59375 | 4 | import sys
matrix = [[1,2,3],[4,5,6],[7,8,9]]
def print_spiral(matrix):
cur_row, cur_col, len_row, len_col = 0, 0, len(matrix), len(matrix[0])
while cur_row < len_row and cur_col < len_col:
for i in xrange(cur_col, len_col):
sys.stdout.write('{0} '.format(matrix[cur_row][i]))
cur... |
7fdcf5d6f71c451bd71b965c88e023302d079a36 | josephduarte104/PY4E | /Assignment_8_5.py | 396 | 3.703125 | 4 | from getpass import _raw_input
from builtins import print
fname = _raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
lst = list()
for line in fh:
line.rstrip()
if line.startswith("From:"):
lst = line.split()
print (lst[1])
count += 1
... |
642c2ee95550ce775d737d9c4b1f7c03879ce774 | andrewtomlin/CP2410_assign_1 | /Single_linked_list.py | 1,384 | 3.578125 | 4 | from list_node import ListNode
class SingleLinkedList:
def __init__(self):
self.head = None
self.tail = None
return
def add_list_item(self, item):
if not isinstance(item, ListNode):
item = ListNode(item)
if self.head is None:
self.head = item
... |
99765350a6e38f6d6d9b46b2fdf0ae956f4d204f | Anna-Dvoskina/basic_exercises | /string_challenges.py | 1,199 | 4.15625 | 4 |
# Вывести последнюю букву в слове
from typing import Counter
word = 'Архангельск'
# ???
print(word[-1])
# Вывести количество букв "а" в слове
word = 'Архангельск'
# ???
print(f'{Counter(word.lower())}')
# Вывести количество гласных букв в слове
word = 'Arkhangelsk'
count = 0
for letter in word:
if letter.low... |
62aa3165955d3c3a1e338ce67ac7df1865196399 | VigneshwaraChinnadurai/DL_Works | /Auto_Encoder/AE_dl_22.py | 6,827 | 3.578125 | 4 | # AutoEncoders
# AE cannot have same or more no of hidden layers than input or visible layers as they wont function properly.
# It just copies the node information to another node by dedicating the nodes to input ie 1st hidden node to 1st visible node.
# Types of AE: Sparse, Denoising, Contractive, Stacked, Deep.
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.