blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3f8836161f3939739e192696b5c89a13acb76a7e
Aleleonel/Python_codes
/elevator_class.py
6,659
3.71875
4
class Elevador(): def __init__(self, capacidade, total_andares): self.capacidade = 8 self.ocupantes = list() self.total_andares = 28 terreo = True def limite_de_ocupantes(self, embarque): soma = 0 soma = sum(embarque) self.embarque = [] self.ocup...
7a2bb9504adc1f3b1e8c6608e10a67a2261281d6
Nicolas-Malgat/PooloLeJardinier
/garden.py
1,174
3.578125
4
from vegetables.vegetable import Vegetable import vegetables as veg class Garden: vegetable_types_counter = int(0) vegetable_types_list = list() def __init__(self, size=30) -> None: self.__size = size self.plantation = list() def add(self, cls): if not isinstance(cls, veg.Veg...
70070546d9331e1679455fb647068073ab008d0c
Aishwarya2411/Algorithms-for-interviews
/Tree/easy/938. Range Sum of BST.py
776
3.640625
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def rangeSumBST(self, root, L, R): """ :type root: TreeNode :type L: int :type R: int ...
f286a11a76127e900aba01513afe97bb6833d75b
Aishwarya2411/Algorithms-for-interviews
/dfs/490.The_maze.py
1,156
3.609375
4
class Solution: def hasPath(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool: def dfs (node): x,y=(node) if [x,y]==destination: return True dirs=[(0,1), (0,-1), (1,0), (-1,0)] for d in dirs: ...
bc47ee271e3c6f0ef70402229400fa614ed8359b
howard8888/alicebobworld
/spacecomplex.py
44,149
3.71875
4
# -*- coding:utf-8 -*- # # implementation of Alice and Bob playing space complexity games # (simply an exercise in coding -- all info theory concepts are taken from the literature) # #imports import random import time import platform from collections import namedtuple try: import psutil except: print ('\n...
d988a6b608ee1eb7cde14577d066fcf8baae9be4
Mehareethaa/meha
/posneg.py
143
3.796875
4
n=int(input()) if n>1: print("Positive") elseif n>1: print("Negative") elseif n==0: print("Zero") else: print("Invalid input")
f267457c7f06cee3db1f1513ace2d9c715d29e39
muremwa/Python-Pyramids
/inverted_pyramid.py
287
4.125
4
""" an inverted pyramid * * * * * * * * * * * * * * * * * * * * * """ def inverted_tri(num_rows): num_rows += 1 for i in range(1, num_rows): line = " "*i + "* "*(num_rows-i) print(line) rows = int(input("How many rows?: ")) inverted_tri(rows)
c0d87349bc7e1e5211f174e35df9ddaa7039549c
abhisheksaini21/MLOps-Task3
/MLOps-Task3/mail/sending_email.py
772
3.703125
4
# Python program for sending email # Import the smtplib module # The smtplib module defines an SMTP client session object # that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. import smtplib import urllib.request as urllib # Senders email sender_email = "abhithakran2197@gmail.co...
cc3bb18a1c7dabb3e73c9498403f346c2df9013e
t-dawei/offer-code
/python-code/09.用两个栈实现队列.py
1,018
3.84375
4
#!/usr/bin/python # -*- coding: utf-8 -*- # @author: T # @DateTime: 2019-03-25 15:57:13 ''' 题目描述:用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 解题思路: 有两个栈stackA,stackB,A为入栈,B为出栈的。 入栈时,直接进入A即可,出栈时,先判断B中是否有元素, 如果没有肯定不能pop(), 应将A中所有元素倒压在B里面,再pop()最上面(后面)的元素, 如果有,直接pop()就可以了。 两个栈各自先进后出,在一起又实现了队列的新进先出。 ''' class Solution: ...
fe5ef65db2389262feb8efec1decaa583fafc1a9
t-dawei/offer-code
/python-code/17.打印从1到最大的n位数.py
771
3.96875
4
#!/usr/bin/python # -*- coding: utf-8 -*- # @author: T # @DateTime: 2019-03-27 09:43:28 ''' 输入数字n, 按顺序打印出从1到最大的n位十进制数, 比如输入3,则打印出1、2、3一直到最大的3位数999 ''' class Solution: # 排列组合解法 用递归实现 def print1toMaxOfNdigits(self, n): if n <= 0: return number = [0 for i in range(n)] for i in range(10): ...
0a09b4e3ff87e995ceae703ef7c0102c4c587ca7
archiportal/Python-assignments.
/String prog 1__CSE 50.py
315
4.40625
4
def palindrome(str): reverse=str[::-1] if reverse==str: return True else: return False str=input("Enter a word to see if it is a palindrome or not :") r=palindrome(str) if r==True: print(str + " is a palindrome.") else: print(str + " is not a palindrome.")
6745c00e18dbc39ca7b1c598b686c4dac58b6ed5
MaybeMeet/python_learn
/sencond.py
6,089
3.859375
4
''' chenpanpan ''' ''' magicians = ['chenpanpan','wangtiting','alice','marry'] for magician in magicians: print(magician + " is our guest") for value in range(1,5): print(value) num = list(range(1,1000001)) sum = sum(num) print(sum) ''' ''' nums = [] for value in range(1,1000000): num = valu...
3c8906a847d091e33a6ac050d40305254738a3e1
prieta1975/pygame_snake
/main.py
5,945
3.546875
4
import pygame import os import random # Inicialización de pygame pygame.mixer.quit() pygame.mixer.pre_init(22100, -16, 2, 1024) pygame.mixer.init(22100, -16, 2, 1024) pygame.init() # Necesario para inicializar sonidos pygame.font.init() # Necesario para inicializar fuentes # Global constants WINDOW_CELLS_X...
669f8f603ffb10baa7d9c99f0a1c05b092256e75
DJKC/Tutorials
/Python_GUI/2_OneTwoThree_Widgets_Stretch.py
425
4.1875
4
from tkinter import * root = Tk() one = Label(root, text = "One", bg = "red", fg = "white") one.pack()# No fill is specified so it will remain the same size two = Label(root, text = "Two", bg = "green", fg = "black") two.pack(fill = X) # Two will stretch with the X axis three = Label(root, text = "Three", bg = "blu...
013bc2a2b06a7ce5e50366c39929aa0072d7a624
DJKC/Tutorials
/pythonDotOrgBasics.py
36,521
3.96875
4
import math from collections import deque def nl(text=''): if (text != ''): { print('\n', "-----------", text, "--------------------------------\n") } else: { print('\n', text) } def ex(text="-------"): print(text) nl("LISTS!!!") # ############...
9391eeb0699435541d208050c65fccc4b390caa0
jeremysb1/practicing_classes_oop
/classes.py
3,152
4.28125
4
class Rectangle: def __init__(self, length, width): self.__length = length self.__width = width def area(self): return (self.__length * self.__width) def perimeter(self): return (2 * (self.__length + self.__width)) # Example using getters and setters class Student: ...
57e73c74da7e0bb3b08841c674ddc1a42e640f31
Abhi-dev007/friendly-sniffle
/Sudoku-solver/sudoku-main.py
1,930
3.8125
4
import tkinter import solve_sudoku import display_invalid import display_sudoku mainWindow = tkinter.Tk() mainWindow.title('Sudoku Solver') mainWindow.geometry('640x480') label = tkinter.Label(mainWindow, text="Enter the values of Sudoku", font=('Arial', 14, 'bold')) label.pack(pady=10) canvas = tkinter.Canvas(mainWi...
55ff81bb711d0308730b69f402c90b31e2a52376
cwroblewski/just_some_calculations
/Ubrania/ubraniaClass.py
1,258
3.609375
4
class Prices(): def __init__(self, mount_of_personel, type, name): self.name = name self.mount_of_personel = mount_of_personel self.type = type self.get_prices_and_cost() def get_prices_and_cost(self): x = self.mount_of_personel if x < 1: raise Exce...
6c437ba1208c2844c36b5ac22055b1fbe30bae7a
jademimms/6.0001-psy1
/ps1B.py
1,130
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 1 19:37:23 2020 @author: Jade """ #user input annual_salary = float(input('Enter your annual salary:')) portion_saved = float(input('Enter the portion of your salary to be saved:')) semi_annual_raise = float(input('Enter percent semi annual raise:...
d353b0db9fe63dbd9b579295c8eb909d926df63d
TheWorldSim/world-sim-data-importer
/omie/common.py
682
3.671875
4
import os from datetime import datetime, timedelta def loop_over_days(year, func): date = datetime(year, 1, 1) next_year = datetime(year + 1, 1, 1) one_day = timedelta(days=1) while date < next_year: func(date) date += one_day def date_to_dict(date): month = str(date.month).zfil...
ae95414c40f7b163d3ae882326e2702e534859a7
Shariq03/streamlit-fastapi-NLP-model-serving
/streamlit/ui.py
803
3.5
4
import streamlit as st import requests backend = "http://fastapi:8000/run_QNA" st.title("BERT based QNA System") st.write( """ Obtain answer from the given text and a given question via BERT implemented in Pytorch. """ ) text = st.text_area(label="Your Text here", value="", height = 200) question = s...
b0083a50177014eb95445a3430eb69d4235feae1
Superhzf/python_exercise
/Array/3Sum Smaller/solution.py
1,187
3.578125
4
class Solution: def threeSumSmaller(self,nums: List[int], target: int) -> int: nums.sort() count = 0 for i in range(len(nums)-2): count += self.getTripletCount(nums, target - nums[i], i) return count def getTripletCount(self, nums, target, first): left = firs...
f8d91f9bf1bcd8320f7daf0509c7b3aebb6d1270
Superhzf/python_exercise
/Tree/Binary Search Tree Iterator/solution.py
1,796
4.0625
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class BSTIterator: def __init__(self, root: TreeNode): self.root = root self.res = [] stack = [] curr = root whi...
829090651e6e6d3b920961f693a62ae34931aa42
Superhzf/python_exercise
/String/Backspace String Compare/solution.py
680
3.703125
4
# Solution 1 # Space compleity is O(M+N) class Solution: def backspaceCompare(self, S: str, T: str) -> bool: def CalculateFinalString(S:str) -> str: stack = [] for char in S: if char != '#': stack.append(char) else: ...
9edb865e8371ba54d3a802472152ea366338883c
Superhzf/python_exercise
/Tree/Binary Tree Level Order Traversal/solution.py
1,354
3.78125
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: if root is None: return None if root.left is None an...
251269db8d4b9788308ee238614989a59ccb55d8
Superhzf/python_exercise
/Tree/Sum of Left Leaves/solution.py
1,373
3.796875
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def sumOfLeftLeaves(self, root: TreeNode) -> int: if root is None or (root.left is None and root.right is None): retu...
493af4c63ae3da905c76539313ec118b0a0b8821
Superhzf/python_exercise
/Bit Manipulation/Power of Two/solution.py
364
3.875
4
class Solution: def isPowerOfTwo(self, n: int) -> bool: if n == 0: return False return n & (-n) == n # This is a O(1) solution # The ieda is that -n is shown by using the two's complement of n, n and -n will # share the rightmost 1-bit and sets all the others to 0. # If n is the power ...
4a2659c54a3e81194b6c923fc7796b8e21eb0fb3
Superhzf/python_exercise
/Linked List/Palindrome Linked List/solution.py
1,414
4.21875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def isPalindrome(self, head: ListNode) -> bool: if not head: return True if not head.next: return True slow = head ...
d0105d42327396fc91c15f1b22225432a017404a
Superhzf/python_exercise
/Integer/Maximum Product of Three Numbers/solution.py
881
3.765625
4
class Solution: def maximumProduct(self, nums: List[int]) -> int: if len(nums)==3: return nums[0]*nums[1]*nums[2] min1 = 2**32-1 min2 = 2**32-1 max1 = -2**32-1 max2 = -2**32-1 max3 = -2**32-1 for num in nums: if num <= min1: ...
db897d8152e14cbd1fd2ac7775c3fa3cc0f05b0b
Superhzf/python_exercise
/String/Bold Words in String/solution.py
778
3.546875
4
class Solution: def boldWords(self, words: List[str], S: str) -> str: #mark bold char mark = [False]*len(S) #true for bold char for word in words: i = -1 while True: i = S.find(word, i+1) if i == -1: break ...
4de8b3651fffb696946696c813b4ce700a5a0c96
Superhzf/python_exercise
/Array/Sort Colors/solution.py
710
3.71875
4
class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ p0 = 0 curr = 0 p2 = len(nums) - 1 while curr <= p2: if nums[curr] == 0: nums[p0], nums[curr] = nums[curr],...
54268164cdcc4e0cc98b0a551d45a23a4edea212
Superhzf/python_exercise
/Linked List/Merge Two Sorted Lists/solution.py
931
4.21875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: l3_next = ListNode(None) l3 = l3_next while l1 or l2: if l1 and...
350407079cdbc7fd1397293f883e4784f16bd847
Superhzf/python_exercise
/Linked List/Reverse Linked List/solution.py
928
4.1875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reverseList(self, head: ListNode) -> ListNode: curr = head prev = None while curr: temp = curr.next curr.next = ...
3e2a063ed71fa91d597c76bbe4e1e1e028666511
Superhzf/python_exercise
/Dynamic Programming/Longest Palindromic Substring/retro.py
710
3.546875
4
def longestPalindrome(s): if len(s) == 0: return if len(s) == 1: return s pali_index = [] longest_pali = 0 for sub_s in len(s): pali_index.append((sub_s,sub_s)) longest_pali = s[sub_s] for sub_s in len(1,len(s)): if s[sub_s-1] == s[sub_s]: ...
8739b071e584bb890c6f59b6d3e5e5812037da1d
GeoffRiley/AdventOfCode
/2022/05/day05.py
3,973
3.703125
4
""" Advent of code 2022 Day 05: Supply Stacks """ from typing import List from aoc.loader import LoaderLib from aoc.utility import lines_to_list, extract_ints def make_crate_list(crates: str) -> List[str]: """ Receiving a block of text like: [D] [N] [C] [Z] [M] [P] 1 2 ...
cfafcf6cfc3b6b20c4715364fd1a82a13a28ee1b
GeoffRiley/AdventOfCode
/2015/11/new_password.py
1,615
3.609375
4
import re def check_password(password: str) -> bool: if len(password) != 8: return False if len(set(password).intersection('ilo')) > 0: return False if not password.islower(): return False p = bytearray(password.encode()) triple = False for i in range(2, len(p)): ...
629e5ebf25949833372557c030d844bf91a4f28d
GeoffRiley/AdventOfCode
/2021/06/day06.py
3,083
3.546875
4
""" Advent of code 2021 Day 6: Lanternfish """ from collections import Counter from typing import List, Dict from aoc.loader import LoaderLib from aoc.utility import lines_to_list, to_list_int def swim_for_a_day(life_counts: Dict[int, int]): """Process the shoal, decrement the life_counts: any that get to -1...
506dc633077895e442a8b9ee0e2d8d8c72d61460
GeoffRiley/AdventOfCode
/2020/07/day07.py
2,416
3.515625
4
import re from typing import Dict OUTER_CONTAINER = re.compile(r'^(.*) bags? contain (.*)') INNER_CONTAINER = re.compile(r'(\d+) (.+?) bags?') def parse_sack_list(data: str) -> Dict[str, Dict[str, int]]: sack_list = dict() for line in data.splitlines(keepends=False): k, v = OUTER_CONTAINER.match(line...
f0ef63f163c6fa2102b6c3c7246be887842caba8
khgpsk/Laboratornye.Python
/laba4Python/laba4Python/laba4Python.py
813
4.1875
4
vegetable1 = input("Первый овощ: ") vegetable2 = input("Второй овощ: ") vegetable3 = input("Третий овощ: ") veg_low1 = vegetable1.lower() veg_low2 = vegetable2.lower() veg_low3 = vegetable3.lower() veg_up1 = vegetable1.upper() veg_up2 = vegetable2.upper() veg_up3 = vegetable3.upper() veg_t1 = vegetable1.title() veg_t2...
897e4e2e2d1dcea9dee10388b47c40c24b898a27
prikevs/Exercises
/PythonHomework/E48.py
557
4
4
#!/usr/bin/env python2.7 def printDiamond(f, n): for i in range(0, n): for j in range(0, n - i -1): f.write(" ") for j in range(0, i*2 + 1): f.write("* ") f.write("\n") for i in range(0, n - 1): for j in range(0, i+1): f.write(" ") f...
c1e6f9b30ff3b08d8fba9d81270d47b9bae4fe9d
h10gforks/corePythonProgramming
/c8/12.py
882
3.6875
4
#coding:utf-8 start = input("Start:") end = input("End:") list1=[] for i in range(start,end+1): list1.append(i) if end >= 33: asciiable = True else: asciiable = False if asciiable: print "十进制 二进制 八进制 十六进制 ASCII" print "--------" * 7 for i in range(start,end+1): ...
b496b0508efa2fbcaf3d3ac47c177243027deff7
h10gforks/corePythonProgramming
/c6/14.py
581
4
4
import time user = raw_input("Input your chioce like stone,scissor or cloth:") if user != "stone" or "scissor" or "cloth": print "Illegal Input" exit(0) a = time.time() a = a - int (a) if a >=0 and a<=0.333: ret = "stone" elif a >= 0.333 and a <= 0.667: ret = "scissor" else: ret = "cloth" print ...
34c11462ff13a3c7b04ecae2d5dfa53b6eb11aaa
h10gforks/corePythonProgramming
/c6/02_idcheck.py
773
3.75
4
import string import keyword alphas = string.letters + '_' nums = string.digits print "Welcome to the Black Parade" myInput = raw_input("Identifier to test?:") if len(myInput) > 1: if myInput[0] not in alphas: print '''Invalid: first symbol must be alphabetic''' elif myInput in keyword.kwlist: ...
8e8863b1f3d6e971c0afdb9799834c54c1dd6f5c
h10gforks/corePythonProgramming
/c8/10.py
435
3.640625
4
#coding:utf-8 str = raw_input("Input a string:") str = str.lower() l = str.split(' ') vowelnum = 0 connum = 0 vowel = ('a','e','i','o','u') for i in range(len(str)): if str[i] in vowel: vowelnum+=1 else: if str[i].isalpha(): connum +=1 else: continue print "单词个数...
e0a5f3c908a4d918e5464fe272450779fca18ab9
h10gforks/corePythonProgramming
/c5/11d.py
214
3.796875
4
#coding:utf-8 a,b = input(">请输入两个整数:"),input() def check(a,b): if (a % b) == 0 or (b%a) == 0: return True else: return False if __name__ == "__main__": print check(a,b)
394ea096a027a8af3fa5f0fbcd5718748dafa7f6
h-jaiswal/mini-projects
/TCS Contest Python OOPs/main.py
1,420
3.734375
4
class Blood: def __init__(self, bloodGroup, unitInHand): self.bloodGroup = upper(bloodGroup) self.unitInHand = unitInHand class BloodBank: def __init__(self, bloodList): self.bloodList = bloodList def isBloodAvailable(self, bloodGroupRequired, unitRequired): for blood in sel...
190d095b9c04cea75e633ee385d814b95d67f7be
harshita219/PythonPrograms
/suffix_array.py
1,202
4.125
4
""" Suffix Array is one of popular types of indexe sorting. We are going to see how it works and then try an exercise about creating one. The core idea of suffix-based data structures is like following: - represent the whole data as a single text string (e.g. concatenate all electronic books into one file); - the suff...
6a259845f6c6916f96806e6a30e20349c623314c
svdaniel/PythonLibraries
/WebParsing/Google_Search.py
2,477
3.703125
4
#!/usr/bin/python ''' ########################################################### # Script Name: Google_Search.py # Creator: Daniel Svoboda # Description: user inputs what & how much output google should return + stripped down only to return web links # Date of Creation: 2017-12-27 #...
ae2f782ae31a41a52ec21b75234a8df5181d015c
jerrylikestospin/PythonClass
/milestone_1/app.py
1,748
4.34375
4
# Create and search a list of movies movies = list() search_by = [ {"X" : "Exiting search..."}, {"N" : "Enter the movie name: "}, {"D" : "Enter the directors name: "}, {"Y" : "Enter the year the movie premiered: "} ] # Prompt for movie info and return a dictionary def create_movie(): name = input(...
7d4e0c250d04a5ab9dfda13b4973b6efe910dfda
max2004boy/Hackerrank-Problem-Solving
/Counting Number of Items to Buy with Fixed Budget_20200604.py
853
3.8125
4
# -*- coding: utf-8 -*- """ Created on Thu Jun 4 21:18:16 2020 @author: max20 """ # function that calculates the number of games a gamer can buy with # initial price (p), discount after each game (d), minimum price (m), and budget (s) def howManyGames(p, d, m, s): num_game = 0 while s >= p: ...
1a69ab157bf669946ab861252163226d48505f6d
max2004boy/Hackerrank-Problem-Solving
/Huffman Decoding_Binary Search Tree_20200507.py
2,382
3.765625
4
# -*- coding: utf-8 -*- """ Created on Thu May 7 22:12:19 2020 @author: max20 """ import queue as Queue cntr = 0 class Node: def __init__(self, freq, data): self.freq = freq self.data = data self.left = None self.right = None global cntr self._c...
c7b0f63808447c086a2aa204ca98246d225746fc
max2004boy/Hackerrank-Problem-Solving
/Dictionary_20200308.py
482
3.5625
4
# -*- coding: utf-8 -*- """ Created on Sun Mar 8 21:56:33 2020 @author: max20 """ num_dict = int(input()) phone_dict = {} for i in range(num_dict): phone_temp = input().split() phone_dict[phone_temp[0]] = phone_temp[1] while True: try: check_num = input() except EOFError: ...
c8cc989854b6032c0ab5b892364d30a4f6210ac5
max2004boy/Hackerrank-Problem-Solving
/Decorator_20200412.py
408
3.640625
4
# -*- coding: utf-8 -*- """ Created on Sun Apr 12 23:19:59 2020 @author: max20 """ def wrapper(f): def fun(l): # complete the function f(['+91 {} {}'.format(x[-10:-5],x[-5:]) for x in l]) return fun @wrapper def sort_phone(l): print(*sorted(l), sep='\n') if __name__ ...
58b002d52498f492ab446fe7be5d9d4792d47982
max2004boy/Hackerrank-Problem-Solving
/Valid String_String Manipulation_20200421.py
737
3.625
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 21 20:49:55 2020 @author: max20 """ import math import os import random import re import sys def isValid(s): counts = [] for test_char in set(s): counts.append(s.count(test_char)) min_count = min(counts) max_count = max(...
c58e5ac5d75be0ea45dafa330a306eba39c66beb
max2004boy/Hackerrank-Problem-Solving
/Counting Sort_part 1 practice_20200615.py
522
3.921875
4
# -*- coding: utf-8 -*- """ Created on Mon Jun 15 23:20:44 2020 @author: max20 """ def countingSort(arr): # number constraint: 0-99 arr_counter = [0] * 100 for i in range(len(arr)): # add 1 to the corresponding position when each arr[i] appears arr_counter[arr[i]] += 1 ...
81ec41e56c6d15fd1c5dcb7a9c5d224ca0bb4433
Uvaismon/Corozo
/ui/__init__.py
1,850
3.796875
4
""" This package contains frontend implementation of the app. """ from tkinter import Tk, Label, ttk def account_statement(transaction_list: list, account_number: int, customer_name: str, balance: int): """ Frame ID: 007 This method renders the window that displays the users account statement. It take...
e8c18a5824a5395af370711e305e2252e93f3ac6
yudit12/python-projects
/watermarker/pdf_rotation.py
663
3.96875
4
""" learn basic of handleing pdf with python you need install PyPDF2 """ print(__doc__) import PyPDF2 """ exercise1: given pdf file rotate it in 90 degree and save it in a new pdf file given pdf: dummy.pdf result pdf : tilt.pdf """ with open ('pdf_files/dummy.pdf','rb')as file: # mode read binary - create binary mo...
97fe618a1882a4a3e9b73e093ec09f50ed1fd150
lucasgabriel07/Trabalhos-Academicos
/Algoritmos I/Pyfoot/main.py
9,701
3.59375
4
from perguntas_e_respostas import perguntas, respostas from random import randint, shuffle from time import sleep import os def limpar_tela(): """https://www.geeksforgeeks.org/clear-screen-python/""" if os.name == 'nt': # Windows os.system('cls') else: os.system('clear') def ajuda(): ...
1d435c35e367e30828e5fb9f7484d96f84668c1f
Akash-Cheerla/Machine-Learning-
/Bike_Buyers.py
10,950
3.75
4
# coding: utf-8 # # WORKING ON BIKE BUYERS DATASET # In[1]: #Importing necessary libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import os # In[2]: os.getcwd() # In[3]: #setting the path to the DataSets folder os.chdir("/home/akash_cheerla/Desktop/Data_Sets") # In[4...
e9237754c98e6b2aa5f9b6bd7e2f480c00e3e706
Gprinziv/Projects
/Python/Algorithms/collatz.py
532
3.875
4
"""collatz.py - A Collatz Conjecture script by Giovanni Prinzialli""" def collatz(start, steps = 0): if start == 1: return steps else: steps += 1 if start % 2: return collatz(start * 3 + 1, steps) else: return collatz(start / 2, steps) if __name__ == "__main__": im...
7bfe6eae09c2992400dfa8d8eb12fd045123ed7b
matt-oak/CSCI_3656_Numerical_Computation
/Linear_Interpolation.py
1,013
3.6875
4
#Program for Linear Interpolation #Matt Oakley, #101697544 #I collaborated with Daniel Thompson from __future__ import division import matplotlib.pyplot as plt #2 closest points and x value you want to approximate point1 = (2000, 281421906) point2 = (2010, 308745538) x_star = 2050 #Function to run interpolation giv...
5a3617760c9ed09c51a3801edb8df9d67eea724b
Waelahmed99/trosc-ramadan-challenge
/challenges/2.py
262
4.03125
4
""" Solve the bug in the following code """ def printOdds(end): """ this function prints the odd numbers in the range [1, end] """ for i in range(1, end, 2): print(i) if __name__ == "__main__": printOdds(5) # should print numbers from 1 -> 5
f0c193a079b95d0a5e64b708ca189a5ce313dfc1
stanlviv/HW
/Grasshopper - Summation.py
89
3.515625
4
def summation(num): n = 0 for x in range(num+1): n = x+n return n
98529e58d5258ab7b9df954f5e87b27c5ebfcb67
stanlviv/HW
/HW.py
1,908
3.953125
4
# 1. Роздрукувати всі парні числа менші 100 # (написати два варіанти коду: один використовуючи цикл while, а інший з використанням циклу for). # i=0 # while i < 100: # if i%2==0: # print(i) # i +=1 # for x in range(0,100,2): # print(x) # 2. Роздрукувати всі непарні числа менші 10...
3d8e1ca0d9591fcac26bfe53f746081b619095ef
Amrutak2/Python
/FileHandling.py
378
3.5625
4
f = open("abc.txt", "r") # f.write(" - The Gurukul for Coders!") # str = f.read() # str = f.readline() # str += f.readline(5) # str = f.readlines() f.seek(3, 0) str = f.readline() print(str) #f.seek(3, 1) #str = f.readline() #print(str) #f.seek(3, 1) #str = f.readline() #print(str) #f.s...
7b7d6f99a106d068acc24f8c2b09994db277df80
kitsmart/pythonbooklet
/Project task/Project_task.py
3,842
3.53125
4
import sqlite3 import os if not os.path.isfile('Customer.db'): customer_db = sqlite3.connect("Customer.db") c = customer_db.cursor() c.execute('''CREATE TABLE CustomerDetails (Customer_first_name text, Customer_surname text, Customer_Town text, Customer_phone int, Carpets_cost int, ...
72327918858ae65eec51e9e10c67b9a0870bc1b2
kitsmart/pythonbooklet
/Chapter 5/Practice Exercise/4 Grade Boundaries.py
244
4
4
score = int(input("What is your score: ")) if 80 <= score <= 100: print("A") elif 60 <= score <= 79: print("B") elif 40 <= score <= 59: print("C") elif 30 <= score <= 39: print("D") elif score < 30: print("U")
05f1dbecd33e0182ed3cabda2077dd7ff1399946
kitsmart/pythonbooklet
/Chapter 2/Practice exercise 2/2 Hours in School.py
259
3.53125
4
days_in_school_each_year = 192 days_in_school_for_five_years = days_in_school_each_year * 5 hours_in_school_for_five_years = days_in_school_for_five_years * 6 print("The number of hours you spend in school from year 7 to 11", hours_in_school_for_five_years)
d41f81620e32681ec8acda7bd413591e9d877a3b
li3n3/mason
/googlemapsapitest.py
903
3.578125
4
import googlemaps from datetime import datetime import os apikey = os.environ['GOOGLE_MAPS_API_KEY'] gmaps = googlemaps.Client(key=apikey) # Geocoding and address geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA') # Look up an address with reverse geocoding reverse_geocode_result = gmaps....
52bec6158536bb6dd85230a3bf1eae6956bbfbed
owolabiadebayo/Python-Object-Oriented-Projects-Coffee_machine-Snake_Game
/Hirst_painting/test_TurtleGraphics.py
1,631
3.8125
4
import random # import everything from turtle import * # import Turtle from turtle from turtle import Turtle import turtle as t tim = t.Turtle() timmy = t.Turtle() timmy.shape("turtle") timmy.color("blue") # # create square # for i in range(4): # timmy.right(90) # timmy.forward(100) # # create dashed line...
84d26b0b171cc47e6fc3d2d3206dce4dfff5b062
Saon00/Coding-Small-Projects
/EidBazarMall.py
3,931
3.5
4
# Saon Srabon # 08:20 PM # 28 July 2020 # Dhaka,Bangladesh # Python3 # Watch this video to use this program nicely: https://www.linkedin.com/posts/saon-sikder_pythonprogramming-activity-6693743246700634112-Qf-7 def womens_dress(): print(""" Women's Collections 1. Salwar Kameez 1600 Taka 2. ...
a4d380dfc7eb2ed644733d751d8ef42be5be8ebf
handsomehu/FinancialAnalysis
/systematictrading_examples/randomdata/randompriceexample.py
3,526
3.53125
4
""" See http://qoppac.blogspot.co.uk/2015/11/using-random-data.html for more examples by Leon, Steal from Robert github to generate random price """ from systematictrading_examples.rob_org.common import arbitrary_timeseries from systematictrading_examples.rob_org.commonrandom import generate_trendy_price from matplo...
a1b92143fba3cfa3e060dde27ad54904d086794c
LuiMagno/Aulas-e-Exemplos
/Exemplos_Livro_Cap3/ContagemRegressiva.py
362
3.734375
4
# Elabore um algoritmo que simule uma contagem regressiva de 10 segundos, ou seja, mostre 10:00, então 9:59, 9:58 ... até 0:00 minutos = 10 segundos = 00 for countMinutos in range(10): print(minutos,':', segundos) minutos -= 1 segundos = 59 for countSegundos in range(59): print(minutos, ':', s...
122cd97077f8dcb8c462f18b09a038fa1375cdee
LuiMagno/Aulas-e-Exemplos
/Aulas de Python/Módulos Avançados/Counter.py
817
4.125
4
''' Coleções - Tratamento de Dados ''' from collections import Counter l = [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3] print(Counter(l)) # Aqui criamos um objeto da classe counter que lista o número de vezes que tal elemento apareceu na minha lista print(Counter('asdadsasdasdasdasdasdasdada')) # Contando as vezes que letras apar...
5c7cbd692c233c10002378456e16840b213df5b4
LuiMagno/Aulas-e-Exemplos
/Aulas de Python/6 - Tuplas.py
821
4.28125
4
''' Tuplas Em Python, as tuplas são muito semelhantes às listas, no entanto, ao contrário das listas, elas são imutáveis, o que significa que elas não podem ser alteradas. Você usaria tuplas para apresentar coisas que não deveriam ser alteradas, como dias da semana ou datas em um calendário. ''' # Declarando uma tu...
df7d1daf88e2d5fd1f2507f1a55731986c207168
LuiMagno/Aulas-e-Exemplos
/Exemplos_Livro_Cap3/mediaAritmetica50For.py
316
3.546875
4
# Fazer a média aritmética de 50 alunos utilizando o for contador = 0 acumulador = 0 mediaAnualTurma = 0 for contador in range(5): mediaAnualAluno = float(input('Insira a nota do aluno: ')) acumulador += mediaAnualAluno mediaAnualTurma = acumulador/5 print('A media anual da turma é: ', mediaAnualTurma)
a9ea529d1ab702f2c95b8c98bc1ebc7c423f75af
LuiMagno/Aulas-e-Exemplos
/Aulas de Python/Expressões Regulares.py
1,217
4.71875
5
''' Expressões regulares são padrões de correspondência de texto descritos com uma sintaxe formal. Muitas vezes você ouvirá expressões regulares referidas como 'regex' ou 'regexp' na conversa. As expressões regulares podem incluir uma variedade de regras, a busca de repetição, a correspondência de texto e muito mais. ...
1b8d84a36fa8bb96cb562a5b2ddd67d47a6d0ff3
LuiMagno/Aulas-e-Exemplos
/Aulas de Python/13 - Funções.py
1,409
4.15625
4
def primeira_funcao(): # printa 'Olá, Mundo!' print('Olá, Mundo!') pass primeira_funcao() #se você segurar 'ctrl' o VSCODE irá mostrar a você a função que foi escrita # argumentos de função são valores passados pra função para definir as informações com que a função deve trabalhar. # evitar funções...
f7296014de0182125c0052076a779bb2a6a922ea
LuiMagno/Aulas-e-Exemplos
/Exemplos_Livro_Cap3/Idade.py
526
3.890625
4
# idade para votar 16+ e idade para dirigir 18+, leia o ano de nascimento, calcule a idade e dê as informações import datetime anoNascimento = int(input('Entre com a sua data de nascimento: ')) dataAtual = datetime.datetime.now() if (dataAtual.year-anoNascimento)>= 16: print('Parabéns, já pode dirigir!') else: ...
e7d4eff98d36fb72b3f111380cd1fee85352dc46
LuiMagno/Aulas-e-Exemplos
/Exemplos_Livro_Cap3/20numeros.py
363
3.953125
4
# Algoritmo que lê 20 números e devolve o maior e o menor menorNumero = 1000000 maiorNumero = 0 for count in range(20): numero = int(input('Insira um numero: ')) if numero > maiorNumero: maiorNumero = numero if numero < menorNumero: menorNumero = numero print('Menor Número:', menorNume...
ead1e10df33c3ec4fb07e224c48ff04a085d8612
LuiMagno/Aulas-e-Exemplos
/Aulas de Python/3 - Formatacao.py
2,235
4.75
5
# Nesta aula abordaremos brevemente várias maneiras de formatar declarações impressas. A partir do momento em que você codifica mais e mais # é preciso ter formas de declarar impressões para incluir variáveis em uma declaração de string impressa. # Podemos utilizar o %s para formatar strings em suas instruções de impr...
b3b7d4b5d996fd1f8dedb803c98fab25ea683742
yll-yaolingling/usually
/three_floor_dic.py
475
3.515625
4
c={ 'a':{ 'a1':{ 'a11','a12' }, 'a2':{ 'a21','a22','a23' } }, 'b':{ 'b1':{ 'b11','b12','b13','b14' } } } d=input('select sheng') if d in c.keys(): while True: shi=input('select shi') shis=c[d].keys() ...
43684c8a2d1cada50699a7f4c6810e2d60c13f06
yll-yaolingling/usually
/time_of_py.py
306
3.71875
4
import time import datetime t1=time.localtime() print(t1) s=time.strftime("%y-%m-%d %H:%M:%S",t1) print(s) t2="2017-05-20 08:08:10" s1=time.strptime(t2,"%Y-%m-%d %H:%M:%S") print(s1) #datetime.datetime.now():打印格式化时间,这种格式大多用于日志打印中 print(datetime.datetime.now())
d4c6462236ed7d5285f58cd52a1cf961a39eaf75
xixy/algorithms
/Sort/merge_sort_list.py
1,738
4
4
# coding: utf-8 # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None def print_list(head): node = head string = "" while node != None: string = string +" "+ str(node.val) node = node.next print string cl...
a14540cbc850d6d309f37aaae26e3496f0433b27
xixy/algorithms
/Sort/heap_sort.py
1,086
3.609375
4
#coding=utf-8 def left(i): return 2 * (i + 1) - 1 def right(i): return 2 * (i + 1) def parent(): return (i + 1) * 2 - 1 def max_heapify(A, i): """ 保持堆的属性 A: list of ints i: index of node to examine """ l = left(i) r = right(i) if l < len(A) and A[l] > A[i]: larg...
05cb72d5612d32fe44c7e449bb1bc89f350447e1
emingure/SchoolProjects
/CmpE 230 - Systems Programming/exercises/a.py
157
3.9375
4
import re string = "yeni york123" pattern = r"(a|y)\w+\d{2,4}?." found = re.search(pattern,string) if found: print found.group() else: print 'not found'
848852930f698d35d4d5de2ee9cc9a5be55cd5fd
SurakietArt/Programming.in.th
/08_Trik.py
365
3.8125
4
swap = input() ball = ['1', '2', '3'] #ball in '1' for i in swap.upper(): if i == 'A': ball[0], ball[1] = ball[1], ball[0] elif i == 'B': ball[2], ball[1] = ball[1], ball[2] elif i == 'C': ball[0], ball[2] = ball[2], ball[0] if ball[0] == '1': print('1') if ball[1] == '1': ...
c949dfb9f2a46ace991cab3e8e2e3a1b8eb695b7
SurakietArt/Programming.in.th
/05_Pythagorus.py
117
3.671875
4
from math import * a, b = input().split() fa = float(a) fb = float(b) c = sqrt(fa**2 + fb**2) print("%.6f" % c)
cdb2259d697d046adcd77d50c7bb2ea19af0d7ce
SurakietArt/Programming.in.th
/02_Grading.py
409
3.59375
4
a = int(input()) b = int(input()) c = int(input()) grade = a+b+c if grade in range(80,101): print('A') elif grade in range(75,80): print('B+') elif grade in range(70,75): print('B') elif grade in range(65,70): print('C+') elif grade in range(60,65): print('C') elif grade in range(55,60): print('...
933430054f213281ffc75a85d16d980655c302b0
kenzhaoyihui/data_struct
/Sort/quick.py
1,136
4
4
#!/usr/bin/env python3 """Quick Sorting -- unstable""" def quick_sort(alist, start, end): if start >= end: return mid_value = alist[start] #n = len(alist) low = start high = end while low < high: while high >= low and alist[high] >= mid_value: high -= 1 a...
2a67178ae290d6d50729cadbeaca463d440c90b1
kenzhaoyihui/data_struct
/Sort/shell.py
562
3.671875
4
#!/usr/bin/env python3 """ Shell Sorting -- unstable""" def shell_sort(alist): n = len(alist) gap = n // 2 while(gap >= 1): for j in range(gap, n): i = j while i > 0: if alist[i] < alist[i-gap]: alist[i], alist[i-gap] = alist[...
ee5bc767af653eedd3862a981715db100939042e
mengjian0502/EEE598HW1_MNIST
/models/cnn.py
1,067
3.546875
4
""" Pytorch based CNN for MNIST dataset http://yann.lecun.com/exdb/mnist/ """ import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['cnn_mnist'] class Net(nn.Module): def __init__(self, num_class=10, drop_rate=0.5): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 32...
636ede0560394e089e3eb2da01e53ab7db389dba
auraace/FPGrowth
/FPGrowth.py
7,018
3.59375
4
from itertools import chain, combinations #used to get powersets class node: def __init__(self, id, sup=0, parent=None): self.id = id self.sup = sup self.parent = parent self.children = [] def show(self, depth): print('id: ' + str(self.id) + ', support: ' + str(self.sup...
b58936e480902d3ade70c2d799d04b396ebf5424
Weaam20/Problems_vs._Algorithms_Udacity
/Problem_3.py
3,000
4.125
4
def heapify(arr, n, i): largest = i # Initialize largest as root left = 2 * i + 1 # left = 2*i + 1 right = 2 * i + 2 # right = 2*i + 2 # See if left child of root exists and is # greater than root if left < n and arr[largest] < arr[left]: largest = left # See if ...
1e41fd90960fdaabf5b3bdd77478c3d55b3a1b8f
Zoexzzxx/PythonForHumanities
/lab/Week3/movie.py
552
4.0625
4
# Movie rating data movie_1 = "Avengers: Infinity War" movie_2 = "The Shape of Water" movie_3 = "Mamma Mia! Here We Go Again" rating_1 = "8.6" rating_2 = "7.4" rating_3 = "7.2" ## --- Input Section --- print("== 請選擇影片 1~3 == ") print("1. " + movie_1) print("2. " + movie_2) print("3. " + movie_3) movie_index = input("影...
8e3e8afece6307d685e4df3c0d045e91b3add3ac
Zoexzzxx/PythonForHumanities
/lab/Week7/layout_dict_hint_2.py
2,198
3.859375
4
## 此程式碼僅包含作業提示,本身不是一個有效的Python程式。 ## 請記得完成作業內容。 ## poem變項內容擷取自鄭愁予《錯誤》 poem = """ 東風不來,三月的柳絮不飛 你的心如小小寂寞的城 恰若青石的街道向晚 跫音不響,三月的春帷不揭 你的心是小小的窗扉緊掩 """ layout_dict = { "心": '❤️', '城': '🏰', '晚': '🌙', "小": 'drift', "向": 'drift', "的": 'drift', "月": 'drift' } line_buffer = "" for ch in poem: if ch in ("\n", ",...
7a1b0eaaa80a16bedc88cce2d863f625c90df0ae
kalpesh30/Sorting-Algorithms
/bub_sort.py
1,038
3.796875
4
import sort import random import time arr = [] arr2 = [] arr3 = [] # populating an array with 1000 elements for i in range(1000): arr.append(random.randint(1000,500000)) # populating an array with 10000 elements for i in range(10000): arr2.append(random.randint(1000,500000)) # populating an array with 10000...
20baf68f61b2f2b53b3aedb7c6858b997450298e
YoussefWasfy/Flash-Cards
/main.py
2,483
3.578125
4
from tkinter import * import pandas import random BACKGROUND_COLOR = "#B1DDC6" current_card = {} try: words_to_learn_file = open('data/words_to_learn.csv', 'r') except FileNotFoundError: # to read from a different file change the path here with open('data/french_words.csv', 'r') as data_file: words...
c733c42863e6c47cb6184d00c68dbcd5cfae6abe
olavocinacio/google_interview
/Finalizados/Array.py
5,527
4.03125
4
''' # Arrays são listas criadas para armazenar mais de um valor (seja ele de qualquer tipo) a uma mesma variável # Array's are the foundation for all data science in Python. Arrays can be multidimensional, and all elements in an array need to be of the same type, all integers or all floats, for example. When to use a...
ec38596cbb614790c613359bf5d689681e7be029
bglynch/code_scratchpad
/python/database/sqlite/sqlitemanager.py
2,666
4.03125
4
import sqlite3 from sqlite3 import Error # ========================================= # -------- BUILDING A DATABASE ---------- # ========================================= # Examples ''' table = """ CREATE TABLE IF NOT EXISTS projects ( id integer PRIMARY KEY, name text NOT NULL, ...