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
d726704b237b80293cedb427c860285821374065
Tomdssdasd/try
/p12.py
887
3.5
4
# import random # list = [] # for i in range(1,21): # a = random.randint(-10,10) # list.append(a) # print(list) # ouli = list[0:len(list):2] # print(ouli) # ouli.sort(reverse=True) # print(ouli) # a = 0 # for i in range(0,len(list)): # if i%2==0: # list[i] = ouli[a] # a+=1 # print(list) # #...
ee027297493ad174da5a7e49ea6c5d9595a168d3
yarraboinasathishkumar/pwork
/ProblemSolving/greedy_algorithms.py
3,419
3.578125
4
from collections import deque def greedy_coin_changing_impl(M, k): """ """ n = len(M) result = [] for i in range(n-1, -1, -1): result += [(M[i], k // M[i])] k %= M[i] return result def greedy_coin_change(): """ """ M = [1,3,4] k = 6 output = greedy_coin_c...
7d85d11b5f4bef0a6409843333bbd50499be9480
Pythonmaomao/String
/claMylist.py
2,056
3.703125
4
#方法重载。自定义类,对象为列表,可以做加减乘除运算,本身列表不能做运算 class MyList: __mylist = [] def __init__(self,*args): self.__mylist = []#返回私有属性值的方法 for arg in args: self.__mylist.append(arg) def __add__(self,x): for i in range(0,len(self.__mylist)): self.__mylist[i] = self.__mylist[i] +...
383dd918a47fdab0ec49ad6c3645942c8647f495
Pythonmaomao/String
/3-31.py
1,161
3.703125
4
# -*- coding: utf-8 -*- """ heroes beta-0.2 Created on Tue Jan 30 10:02:57 2018 milo str map if while 格式化输出,利用列表打印地图,实现人物移动效果 @author: kanjingli """ welcome = 'welcome heroes world!' mapmsg = '#######' mapins = "\n-*-the world is like this-*-\n %s \n the '*' is you" %(mapmsg,)#元组只有一个元素用, map = ['#','#','#','#','#','#...
bd4daf1ee0c3fc74486bc4680a1b3355337eab62
Pythonmaomao/String
/3-52.py
990
4.34375
4
class Human: ''' this is the Human class!!! ''' name = 'ren' __money = 100 def __init__(self,name,age):#对象实例化后init函数自动执行 print('#'*50) self.name = name#只是赋值,没有输出打印;传入实例的属性 self.age = age print('#'*50) #@classmethod#类方法 @property def say(self):#公有方法,...
8c71b1b1b9ee9fff0457b3c6b058803c7274a719
Pythonmaomao/String
/3-36.py
1,647
3.875
4
# -*- coding: utf-8 -*- """ heroes beta-0.2增加随机事件 Created on Tue Jan 30 10:02:57 2018 milo str map if while 格式化输出,利用列表打印地图,实现人物移动效果 @author: kanjingli """ import random welcome = 'welcome heroes world!' mapmsg = '#######' mapins = "\n-*-the world is like this-*-\n %s \n the '*' is you" %(mapmsg,)#元组只有一个元素用, map = ['#'...
920181f61cebbea9c411bdf009a270c2f9b01fb3
hkl-iii/data_structures_implementation_assignment
/main.py
950
3.671875
4
from sweepstakes import Sweepstakes from linkedlist import LinkedList from node import BST months = ['january', 'february', 'march', 'april', 'may', 'june' 'july', 'august', 'september', 'october', 'november', 'december'] pi_day = (months[2]) print(p...
86b8b0a999db0033ef14edaa2134de132919b2ea
abishekbalaji/DSandAlgosJS
/python/multiple_pointers/count_unique_values.py
1,094
3.921875
4
def count_unique_values(arr): return len(set(arr)) print(count_unique_values([1, 2, 1, 2, 1, 1, 3])) # Works only on sorted lists def count_unique_values_2(arr): i = 0 j = i + 1 count = 1 while j <= len(arr) - 1: if arr[i] != arr[j]: i = j count += 1 j +=...
571f8cd9efb75fb824e78cf80712b079618796d2
Nouran-yehia/Python---Lab1
/A5.py
124
4.03125
4
def readStr(): str1 = input("please enter your string between \" \" : ") str2 = str1[::-1] print(str2) readStr()
cf5b64089024a35ddd119fc90ae09cc8e404129e
mani-barathi/Python_MiniProjects
/Beginner_Projects/Number_guessing_game/game.py
926
4.25
4
from random import randint def generateRandomNumber(): no = randint(1,21) return no print('Number Guessing Game!') print("1. Computer will generate a number from 1 to 20") print("2. You have to guess it with in 3 guess") choice = input("Do you want to play?(yes/no): ") if choice.lower() == 'yes': while True: nu...
b3131d5a60d503bd37e6ea88bd48cda1cdc3b4df
mani-barathi/Python_MiniProjects
/Beginner_Projects/Connecting_To_API/app.py
562
3.546875
4
import requests # pip install requests # This is program will connect to a third party Weather API to fetch the current weather details of a place # get you API KEY from https://openweathermap.org/api # replace you api key here API = '' cityName = 'chennai' # change to your location #API url (check Documentat...
32d16fa84fe48a27f4ac90256acf04d3c2b65fbf
mani-barathi/Python_MiniProjects
/Beginner_Projects/DataStructures/Queue.py
475
3.6875
4
class Queue: def __init__(self): self.queue = list() def isEmpty(self): if len(self.queue) == 0: return False return True def length(self): return len(self.queue) def enqueue(self,element): self.queue.append(element) def dequeue(self): if self.isEmpty(): element = self....
3d78394ffe2709a01d1e6a34df7dfcb7ba407a76
mani-barathi/Python_MiniProjects
/Beginner_Projects/DataStructures/Stack.py
948
4.1875
4
class Stack: def __init__(self): self.stack=[] # emty list self.top=-1 def isEmpty(self): if len(self.stack)==0: return True else : return False def push(self): self.top+=1 element = input("Enter the Element: ") self.stack.insert(self.top,element) print(f" {element} ...
0779d189f58b1e73feb21e1a03aaec3c8426b105
mani-barathi/Python_MiniProjects
/Screensaver/screensaver.py
2,156
3.5625
4
import tkinter as tk import datetime from tkinter import * import random,threading,time COLOR_CODES=['#E6B0AA','#F5B7B1','#D7BDE2','#D2B4DE','#A9CCE3','#AED6F1','#A3E4D7','#A2D9CE' ,'#A9DFBF','#ABEBC6','#F9E79F','#FAD7A0','#F5CBA7','#EDBB99','#D5DBDB'] flag=1 def changeTime(): global flag while flag==1 : ...
fc69aab56991230a33aa110b5c2dc49962283763
Nafisas16/Nafisas16
/6.loop.py
3,047
4.125
4
# while loops & for loops # hanya kan menjalankan code ketika kondisisnya True # print(1*2) # print(2*2) # print(3*2) # print(4*2) # print(5*2) # print(6*2) # print(7*2) # print(8*2) # print(9*2) # print(10*2) # while loops # i = 1 # while i <= 10: # print(i*2) # i += 1 # i = 1 # while i <= 10: # if i <=...
6198884c0d99d387d095330b32584f647a005760
rsp-esl/python_examples_learning
/example_set-1/script_ex-1_37.py
959
3.640625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
c15848b879f4f8db332ae70984d976bd227b3326
rsp-esl/python_examples_learning
/example_set-6/script_ex-6_3.py
1,245
3.875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## ## Ubuntu/Linux...
c3f3c6409e68ceae0d46054bf50c22b7ff56f37b
rsp-esl/python_examples_learning
/example_set-2/script_ex-2_5.py
939
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
d985a509aa87fa13565fb19c074ea9ac4eb85f00
rsp-esl/python_examples_learning
/example_set-2/script_ex-2_19.py
824
3.640625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
fc67206793cd483acdbb305f621ab33b8ad63083
rsp-esl/python_examples_learning
/example_set-1/script_ex-1_27.py
1,088
4.25
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
ffc5c4eb524cd11e8e452e0e75c50b6ac0933e2b
rsp-esl/python_examples_learning
/example_set-3/script_ex-3_6.py
2,966
4.125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
64bec77800cb0dfaa37beab304b0e490df0e01b1
rsp-esl/python_examples_learning
/example_set-2/script_ex-2_13.py
779
3.796875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
c85177315d875af3854c56d91710f5958f981251
rsp-esl/python_examples_learning
/example_set-1/script_ex-1_20.py
1,025
3.90625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
091be1a39775ef12d7eacc6b90c2ab563fddb340
rsp-esl/python_examples_learning
/example_set-1/script_ex-1_34.py
1,238
4.4375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Author: Rawat S. (Dept. of Electrical & Computer Engineering, KMUTNB) # Date: 2017-11-17 ############################################################################## from __future__...
3237a21fe239b0472c14a306c5e9784a7433d597
j-mak/python3-exercism.io
/crypto-square/crypto_square.py
846
3.65625
4
import math def encode(sentence): if not sentence: return '' normalized = __normalize(sentence) return make_square(normalized) def __normalize(sentence): result = [] for char in sentence: if char.isalnum(): result.append(char.lower()) return ''.join(result) de...
164621caabb78344bb16889ab8d2e77fe815a1bc
j-mak/python3-exercism.io
/grains/grains.py
304
3.734375
4
def on_square(square): """Calculate quantity on square.""" return __calculate(square) / 2 def total_after(total): """Calculate total to given square.""" return __calculate(total) - 1 def __calculate(x): if x > 64 or x < 1: raise ValueError else: return 1 << x
25cc6596b11d7a82596b9146f488c6c14c91e3cc
j-mak/python3-exercism.io
/isbn-verifier/isbn_verifier.py
506
3.59375
4
import re def is_valid(isbn): result = re.match(r'\d\-?\d{3}\-?\d{5}\-?(?:\d|X)', isbn) return result is not None def verify(isbn): if isbn and is_valid(isbn): isbn = isbn.replace('-', '') length = len(isbn) isbn_sum = 0 for i in range(length): if isbn[i].low...
63bb13717fae227e07c308e1a1545991f2027db6
zsajjan/frc-hw-submissions
/lesson5/Lesson5.py
306
4.0625
4
sentence = ["low", "pee", "hi", "no", "me", "ok", "sprint", "you", "nine", "ten"] word = raw_input("Please list a word ") if word in sentence : print("That is one of my secret words too!") else : sentence = ["low", "pee", "hi", "no", "me", "ok", "sprint", "you", "nine", "ten",str(word)] print sentence
1e446043aa6bb3725a66da1191160facab3c0ef6
cohenra/Python
/exercises/multiplication_table.py
436
3.59375
4
"""x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] multiplication = [] sum = 0 for i in (x): for z in (y): multiplication.append([int(i) * int(z)]) sum += int(i) * int(z) print(multiplication) multiplication.clear() print(sum) """ row = 1 while row <= 10:...
a6cff79d038817266278be3d147494dcfcdd7ccc
sweersr/pandas-profiling-1
/src/pandas_profiling/report/formatters.py
2,896
3.71875
4
"""Formatters are mappings from object(s) to a string.""" from jinja2.utils import escape import numpy as np def fmt_color(text: str, color: str) -> str: """Format a string in a certain color (`<span>`). Args: text: The text to format. color: Any valid CSS color. Returns: A `<span>` ...
a15b342a3e5e1b01fbfe12a6ea27bd34960f7cc2
caioRafael/DesafiosURI
/iniciante/1013.py
179
3.515625
4
valores = input().split(" ") a, b, c = valores maior1 = (int(a)+int(b)+abs(int(a)-int(b)))/2 maior2 = (int(c)+maior1+abs(int(c)-maior1))/2 m = int(maior2) print(m,"eh o maior")
689159c3f6b486e8c8c55e46b62d9f25197b868f
abhiwand/spark-tk
/regression-tests/generatedata/movie_small.py
767
3.796875
4
"""generates a csv file with data about fictional dogs""" import random max_weight = 100 min_weight = 5 max_age = 20 min_age = 0 min_rating = 1 max_rating = 5 min_views = 0 max_views = 1000 min_version = 0 max_version = 3 def generate_movies(number): csv = open("../datasets/movie_small.csv", "w") for index i...
5c1b21a13c4fa451818829a90407a38ea0b9fed0
abhiwand/spark-tk
/python/sparktk/frame/ops/tally_percent.py
1,708
3.828125
4
def tally_percent(self, sample_col, count_val): """ Compute a cumulative percent count. Parameters ---------- :param sample_col: (str) The name of the column from which to compute the cumulative sum. :param count_val: (str) The column value to be used for the counts. A cumulative percent ...
c356c45175ee94751c3507fc75995af0d840d7be
Jose-Deligne/GuessTheNumber
/NumberGuesser.py
9,729
3.75
4
from tkinter import * import tkinter.font as TkFont from random import randrange mainBackgroundcolor = "#EDFFB3" mainTextColor = '#6767f5' centerHorizontalValue = 5; gridRowValue = 10; gridColumnValue = 10; lastGuess = False; def initScreenSize(root): screenWidth = root.winfo_screenwidth() screenHeight = root...
7f2111375c9fde24f8e238a901f59fd2b338c4b1
theymightbepotatoesafter/School-Work
/CIS 210/p11_quiz_christian_carter.py
2,320
4.3125
4
''' Prior programming experience quiz. CIS 210 Project 1-1 Hello-Quiz Solution Author: Christian Carter Credits: N/A Add docstrings to Python functions that implement quiz 1 pseudocode. (See p11_cricket.py for examples of functions with docstrings.) ''' def q1(onTime, absent): ''' (bool, bool) -> string ...
d17f63ca020f33ba4d027bf9a03029c8f89b88f1
gaurav-dwivedi/mypracticecodes
/reverse_duplicate.py
360
3.90625
4
"""s = "Python" print(s[::-1]) l = [1, 2, 3, 4, 5] l.reverse() print(l) rev = [] print(list(reversed(l)), l[::-1]) for i in range(len(l) - 1, -1, -1): rev.append(l[i]) assert isinstance(rev, object) print(rev) d = {'11': '111'} print(d) s = input() S=set() r=[] for i in s: if i not in S: S.add(i) el...
017b442747b4cc2aa16a2f37dfef4b25b8abd361
gaurav-dwivedi/mypracticecodes
/Multiplication_table.py
234
3.71875
4
"""def mul_tab(n): for i in range(1,n): for j in range(1,n): print(j*i,end=' ') print("\n") mul_tab(10) """ for i in range(1,11): for j in range(1,11): print(i*j, end = "\t") print("\n")
1e0f3ff3f48433a555febf8619b8ce85033fbcb7
IshmaelHeathcliff/python-assignments
/simple-exercise/乘法2.7.py
73
3.578125
4
#!/usr/bin/python x=input("x:") y=input("y:") print x*y input('<enter>')
e3f863b1ad65c2d03ff2de39b856859b29376919
IshmaelHeathcliff/python-assignments
/simple-exercise/求面积.py
145
3.546875
4
# x,y,z=float(input('a:')),float(input('b:')),float(input('c:')) w=(x+y+z)/2 from cmath import sqrt print('area=',sqrt(w*(w-x)*(w-y)*(w-z)))
c47daa47c2e2d223e537e3af19deb2cd3f9be161
IshmaelHeathcliff/python-assignments
/simple-exercise/二次根.py
260
3.78125
4
from math import sqrt print('ax^2+bx+c=0') a=float(input('a=')) b=float(input('b=')) c=float(input('c=')) d=b**2-4*a*c if d>=0: x1=(-b+sqrt(d))/(2*a) x2=(-b-sqrt(d))/(2*a) print('x1=',x1,'x2=',x2) else: print('no result') input('<enter>')
6324fbeb236aadef4985578008de7853082f63af
IshmaelHeathcliff/python-assignments
/simple-exercise/平均数.py
174
3.515625
4
i = 1 s = 0 while True: x = input('x' + str(i) + ':') if x == 'None': print(s / (i - 1)) break else: s += int(x) i += 1
1d1e3293d09ae1c158ff92d95d9b77b44b231519
Divya748/Mallela_Divya_python_assign_rpd
/preprocessing.py
2,542
4
4
#import libraries import pandas as pd #used to read the files import seaborn as sns #for visualization but here we used to get heatmap class preprocess: """ This class is used to preprocess data 1. file reading 2. renaming columns 3. finding difference between high and low colu...
e6d2df28a4906c6ca527624eddef0e5624806317
JosephLovato/CSCI101-Debugging-ALS
/04-minesweeper-bugged.py
1,628
3.671875
4
# Debugging Active Learning Session - CSCI101 # Bugged File #5 import random sz = 20 # the size of the board # initialize mines_list mines_list = [] for i in range(0, sz): mines_list.append([]) for j in range (0, sz): mines_list[i].append(False) # randomly place some mines for k in range (0, 75)...
5d3a19c09b3b30f425d40968b0e3d8cdb7469719
zb-tjw/daily
/棋盘问题/A算法.py
8,323
3.671875
4
import numpy as np import copy """ 1. 空洞用数字0表示,其他各个位置用1...8表示 2. 同一层deep都一样,所以直接不考虑 3. 注意深浅拷贝问题 4. 注意闭包问题 5. 注意stack不是栈,是队列queue,temp是step代表步数,懒得改了 6.是用那个规则:输入初始和最终棋盘元素,横着从左到右挨着输入,空洞为0,其他为1...8 """ final_checkerboard = np.zeros((3, 3), dtype=int) # 记录最终的棋盘状态 min_element_number = 0 total_stack = [] final_stack = [] m...
3a803d1429584e91634f9a0d0fad7916bc0b2cb5
DevOps188/python
/练习1.py
5,323
3.984375
4
# string1="hello" # string2='hello' # string3="""hello # python""" # string4='''hello # world''' # print(type(str(18))) # print(isinstance(18,int)) # name="庞俊杰" # print("你真聪明,",name) # print("你真聪明," + name) # print("你真聪明,%s" % (name) ) # print("你真聪明,{}".format(name)) # enumerate() 可以使用两个变量,调出下标 # name="devops" # prin...
8876b843cc09876cbb86dcc61fa2131029b57ecc
ahill6/fss16adh
/code/3/employee.py
499
4.09375
4
class Employee(object): """Represents an employee. Attributes: name: string age: int """ def __init__(self, name=None, age=None): self.name = name self.age = age def __repr__(self): """Returns a string representation.""" return '%s is age %s' % (...
43eb9fbb4d0b38c35a6f2b43032ed43163848ffd
sumit3045/Guessing-Game
/Guessing Game.py
427
3.921875
4
import random def guess(x): Random_Number=random.randint(1,x) guessed_number=0 while guessed_number!=Random_Number: guessed_number=int(input("Guess the number: ")) if guessed_number>Random_Number: print("Sorry, number too high") elif guessed_number<Random_Numb...
a5b5e53d763aff1eaa61e4f429cad91d63ce4965
amitdev101/automation
/keylogger.py
1,387
3.96875
4
''' Hi this is a tutorial for understanding and development of keylogger in python. This is a very simple keylogger but we will try to improve it with time. ''' from pynput.keyboard import Listener as keyboard_listener from pynput.mouse import Listener as mouse_listener from datetime import datetime logfile = open('...
ef6b052a9c9ecff9c744626c96004f0cf08858f9
LutherCS/ip-class-pub
/examples/bgrk2/crud.py
2,557
4
4
#!/usr/bin/env python3 import sqlite3 def read_csv(filename: str) -> list[tuple]: """ title,designer,publisher,year """ all_games = [] with open(filename, "r", encoding="utf-8") as data_file: data_file.readline() for line in data_file: record = [field.strip('"') for f...
6af609eda3d679b3547a2231c46f47aef40c944b
carlos2140485/curso
/Unidade 2/capitulo 2.py
151
4.09375
4
numero = input('Digite um número:\n') print(numero) print('O número digitado foi ' + numero) print('O numero digitado foi {}'.format(numero)) print()
00fb786f8f1f70e59368d8fb3da512ff44e2c79a
SergeyMatles/Net4U
/Lessons/Targil3.py
358
3.828125
4
#Lists my_list=["hello",1,66.6,"Sergey",5,66,79,69,420] print("The Length Is: " + str(len(my_list))) my_str="2375672465297435692445" print("The Length Is: " + str(len(my_str))) my_list.append("wow") my_list.append("sergey") print(my_list) print("The New Length Is: " + str(len(my_list))) my_list.insert(3,99) print(m...
4d8fc17d7e700e748dd3b3613312d2c36ef68bee
ggopalan42/pylibs
/cloud/aws/iot_core/iot_core_utils.py
11,081
3.625
4
''' This defines a bunch of functions that are useful for using the AWS IoT Core functionality The general steps for creating a IoT "thing" as AWS calls it are: 1. Create a thing and register it in the registry a. Create and activate a device cert b. Create an AWS IoT policy ...
ec108d024555e9faca2bb210df9bc245802a98b4
mccole1/string-parsing
/string_parsing_exercise.py
3,268
4.5
4
# Part 1: # # 1. Parse out the item (i.e. "apples") in the string below. Use the lecture notes if you need help! Use print statements to help you test along the way. grocery_string = "item:apples,quantity:4,price:1.50\n" split_string = grocery_string.split(",") #split_string = ['item:apples', 'quantity:4', 'price:1.5...
e33c4061754065356e7b8607dd8bf46ffb94b950
kHarshit/DAT210x_Microsoft
/Module2/assignment4.py
1,240
3.671875
4
import pandas as pd # TODO: Load up the table, and extract the dataset # out of it. If you're having issues with this, look # carefully at the sample code provided in the reading # # .. your code here .. # TODO: Rename the columns so that they are similar to the # column definitions provided to you on the website. ...
9813244b04c9d1fea87713e0d572886f2f25e90e
gdribeiro/hackerrank
/CrackingTheCodeInterview/ch2/py/problem1-SLinkedList-b.py
5,415
3.75
4
#!/usr/bin/python3 import unittest # 2.1 # Remove Dups: Write code to remove duplicates from an unsorted linked list. # How would you solve this problem if a temporary buffer is not allowed? # Hints: #9, #40 #9. 2.1 Have you tried a hash table? You should be able to do this in a single pass of the linkedlist. #40. 2....
93ecc7eda05dfe91b4c670d3c45e3d72d73f4bc0
giustinagab/my-first-blog
/python_intro.py
123
3.65625
4
def hi(name): print ('Hi '+ name +'!') girls=['Rachel', 'Monica', 'Karola', 'Giustina'] for myname in girls: hi(myname)
6f3ae4c6e366c46aa2034e1bd4a3ca77391f72c7
ninjavaz/crypto_prediction
/main.py
3,918
3.5
4
# -*- coding: utf-8 -*- #I used RNN in this program - Long Short Term Memory(LSTM) #to predict price of selected cryptocurrency in specified peroid of time and then check it #with reality from datetime import datetime import math from numpy.core.numeric import NaN from numpy.ma.core import maximum_fill_value impor...
fefae8bf0ed7848e968ff5f93d6203f17007cffd
farwydi/python-example
/2.py
6,326
4.25
4
#!/usr/bin/env python # coding: utf-8 import string import re # На вход Вашей функции будет передано одно предложение. # Необходимо вернуть его исправленную копию так, чтобы оно всегда начиналось с большой буквы и заканчивалось точкой. # Обратите внимание на то, что не все исправления необходимы. Если предложение уже...
b8d9561b4f9b4caaa16595d8b82ae3438526238d
mecolmg/OscarTweets
/files/Tweeter.py
5,419
3.515625
4
#Author: Colm Gallagher #Date: 3/11/2015 #Project: Oscar Tweets import csv import plotly.plotly as py from plotly.graph_objs import * from collections import defaultdict #Contains Tweet Data, accesed by (...).value class Tweet: def __init__(self, data): self.time, self.tweetid, self.text, self.rt, \ ...
084ea4fb82df9cbf7e5ab0caaa41352447460531
jeffkinnison/pyrameter
/pyrameter/graphing.py
2,963
3.5
4
import warnings import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn def boxplot(trials, value='objective', labels='id', filename=None, **kwargs): """Create boxplot(s) of hyperparameter performance. Boxplots show the distribution of a variable recorded in each trial (e....
e3b66e6c9492196d55cb99c5e958fc7c726ba405
ArthurYang1228/mongoDB_practice
/mongoDB_practice/mongodb_practice/grade/amount_stat.py
1,213
3.515625
4
# amount_list: a list including all amount of a category # target: amount that should equal # skip: number that this category should skip def amount_pathfinding(amount_list: list, target: int, skip: int=0) -> list: path_list = {} for amount in amount_list: if amount <= target: origin_index...
fc094beb3476af835d4b8d2a16b5b4c92cd38330
SmogJ/GlobalAIHubPythonCourse
/Global AI Hub homework Day 4.py
575
3.765625
4
#!/usr/bin/env python # coding: utf-8 # # Homework Day 4 # ![image.png](attachment:image.png) # In[11]: # prime numbers - number divisble by it self and one without a remender n = int(input( "Enter an integer between 0 and 100 : " )) def prime_n (n): for num in range (0, n): if num...
65b65ceaaaa1f30959c4ba2f132e20686d3ba2fa
tartlet/CS303E
/MyStringFunctions.py
4,272
4.125
4
# File: MyStringFunctions.py # Student: Jingsi Zhou # UT EID: jz24729 # Course Name: CS303E # Unique Number: 50695 # # Date Created: 10/30/2020 # Date Last Modified: 10/30/2020 # Description of Program: Program contains multiple functions that can carry out a # variety of different operations on an input string. def...
c42d57a4c634bae031e0dc1085cf88e95f1464d3
tartlet/CS303E
/DaysInMonth.py
1,512
4.40625
4
# File: DaysInMonth.py # Student: Jingsi Zhou # UT EID: jz24729 # Course Name: CS303E # Unique Number: 50695 # # Date Created: 09/25/2020 # Date Last Modified: 09/25/2020 # Description of Program: User inputs a month and year in integer form and program # outputs how many days the month has for any given year. Intende...
01cf756fc8e458fb7142df0ce5c4bf7a5ee16ce9
tartlet/CS303E
/CaesarCipherFile.py
3,634
4.0625
4
# File: CaesarCipherFile.py # Student: Jingsi Zhou # UT EID: jz24729 # Course Name: CS303E # Unique Number: 50695 # # Date Created: 11/13/2020 # Date Last Modified: 11/13/2020 # Description of Program: Caesar Cipher program that asks the user if they want to encrypt or decrypt a text file. The program # also recognises...
f206ff7c99d4a290e632ed6612b2a920a404b9b1
shuaib88/Intro_To_Computer_Systems
/06/Assembler/src/RemoveWhiteSpace.py
882
3.515625
4
#removes whitespace import re class RemoveWhitespace: #remove white space and Comments from an inputArray and drops into a new array. @staticmethod def removeWhiteSpaceAndComments(inputArray): # the array we will keep our trimmed lines in outputArray = [] # iterate through inputArr...
1d6285d95307e43d3f73af045f831e518cac8e6c
HidoCan/Programlama_dilleri_yaz_okulu
/2019/2019_TYT_Problemler_Soru21.py
322
3.953125
4
a = input("tahta kasa sayısı") b = input("plastik kasa sayısı") c = input("sadece tahta kasalarla dolum oranı") d = input("sadece plastik kasalarla dolum oranı") f = input("dolu bir tahta kasadaki domates kilosu") a = int(a) b = int(b) c = int(c) d = int(d) f = int(f) q = a*f x = q/c y = x*d/b print(y)
794ea5228507ca28deb4f812349a5c962b72491e
HidoCan/Programlama_dilleri_yaz_okulu
/2019/2019 tyt problemler 23.py
317
3.578125
4
a=input("Değer giriniz:") a=int(a) b=input("Değer giriniz:") b=int(b) c=input("Değer giriniz:") c=int(c) d=input("Değer giriniz:") d=int(d) e=input("Değer giriniz:") e=int(e) f=a+b g=c+d x=f+g y=g+e z=y+1 if (z==x): print("Girdiğiniz değer uygunsuz") else: if (z==x): z=z+1 print (z)
a7ba5e2b9393f0c70a78323bedabeab8ac108e00
HidoCan/Programlama_dilleri_yaz_okulu
/2020/p5.py
288
3.5
4
k = int(input("Bina sayisi : ")) l = int(input("yikilan bina sayisi : ")) m = int(input("Kacti : ")) n = int(input("Kac oldu : ")) g = k * 3 x = g - m y = k - x p = n - m l = l * 3 r = l - p b = 100 / y d = r * b print("3 katli bina sayisinin azaldigi %{0}".format(d))
13263a78c47eb7560251d11556b8f2908ac5f1a3
HidoCan/Programlama_dilleri_yaz_okulu
/2018/2018 tyt fonksiyonlar 34.py
239
3.734375
4
k==0<k<2 a==0<a<2 f(a) g(a) h(a) f(a)<g(a) g(a)<h(a) h(a)<f(a) if (0<a<k): if (h(a)<g(a)<f(a)): print("Doğru") else: print("Yanlış") if (k<a<2): if (f(a)<g(a)<h(a)): print("Doğru") else: print("Yanlış")
73b81a1f8040b47cf35ea3f500d19f4ec6d2aeaf
HidoCan/Programlama_dilleri_yaz_okulu
/2019/2019_TYT_TemelKavramlar_Soru5.py
690
3.8125
4
from math import * a = input("Kenar sayısı") b = input("İçerdiği sayı") c = input ("Küçük kenar sayısı") d = input("Büyük kenar sayısı") a = int(a) b = int(b) c = int(c) d = int(d) x = a/b x = floor(x) f = x * c e = x * d while e/c > x+1: e = e+1 break while f/d < x: f = f+1 brea...
c5339c827341e49198ccc67b893b6886a6224cd2
HidoCan/Programlama_dilleri_yaz_okulu
/2020/Bölme Bölünebilme/2020_BölmeBölünebilme_22.py
263
3.6875
4
x=input("Kardeş sayısı giriniz:") y=input("Albümdeki fotoğraf sayısı giriniz:") z=input("Her birinin bulunduğau fotoğraf sayısı:") coz1=x*y coz2=x*z coz3=coz1-coz2 sonuc=y-coz3 print("Kardeşlerin birlikte bulundupu fotoğraf sayısı=",sonuc)
91346d33ef1994bc4f6d9898fff1210b6d6a750f
HidoCan/Programlama_dilleri_yaz_okulu
/2017/2017 tyt kümeler 12.py
141
3.65625
4
A = [] B = [] print("A=[]") print("B=[]") print("A[]-B[]=B[]-A[]") print("A[]+B[]=24") A=24/3 print ("A[]"" eleman sayısı =",int(A))
c2de11b0f85b2eacda39065f0b8d7091abe7f2c5
HidoCan/Programlama_dilleri_yaz_okulu
/2020/p3.py
158
3.75
4
x = int(input("a dan b ye : ")) y = int(input("b den a ya : ")) z = x/y k = 1/2 w = z ** k t = w * y print("Karsilastiklari dakika {0}".format(t))
dff846be18fcde38c697f81272231da3beccc779
Johnwei386/Warehouse
/Exercise/Python/2017-09-21.py
261
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- num = raw_input("please submit a num:"); num = int(num) if num%2 == 0: if num%4 == 0: print "%d can be division by 4" % num else: print "%d can be division by 2, is even" % num else: print "%d is odd" % num
18abd2f584f584215250df1e213557611660e503
izanagiii/exercism
/python/pangram/pangram.py
315
3.875
4
from string import ascii_lowercase # Solu izanagiii def is_pangram(sentence): sentence_lower = sentence.lower() for letter in ascii_lowercase: if letter not in sentence_lower: return False else: return True # print(is_pangram("the lazy dog jumps over the quick brown fox"))
adf6e33498f3e638cda0c45197e3df9c36d6e968
aliseyfi/Sherlock-sentiment
/DimReduction.py
522
3.515625
4
from sklearn import decomposition class DimReduction: # applying PCA dimensionality reduction method on feature vectors def pca(self, X): pca = decomposition.KernelPCA(n_components=None, kernel='linear', gamma=None, degree=3, coef0=1, kernel_params=None, alpha=1.0, fit_inverse_trans...
5a3ea03aedfc3ba24c2fab37613e356e845a260b
ss2226/cse891-fall2011
/types of fish 3.py
3,129
4.0625
4
################################## # Sonia Singhal # HW 6 and 7 ################################## import csv, urllib def load_csv(url): d = {} fp = urllib.urlopen(url) for row in csv.DictReader(fp): key = row['date'] value = row['fish'] x = d.get(key, []) x.append(value) d[key] = x ...
f4192f351571ed0babc6ca835d09176a08da41a1
anirudhn18/msba-python
/Lab3/Lab3_Ex3.py
247
3.796875
4
def sumavg(input_list): sum_out = sum(input_list) avg_out = float(sum(input_list))/len(input_list) return sum_out,avg_out user_sum, user_avg = sumavg([1,2,3]) print 'The total is {} and the average is {}.'.format(user_sum, user_avg)
6275743572e4abdd7c0a00d5852bb8b58cb4bd8f
anirudhn18/msba-python
/Lab5/Lab5_Ex1.py
988
4.3125
4
class Point: """ Represents a point in 2D space """ def __init__(self, x=0.0, y=0.0): self.x = x self.y = y def __str__(self): return '({},{})'.format(self.x,self.y) class Rectangle: """Represents a rectangle. attributes: width, height, corner.""" # def __init__...
5675300ad85e2f9c5912a563f107f87bded037b6
anirudhn18/msba-python
/Lab1/Lab1_Ex1.py
277
3.796875
4
#assigning values to cost per share and number of shares cost_per_share = 27.125 number_of_shares = 500 #Calculating amount by multiplying cost per share and number of shares amount = cost_per_share * number_of_shares #printing final amount print "Amount is " + str(amount)
2c391070eba46e8197b326af05208f27d5029934
MacilioFerreira/Hill-Climbing--Travelling_Salesman_Problem--IA
/tabela.py
420
3.546875
4
# -*- coding: utf-8 -*- import random as rn '''for i in xrange(0,20): print str((i, for x in xrange(0,8))) print '_' * 20 ''' cidades = [] l = 0 while l <= 10: a = (float(rn.randint(0,l)), float(rn.randint(0,l))) if not a in cidades: cidades.append(a) l += 1 #for city in cidades: # pri...
0ca12dd103797af01f9052c35537f49ef62241c3
m-miftahuddin-ghofur/test-arkademy
/no4.py
224
3.59375
4
def fib(n): a, b = 0, 1 for _ in range(n): yield a a, b = b, a + b def fibo(f,g): for i in range(g): l = list(fib(f)) print(l) f = f + g + 1 fibo(4,3)
72e4426c8c9a352630b61210d963dc4ee39cd261
JuanFSR/SD
/1. TCP/Questão 1/client.py
3,555
3.5625
4
''' ### QUESTÃO 1 - TCP ### # Autores: Juan e Alisson # Data de criação: 10/07/2021 # Data de modificação: 15/07/2021 #Descrição: Envia mensagens para o servidor, podendo solicitar 5 operações. Essas operações são: - TIME: Recebe do servidor o horário do sistema. - DATE: Recebe...
656d9b14c71818af0921a2f2e98bae4970bc3bce
Zaurez/bookMyMovie
/variable.py
196
3.515625
4
import database row = int(input('Enter the number of rows: \n')) coloumn = int(input('Enter the number of seats in each row: \n')) database.hall_row = row database.hall_coloumn = coloumn
b83ec9f39b0e12ae3f70528e09995ca8523eed3a
KMatthewMarsden/CommonsSimulator
/client/client.py
323
3.84375
4
print("Digital Commons") trees = 20 growthRate = 1.4 ownedTrees = 0 while(1): print("There are {} trees in the field!".format(trees)) print("Enter the number of trees you will cut down") treesCut = int(input()) ownedTrees = ownedTrees + treesCut trees = trees - treesCut trees = trees * growthR...
860c285e0f64ed74766005fd9cf4e8c7a8c31246
a-raina/maze-solver
/aStar.py
3,557
4.21875
4
''' Code to implement the A* algorithm. The cost function currently returns 0 as we do not favor a certain node over the other. If we wanted to visit certain Nodes we could give those nodes low cost and others higher cost. ''' class Node: def __init__(self,value,point): self.value = value self.po...
a72254ff8fee355dd7d06d31f9a3e30457704777
tdhawale/Python_Practise
/Swap.py
1,871
4.59375
5
# One method to swap variable is using another variabl print("--------------------------------------------------------") print("Using the conventional method for swap") a = 5 b = 6 print("The value of a before swap is :", a) print("The value of b before swap is :", b) temp = a a = b b = temp print("The value of a after...
d5f365f21f96404171747dfd5ec92b55c6fe9f96
tdhawale/Python_Practise
/pattern_printing.py
396
3.859375
4
for i in range(1, 5): for j in range(i): print("# ", end="") j = j + 1 print() i = i + 1 print() for i in range(4, 0, -1): for j in range(i): print("# ", end="") j = j - 1 print() i = i - 1 print() n = 4 for i in range(4, 0, -1): for j in range(1, i + 1): ...
51a4a815d0eacdac7c47e4e35e6aabe84a3c94bf
tdhawale/Python_Practise
/List_comprehension.py
3,018
4.875
5
# List Comprehension is used to crate a list and avoid the use of for loops # Structure of list comprehension # [expression for item in list] # num*num for num in even # expression = num*num # item = num # list = even even = [2, 4, 6, 8, 10] print("The matrix of even numbers upto 10 is: ",even) #---------------------...
117f819035aa87a46aafe9654750a8506534422a
tdhawale/Python_Practise
/arrays.py
5,021
4.375
4
# We have list and tuple but why arrays # we have all the values of same type. In list there can be elements # of different types as well # Lists are much more flexible than arrays. # They can store elements of different data types including string. # Also, lists are faster than arrays. # And, if you need to do math...
f76e2bd5a09a2174dc9c1f33750f4f582388414e
tdhawale/Python_Practise
/Pandas_data_wrangling.py
8,245
4.0625
4
import numpy as np import pandas as pd print("The first data frame is") df1 = pd.DataFrame({'key': ['a','b','c','d','e'], 'A1': range(5),'B1' : range(5,10)}, index = ['i1','i2','i3','i4','i5']) print(df1) # The first data frame is # key A1 B1 # i1 a 0 5 # i2 b 1 6 # i3 ...
ed520dba1b4718d43a7d6424386936b9e0af1234
tdhawale/Python_Practise
/Pattern.py
1,005
3.953125
4
# for i in range (0, n+1) # for j in range(0, n+1) # if i + j == n: # pattern[i][j] = '*' # elif j == n / 2: # pattern[i][j] = '*' # elif i == j: # pattern[i][j] = '*' # elif : # pattern[i][j] = ' ' """ for i in range(n, -1, -1): ...
1e33e5db7f86a5ff4b9fa0e60aa861deab945f10
prasantib/docsaiprassu
/employee_pay.py
479
3.671875
4
print("Welcome to the Employee Pay program!") id_num = ['001', '002', '003', '004', '005', '006', '007', '008', '009', '010'] name = ['Mary', 'John', 'Bob', 'Mel', 'Jen', 'Sue', 'Ken', 'Dave', 'Beth', 'Ray'] rate = [15.0, 22.0, 35.0, 43.0, 17.0, 29.0, 40.0, 20.0, 37.0, 16.5] hour = [40, 25, 4, 62, 33, 45, 36, 17,...
e0c33a466945d7244198e579824373ae7d130b2c
rad08d/credit_card_process
/runapp.py
1,410
3.671875
4
__author__ = 'alan' import fileinput from app.ccacc.account import Account def main(): """ Process all command line arguments. Print out the balances of all accounts after processing. """ accdict = {} for line in fileinput.input(): process_input(line, accdict) fileinput.close() sort...
ce143afb31287bbfcf52bad736e22d633a5a45b4
harshita93/PythonClass1
/Day1/Learnfunction.py
1,009
3.71875
4
import math print(math.cos(3.5)) def cube(x): 'Return the cube of numbers' return x ** 3 print(cube(3)) print(__name__) print(cube.__name__) print(cube.__doc__) print([cube(0), cube(1), cube(2),cube(3),cube(4),cube(5),cube(6),cube(7)]) #list comprehension # [ <exp> for <var> in iterable>] print([cube(n...
d171a4e118d1145ed7c191eebf286b8b2b30da25
solehudindt/python-data-structure
/linked list/singly-linked_list.py
1,159
3.984375
4
class Node: def __init__(self, data): self.data = data self.next = None class Linked_list(): def __init__(self): self.Head = None def insert_tail(self, data): if self.Head == None: self.insert_head(data) else: temp = self.Head whi...
8dfdb46f210bafca979c129515bb076098f41513
mxjstone/actual-10-homework
/01/zhaoli/7.2homework.py
311
3.75
4
list = [1,2,3,2,12,3,1,3,21,2,2,3,4111,22,3333,444,111,4,5,777,65555,45,33,45,5000] max1=0 max2=0 for num in list: if num > max1: max1=num for num in list: if num==max1: continue if num > max2: max2=num print "The first num is %s"%(max1) print "The second num is %s"%(max2)
28e52745d22fc5e227902bc8b530bee0255a3d4b
mxjstone/actual-10-homework
/04/fujinzhou/fourday_notebook.py
4,097
3.921875
4
#!/usr/bin/env python #coding:utf-8 #函数的概念: 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段 #定义函数的规则:函数代码块以def 关键字开头,后面接函数标识符名称和圆括号() #任何传入参数和自变量 必须放在圆括号中间,圆括号中间可以用于定义参数 #函数的内容以冒号起始,并且缩进。 #return(表达式)结束函数,选择性的返回一个值给调用方。 #小栗子 def hello(name): print "hello %s" %(name) hello(name="fujinzhou") hello(name="reboot") #不定长参数 #惨了星号的变量名...
995313a0df89a6dd680f7cb250b6b4cc8c31a7e1
mxjstone/actual-10-homework
/02/zhumeichao/zuoye01.py
532
3.546875
4
#!/usr/bin/env python #encoding=utf-8 #插入排序 #在一个有序列表中插入 arr=[1,5,13,45,77,103,200,443] print arr newnum=int(raw_input('请输入一个非负整数:')) head = 0 end = len(arr)-1 while True: mid = (head+end)/2 if newnum >= arr[mid] and newnum <= arr[mid+1]: arr.insert(mid+1,newnum) break elif newnum >= arr[end]: arr.a...