blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
d6cb6c3a5adfa1310a5b0c9dc17388241eb54970
Pyr0blad3/advent-of-code-2019
/day12.py
2,346
3.5625
4
import re from math import gcd def lcm(a, b): return (a*b)//gcd(a, b) class Moon: def __init__(self, x, y, z): self.x, self.y, self.z = x, y, z self.vx, self.vy, self.vz = 0, 0, 0 def apply_velocity(self): self.x += self.vx self.y += self.vy self.z += self....
f8c82b77bb7d1c97c556b18fa38c0535e5571d15
chinaxiaobin/python_study
/oldboy2019/day002编码/03 while循环.py
1,396
4.09375
4
# # print("你是不是傻") # print("下路支援,你不来?") # print("xsdfesf3a!@$@") """ while循环 while 条件: 代码块 流程: 判断条件是否为真,如果真,执行代码块,然后再次判断条件是否为真,如果真继续执行代码 直到条件变成了假,循环退出 #死循环 while True: print("!#@#$@!") """ # Count = 0 # while Count <= 100: # print("!#@#$@!1") # Count += 1 #count的作用: 计数 控制循环范围 #从1-100 # coun...
ed94e26adc00fb65ca1786a8af42905c89861343
chinaxiaobin/python_study
/oldboy2019/day003字符串/01 int 和类型转换.py
856
3.984375
4
# # bit_length() 二进制的长度 # # a = 4 # 10进制2 2进制 100 # print(a.bit_length()) # 把字符串转出成int # a = "10" # print(type(int(a))) # # 把int 转换成字符串 # # a = 10 # print(type(a)) # print(type(str(a))) # # # #结论:想转化成xxx数据类型 xxx(目标) # # a = 10 # b = bool(a) # print(b) # # a = True # print(int(a)) # 结论 True 是1 False是 0 # 数字只有0 是F...
16bb361d10f0377ebe61c727eaf53f3bffe1b84f
chinaxiaobin/python_study
/练习Python/第10天 面向对象-2/10-多继承.py
456
4.09375
4
class Base(object): #python3默认都是继承object,写上object就叫新式类,不写就是经典类,不写默认也继承object def test(self): print("----Base") class A(Base): def testA(self): print("-- A") class B(Base): def testB(self): print("--- B") class C(A,B): # 可以继承多个类,拥有多个类的方法和属性 def testC(self): print("--C") ...
aad8017e394939f766dcc46af1f0c1ee9d8320b2
chinaxiaobin/python_study
/练习Python/第9天 面向对象-1/练习.py
562
3.8125
4
class Cat(): #属性 #初始化对象 def __init__(self,new_name,new_age): self.name = new_name self.age = new_age #描述信息 def __str__(self): return "%s的年龄是:%d" %(self.name,self.age) #方法 def eat(self): print("猫在吃...") def drink(self): print("猫在喝可乐...") de...
53ae0ef70817819035f07063c7db865308ce96f1
chinaxiaobin/python_study
/oldboy2019/day007 基础数据类型补充/深浅 拷贝.py
1,654
3.671875
4
lst1 = ["太白","日天","哪吒","银王","金王"] lst2 = lst1 lst1.append("女生") print(lst1) print(lst2) #发下lst1和lst2是一样的,是因为都是指向同一个内存地址 #浅拷贝 lst1 = ["太白","日天","哪吒","银王","金王"] lst2 = lst1[:] # 浅拷贝第一种方法, 创建了新的对象,创建对象的速度会很快 lst2 = lst1.copy() #浅拷贝第二种 方法 lst1.append("女生") print(lst1) print(lst2) #发下lst1和lst2是不一样的,是因为指向的不是同一个内存地址 ...
ccbbeda5e9f600eb58bec8894a1f2118eed329bb
chinaxiaobin/python_study
/练习Python/python-基础-01/08-打印一个名片.py
789
4.34375
4
# 先做啥再做啥,可以用注释搭框架 # 1.使用input获取必要信息 name = input("请输入你的名字:") phone = input("请输入你的电话:") wx = input("请输入你的微信:") # 2.使用print来打印一个名片 print("=====================") print("名字是:%s"%name) print("电话是:%s"%phone) print("微信好是:%s"%wx) print("=====================") """ python2中input是将输入的内容当作代码了,而python3是把输入的内容当作一个字符串 name = input...
2ac9dbf48b570ce22a37d4e6f5eb6f07ddadab9f
chinaxiaobin/python_study
/练习Python/第11天 {面向对象3、异常、模块}/设计4s店/test4-使用函数完成解耦.py
871
4.03125
4
""" 需要,如果再加一辆IX35呢, 需要修改商店类和添加下面的品牌类, 这样两个类的耦合性比较高,修改一个必须修改另一段代码 """ """ 利用函数解耦 """ class Car_store(object): def order(self,car_type): return select_car_by_type(car_type) def select_car_by_type(car_type): if car_type == "索纳塔": return Suonata() elif car_type == "名图": ...
dc9cc4328cc9230c0f009607f36be57e1fd3bcce
chinaxiaobin/python_study
/oldboy2019/day004/列表的增删改查.py
1,621
3.578125
4
#列表的增删改查 #新增 #注意列表和字符串不一样,列表是可以发生改变的 所以直接在原来的对象上进行了操作,而字符串是不可改变的 lst = [] lst.append("周杰伦") #追加 永远在最后添加 效率比较高 lst.append("周芷若") lst.append("周公瑾") print(lst) lst = [ "刘德华","渣渣辉","古天乐","陈小春"] lst.insert(2,"马德华") #插入 可能会导致元素移动 查找最后位置元素是不移动的 print(lst) #expend 迭代添加, lst = [ "刘昊然","张一山","徐峥","黄渤"] lst.extend("刘能") ...
0bcf2c15a6f01a5a4ecb39970c6d3fa9f9c7a722
chinaxiaobin/python_study
/Day1/login.py
270
3.734375
4
import getpass _username = 'alex' _password = 'abc123' user = input("请输入用户名:") password = input("请输入密码:") if user == _username and password == _password: print("Welcome user %s login"% user) else: print("Wrong username or password")
2636d4331c5a07b4a1fa6f89cfa62f746a159a29
chinaxiaobin/python_study
/oldboy2019/day001 python介绍/demo.py
128
3.8125
4
MaHuaTeng = input("请输入麻花藤:") if MaHuaTeng == "麻花藤": print("真聪明") else: print("你是傻逼么")
6b8480eab18fe9405c20ec7e4199d78ce040d983
ankitbhatia8993/parkingservice_python
/src/entity/vehicle.py
444
3.90625
4
from abc import ABC, abstractmethod class Vehicle(ABC): def __init__(self, registration_number, color, vehicle_type): self.registration_number = registration_number self.color = color self.vehicle_type = vehicle_type @abstractmethod def vehicle_type(self): pass def __...
e567bb0a77f50f1b6688ada0ca7101a66bc627da
SurajMalpani/Movie-Trailer-website
/media.py
521
3.546875
4
import webbrowser # Import this module to open webpages in the code class Movie(): """ Class Movie holds all the necessary information like Movie's title, storyline, poster and trailer url. """ def __init__(self, title, storyline, poster, trailer_link): self.title = title ...
d19a9feae1de85c4c68173d07ea30f616d22959f
mileuc/100-days-of-python
/Day 31: Flash Card Capstone Project/main.py
3,583
3.75
4
from tkinter import * import pandas import random # ---------------------------- CONSTANTS ------------------------------- # BACKGROUND_COLOR = "#B1DDC6" flip_timer = None current_card = {} # ---------------------------- CREATE NEW FLASH CARDS ------------------------------- # try: cards_to_learn = pandas.read_csv(...
89cb76c58b6814fb2a074d5be82b32d6775f9793
mileuc/100-days-of-python
/Day 22: Pong/ball.py
1,223
4.3125
4
# step 3: create and move the ball from turtle import Turtle class Ball(Turtle): def __init__(self): super().__init__() self.shape("circle") self.color("white") self.penup() self.goto(x=0, y=0) self.x_move = 10 self.y_move = 10 self.move...
ca9040e2f67a9ef6e1e15e9b5fa73c8df6295877
mileuc/100-days-of-python
/Day 10: Calculator/main.py
1,544
4.3125
4
from art import logo from replit import clear def calculate(operation, first_num, second_num): """Takes two input numbers, a chosen mathematical operation, and performs the operation on the two numbers and returns the output.""" if operation == '+': output = first_num + second_num return output elif oper...
546cbeadef5427b74b5b8011e067fce77fb97199
wuge-1996/Python-Exercise
/Exercise 12.py
274
3.796875
4
# 利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 x=float(input("分数:")) if x>=90: jibie="A" if 60<=x<90: jibie="B" if x<60: jibie="C" print("级别:%s"%jibie)
a880700c0fdcedb9a4e8a92551702abdbbfaaeb9
wuge-1996/Python-Exercise
/Exercise 13.py
416
3.703125
4
# 输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 a=str(input("输入一个字符串:")) zimu=0 shuzi=0 kongge=0 qita=0 for i in a: if i.isalpha(): zimu+=1 elif i.isdigit(): shuzi+=1 elif i.isspace(): kongge+=1 else: qita+=1 print("字母有:%d个,数字有%d个,空格有%d个,其他%d个"%(zimu,shuzi,kongge,qita))
3de8ae56f50e418ff4f062399b5af1700189c3e9
wuge-1996/Python-Exercise
/Exercise 19.py
126
3.578125
4
# 利用递归方法求5! def fact(j): if j == 0: return 1 else: return j * fact(j - 1) print(fact(5))
7337e1b66c1d1241dea21f84fb19a582d7ea65c8
AnnaTSW0609/Python_Practice
/017_Mendel_Second_Law.py
1,502
3.5625
4
"""Mendel Second Law Application""" """Start with one AaBb individual""" """Each generation would only mate with AaBb""" """Each generation would have 2 offsprings""" """Given the above, P(N (min. number of AaBb organisms)) in the kth generation""" # if confused, refer to https://www.youtube.com/watch?v=qIzC1-9PwQo&t=...
5cfe725254381ee79e7390b8a893bfbada496aba
AnnaTSW0609/Python_Practice
/030_Ordering_strings_lex_different_lengths.py
1,459
4
4
"""Ordering different strings of different lengths lexicographically""" with open("/Users/annatswater/Desktop/rosalind_lexv.txt", "r+") as f: for line in f: if line.isdigit() == True: number = int(line) else: char_lst = line.strip().split(" ") # assume alphabet already ...
afa0b05c48c004549c35e026d79a4e95a1d91801
AnnaTSW0609/Python_Practice
/001_Count_nucleotide_in_string.py
360
3.984375
4
# Rosalind Practice no.1 """Counting the number of each nucleotides in any given string""" DNA = "ATCGATCG" A_count = 0 T_count = 0 C_count = 0 G_count = 0 for letter in DNA: if letter == "A": A_count+=1 elif letter == "T": T_count+=1 elif letter == "C": C_count += 1 else: G_count += 1 pr...
daeaf27666a944e52a214924ac0dcd1ce68023be
ZhaCong2017/Train
/KVectorToOne.py
1,796
3.5625
4
import random import sys import time class item: def __init__(self, a, b, c): self.num = a self.place = b self.position = c def left(x): return x * 2 def right(x): return x * 2 + 1 def minheapify(num, k): n = len(num) k += 1 l = left(k) ...
dd0f6bbde433352ec16cdf7fa17af004ce97435f
Satyam-detic/The-sparks-foundation-by-satyam-singh
/The sparks foundation task 1.py
3,540
3.921875
4
#!/usr/bin/env python # coding: utf-8 # Data Science & Business Analytics - Task 1: Prediction using Supervised Machine Learning # # Prepared by: Satyam singh # # Aim: To predict the score of a student when he/she studies for 9.25 hours. # In[ ]: import pandas as pd # for manipulating the dataset import numpy as...
bd68be478ff7c80341c42663f2b39505c1ff311a
indrekots/py-challanges
/charswap/charswap.py
140
3.59375
4
def charswap(input): s = str(input) if len(str(s)) > 1: return s[len(s)-1] + s[1:len(s)-1] + s[0] else: return s
797b203334787440ad0555028dbceabd058e4548
pizzaismyname/KIJ_Programming_1
/DES/main.py
626
3.875
4
import encrypt as enc import decrypt as dec import initial as init key = input("Enter your key (only 8 chars will be used): ") plainText = input("Enter your plain text (only 8 chars will be used): ") key = init.key_check(key) true_len = len(plainText) # if init.key_check(key) == True: if len(plainText) < 8:...
d4a4a7a7a133af45077992a992e1a7998061734c
jonggyeong/network_programming
/hw02/hw2-1.py
375
3.578125
4
from random import randint player = 50 while True: coin = randint(1, 2) if player <= 0 or player >= 100: break else: if coin is 1: player = player + 9 else: player = player - 10 if player <= 0: print("플레이어가 돈을 모두 잃었습니다") else: print("플레이어가 100$를 ...
986dfb8cdc901efc3264c5ecc87a6327c101c603
alexwlchan/docstore
/src/docstore/tint_colors.py
3,080
3.640625
4
import collections import colorsys import math import os import subprocess import wcag_contrast_ratio as contrast def choose_tint_color_from_dominant_colors(dominant_colors, background_color): """ Given a set of dominant colors (say, from a k-means algorithm) and the background against which they'll be d...
9a460dc921caa42cb760604514cbb58d34f964b4
potomatoo/TIL
/Programmers/kakao_행렬곱.py
239
3.65625
4
arr1 = [[1, 4], [3, 2], [4, 1]] arr2 = [[3, 3], [3, 3]] import numpy as np def solution(arr1, arr2): arr1 = np.array(arr1) arr2 = np.array(arr2) answer = arr1.dot(arr2) return answer.tolist() print(solution(arr1, arr2))
1dc7c897d287552e9404c7b70587e1b08d680588
potomatoo/TIL
/Programmers/kakao_포켓몬.py
211
3.75
4
def solution(nums): answer = set() N = len(nums) // 2 for num in nums: if len(answer) == N: return N answer.add(num) return len(answer) print(solution([3,3,3,2,2,4]))
8274eb756bae64f001447513fab7ad29b77b96b4
potomatoo/TIL
/Programmers/kakao_뉴스 클러스터링.py
1,389
3.671875
4
def find_set(s): new_s = dict() for i in range(len(s)-1): check = s[i] + s[i+1] if check[0].isalpha() and check[1].isalpha(): if check in new_s: new_s[check] += 1 else: new_s[check] = 1 return new_s def union_set(s1, s2, plus_dic): ...
e4f38645b375838891d63be6bff367b00536f17e
potomatoo/TIL
/CodingTest with Python/그리디 & 구현/곱하기 혹은 더하기.py
641
3.71875
4
''' 각 자리가 숫자(0부터 9)로만 이루어진 문자열 S가 주어졌을 때, 왼쪽부터 오른쪽으로 하나씩 모든 숫자를 확인하며 숫자 사이에 'X' 혹은 '+'연산자를 넣어 결과적으로 만들어질 수 있는 가장 큰 수를 구하는 프로그램을 작성하시오, 단, +보다 x를 먼저 계싼하는 일반적인 방식과는 달리, 모든 연산은 왼쪽에서부터 순서대로 이루어집니다. ''' S = input() result = int(S[0]) for i in range(1, len(S)): if 0 <= result <= 1 or 0 <= int(S[i]) <= 1: result ...
0360b995ff8aa7150bde24e3252854ae4f77ad07
potomatoo/TIL
/Programmers/kakao_오픈채팅방.py
777
3.53125
4
def solution(record): answer = [] user_dic = dict() name_save = [] behavior_save = [] for i in range(len(record)): one = record[i].split() if one[0] == "Enter": user_dic[one[1]] = one[2] name_save.append(one[1]) behavior_save.append('님이 들어왔습니다.') ...
7707f06eabc402f288406ebcd2f5497545f63d39
potomatoo/TIL
/Programmers/kakao_징검다리.py
571
3.53125
4
def solution(distance, rocks, n): answer = 0 start = 0 end = distance rocks.append(distance) rocks.sort() while start <= end: mid = (start+end) // 2 remove_rock = 0 remove_check = 0 for rock in rocks: if rock - remove_check < mid: remo...
2f9a37635a3313a8dc7935a7fc627a317f42ae63
potomatoo/TIL
/Baekjoon/boj_삼성기출_모노미노도미노.py
1,350
3.578125
4
def go_right(y, x, t): if blue[y][x] == 3 or x == 9: if t == 1: board[y][x] = 3 blue[y][x-4] = 1 elif t == 2: board[y][x] = 3 board[y][x-1] = 3 blue[y][x - 4] = 1 blue[y][x - 5] = 1 elif t == 3: board[y][x] =...
321f48a2366bfb3e849d6ef172b36c30d214680e
potomatoo/TIL
/Programmers/kakao_짝지어 제거하기.py
294
3.5
4
def solution(s): stack = [] for i in range(len(s)): if stack: if stack[-1] == s[i]: stack.pop() continue stack.append(s[i]) if not stack: return 1 return 0 print(solution('abccaeeaba')) print(solution('cdcd'))
28aa75b38962e41c8404ce7ab3c43aa126a2e51c
potomatoo/TIL
/Programmers/kakao_숫자의 표현.py
326
3.546875
4
def solution(n): answer = 0 now = 1 while True: if now == n: break check = 0 for i in range(now, n): check += i if check >= n: break if check == n: answer += 1 now += 1 return answer+1 print(solutio...
b3f67a0816c791043339e775b9099654f2db916f
sudhakar-mnsr/python_examples
/03/readfile.py
208
3.59375
4
total=0 count=0 inFile = open('grade.txt', 'r') grade = inFile.readline() while (grade): total = total + int(grade) count = count + 1 grade = inFile.readline() print ("The average is " + str(total))
a788d38d4029a32ea3d2d9c9d6baa0c7cae6cbe9
sudhakar-mnsr/python_examples
/06/line.py
364
3.5625
4
class Point: def __init__(self,xcor,ycor): self.xcor=xcor self.ycor=ycor def __str__(self): return str(self.xcor) +','+str(self.ycor) class Line: def __init__(self,p1,p2): self.p1=p1 self.p2=p2 def __str__(self): return str(self.p1) + '::' + str(self.p2) p1=Point(1,...
6991f595e2aa34f0335d11f975a0aad1ba33d19b
sudhakar-mnsr/python_examples
/01/list.py
199
3.53125
4
marks = [100,20,20,33,44,55] marks1 = [100,20,[20,33],44,55] string = ["hello"] print (marks1[2]) print (len(string)) str1 = ["hai","sudhakar"] str2 = ["hai","mnsr"] print (str1+str2) print (str1*4)
1d7920defc71e5b6ed9ff201546f7a62aca338f1
rubyclaguna/Intro-Python-II
/src/adv.py
3,596
3.640625
4
from room import Room from player import Player from item import Item # Declare all the rooms room = { 'outside': Room("Outside Cave Entrance", "North of you, the cave mount beckons"), 'foyer': Room("Foyer", """Dim light filters in from the south. Dusty passages run north and east."...
a1a7268958c32a1ab11829c52b98b7b85e4a43c2
cnn911/tmp
/four_model.py
1,801
3.59375
4
# -*- coding: utf-8 -*- """ Created on Tue Jan 16 20:40:33 2018 @author: Administrator """ ''' 状态模式: 当一个对象的状态改变时允许改变其行为,不同的状态就是不同的类 但是却是在同一个方法中实现 当一个对象内在状态改变是允许改变其行为, 这个对象看起来像是改变了类 ''' from state import curr,switch,stateful,State,behavior from state_machine import before,State @stateful class People(object): clas...
75139010a3d582a9b54a77cf3edb28cb3a399907
questsin/cheats
/cheatsheets/py/python.2. pandas (cheat sheet).py
2,089
3.515625
4
#http://pandas.pydata.org/ #Series – for one dimensional array #DataFrame – for 2 dimensional tables (and with multi-indexing can display more dimensions) import numpy as np import pandas as pd df=pd.read_csv('pupils.csv') df.head() df.sample(5) len(df) df.columns df.info() df = pd.read_csv(fname, parse_dates=['ti...
2536d0e3b47cb9542c5344e9318e76debf574ba7
baudm/ee298z
/hw2/transforms.py
1,897
3.5625
4
#!/usr/bin/env python3 import numpy as np def corrupt_mnist_img(rng, img, value): """Corrupt a single MNIST image. Note that the image itself is MODIFIED. :param rng: instance of numpy.random.RandomState :param img: image to modify. ndarray or compatible :param value: pixel value to use for corru...
e1e4de4ad068dba1d8a54aa67abc336b41fc79cf
Avraj19/monster_inc_uni
/monster_class.py
386
3.546875
4
class Monster(): def __init__(self, name, tax_num, monster_type): self.name = name.title() self.tax_num = tax_num self.monster_type = monster_type.title() # def get_tax_num(self): # return self.__tax_num # # def set_tax_num(self, new_num): # self.__tax_num = new...
ce328ddfda4122fd86c3343bbdf3374ba56e7a42
AyanUpadhaya/CodeBase
/jsonworkout/movieapi/application.py
889
3.515625
4
# Get tv show data using python and api # site - tvmaze.com/api # script by - Ayan Upadahya # contact -> ayanU881@gmail.com # twitter -> https://twitter.com/ayanupadhaya96 # GitHub -> github.com/AyanUpadhaya # Youtube -> Code Tech :https://www.youtube.com/channel/UCsjnvE4i5Z-VR-lWhODX99w import requests import json ...
e4f8cfc4dd1a6c269887a1cce00f1183e69bc624
AyanUpadhaya/CodeBase
/Matplotlib/firstplot.py
418
4.03125
4
# matplotlib import matplotlib #print(matplotlib.__version__) #pyplot import matplotlib.pyplot as plt import numpy as np xpoints = np.array([1,8]) ypoints = np.array([3,300]) plt.plot(xpoints,ypoints) plt.show() #By default, the plot() function draws a line from point to point. # ~ Parameter 1 is an array conta...
c3a85d2145abbe3ba9271803d94e2b24d57f72b7
rupajsoni/x9115arn
/hw/code/3/PokerHand.py
4,710
3.71875
4
"""This module contains code from Think Python by Allen B. Downey http://thinkpython.com Copyright 2012 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from Card import * frequency_of_poker_hands = {0:0, 1:0, 2:0, ...
585cbda391510437797a5e677fc50b6c27ed8462
rupajsoni/x9115arn
/hw/code/3/bparadox.py
477
3.75
4
from random import randint def has_duplicates(list): list2 = list[:] list2.sort() for i in range(len(list2) - 1): if list2[i] == list2[i + 1]: return True return False def create_birthday_list(): birthday_list = [] for i in range(23): month = randint(1, 12) ...
6057d088cfad0576c06af5673cc254eeddcdf475
JustNulls/text-similarity
/sim/tools/similarity.py
5,259
3.515625
4
#! -*- coding: utf-8 -*- """ Calculate Similarity """ # Author: DengBoCong <bocongdeng@gmail.com> # # License: MIT License from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from typing import Any def euclidean_dist(emb1: np.ndarray, emb2...
9cefb7e86c7020b6aad4322e4610edc544b0d8d5
jupibel95/factorial
/factorial.py
189
4.0625
4
numero=int(input("ingrese un numero: ")) factorial = 1 for n in range(1, (numero+1)): factorial = factorial * n print ("El factorial de {0} es: {1}".format(numero, factorial))
cfb447e6ca85ff206706b615bd728a1578ea0333
mohammed-ibrahim/rcfiles
/programs/shortest_path.py
1,830
3.875
4
import sys class Graph(): def __init__(self, V): self.number_of_vertices = V self.graph = [[0 for column in range(self.number_of_vertices)] for row in range(self.number_of_vertices)] # this part can be optimised def find_min_distance(self, distance, already_visited...
5117399f4d9488c656de9d3d830b2f423be57e69
mballarin97/RL4Pandemic
/Graph_Evolution/Graph.py
10,886
3.578125
4
import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui import matplotlib.pyplot as plt class SimpleNode: """Basic Node in a Graph""" def __init__(self, identifier, position): """Create a node named @identifier, located at 2D @position (only matters for plotting) ...
6453c83420fdafc7707c475b649c8bd918a3bdd5
alpablo11/Python---V1
/23.Fonksiyonlar.py
1,851
3.921875
4
# AAI Company - Python #! FONKSİYONLAR #! Fonksiyonun Tanımlanması ve Çağırılması: # Fonksiyon tanımlayacağımız zaman kodumuza def ile başlarız. # Ve fonksiyonu print ile değil adı ile çağırırız. # İsterseniz örnekle pekiştirelim; def alperaybakindustries(): print("Alper Aybak\n...
ab5a1b878009397fba44735bcd8979940998b149
alpablo11/Python---V1
/24.Fonksiyonlar Örnek Uygulama.py
2,234
3.703125
4
# AAI Company - Python # Fonksiyonlar ile İlgili Örnek Uygulamalar : #! Asal Sayı Sorgulama: def asal_mi(a: int): dogrulama = "Sayı Asal" if a == 2: return dogrulama # return ==> Geri Dön elif (a % 2 == 0): dogrulama = "Sayı Asal Değil" # Eğer sayı çiftse asal olmayacağ...
d3c232907262b0df29e4272a77714bb6d201f302
wpdud94/pre-education
/quiz/pre_python_11.py
330
3.609375
4
"""11. 최대공약수를 구하는 함수를 구현하시오 예시 <입력> print(gcd(12,6)) <출력> 6 """ def gcd(x, y): if x < y: minnum = x elif x > y: minnum = y for i in range(minnum, 0, -1): if x % i == 0 and y % i == 0: return i break print(gcd(12, 6))
a29f98fed786467391ee6eb9d535e80ead19acfc
braja535/LABFramework
/Implementation/srtmodfier.py
4,354
3.859375
4
import datetime import re import string import os """ We opened input file in readmode and then applying pattern on each line and if pattern found apply "linemodification()" function on each line. linemodifcation function apply regular expression on line and find all the oc...
db6624eed03b2956d99071a3db39ee291ca8d627
glennpinkerton/csw_master
/csw/python/course/arith_print.py
194
4.03125
4
print ("hello world " + str(2 * 6) + " goodbye") var1 = 1.23 ** 1.23 print ("var1 " + str(var1)) var2 = "This is var2 " var3 = 2 * 3 / 4.0 var4 = "This is var3 " print (var4 + str(var3))
ccb8abaeaca67490627f093da16eb5d6e3b53c7c
Poskj/CP3-Thammanoon-Kitlertphairoj
/Exercise 8.py
1,005
3.609375
4
print("---Welcome to Posh's Gift Shop---") print("----Please Login into System----") usernameInput = input("Username : ") passwordInput = input("Password : ") if usernameInput == "Thammanoon" and passwordInput == "6116" : print("Welcome!") print("---Total Goods List---") print(" 1. Floral Candle : 44...
2ee911d204084b19a9f0a2014a6cb123c2e24085
rileythejones/lambdata
/lambdata_rileythejones/df_utils.py
246
3.609375
4
"""" utility functions for working with DataFrames """ import pandas as pd import numpy as np df_null = pd.DataFrame([1, 2, 3, 4, 5, 6, 7, 8, 9, np.NaN, 0, 0]) df_random = pd.DataFrame(np.random.randn(100, 3)) df_random_column = df_random[0]
7e6caaea40c2ca56d00cf95dce934fb338a55ca1
dlingerfelt/DSC-510-Fall2019
/FRAKSO_MOHAMMED_DSC51/loops-week5.py
2,983
4.53125
5
''' File: Loops.py Name: Mohammed A. Frakso Date: 12/01/2020 Course: DSC_510 - Introduction to Programming Desc: This program will contain a variety of loops and functions: The program will add, subtract, multiply, divide two numbers and provide the average of multiple numbers input by the user. Define a functio...
3dc92800af9c9fd0322bd4f5e169e1a3099f0d73
dlingerfelt/DSC-510-Fall2019
/GAGGAINPALI_DSC510/assignment9.1-wordcount_print_to_file.py
3,328
4.46875
4
# File : assignment9.1-wordcount_print_to_file.py # Name : Bhargava Gaggainpali # Date : FEB-9-2020 # Course : Introduction to Programming - python # Assignment : # -Last week we got a taste of working with files. This week we’ll really dive into files by opening and closing files properly. # -For this week we will mod...
88333bcf49ae0f01c6f7d4cca37c1dae5ddb64a2
dlingerfelt/DSC-510-Fall2019
/JALADI_DSC510/final/WeatherDisplay.py
1,791
4.34375
4
# File : WeatherDisplay.py # Name : Pradeep Jaladi # Date : 02/22/2020 # Course : DSC-510 - Introduction to Programming # Desc : Weather Display class displays the weather details to output. class WeatherDisplay: def __init__(self, desc, city, country, temp, feels_like, min_temp, max_temp, lat, lon, wind)...
7b5792e9a15c79a9d9c8cc195cb66b11b8686b5e
dlingerfelt/DSC-510-Fall2019
/APRIL_MEYER_DSC510/APRIL_Assignment5.py
2,409
4.09375
4
#%% #File: Assignment 5 #Name: April Meyer #Assignment 5 #Date: 9.26.2019 """Desc: This program will prompt the user for an arithmetic operation. It wil then perform the operation and prompt the user for another arithmetic until the user types none.""" #Defines a function named performCalculation which takes one param...
a3ce25380c0f7db366c3cb94a539a5bbfb352ecf
dlingerfelt/DSC-510-Fall2019
/GUPTA_DSC510/assignment_week4_gupta_dsc510.py
7,579
4.25
4
# File: RGupta_wk4.py # Instructor: David Lingerfelt # Date: 09/18/2019 # Course: DSC510-T304 Introduction to Programming # Assignment#: 4.1 # Description: This program perform the cost calculation of fiber optic cable with taxes # User gets a discount on purchase of 100 feet or more cable # Usage: This program requir...
433d5b3ed946f1f84893a9eed708b49e902af6c0
dlingerfelt/DSC-510-Fall2019
/NERALLA_DSC510/NERALLA_DSC510_WEEK11.py
2,521
4.15625
4
''' File: NERALLA_DSC510_WEEK10.py Name: Ravindra Neralla Course:DSC510-T303 Date:02/23/2020 Description: This program is to create a simple cash register program. The program will have one class called CashRegister. The program will have an instance method called addItem which takes one parameter for price. The method...
78eee39d5b2e07f640f8be3968acdec0b7c8e13f
dlingerfelt/DSC-510-Fall2019
/Safari_Edris_DSC510/Week4/Safari_DSC510_Cable_Cost.py
1,951
4.4375
4
# File : Safari_DSC510_Cable_Cost.py # Name:Edris Safari # Date:9/18/2019 # Course: DSC510 - Introduction To Programming # Desc: Get name of company and length in feet of fiber cable. compute cost at $.87 per foot. display result in recipt format. # Usage: Provide input when prompted. def welcome_screen(): """Pr...
d2587b87036af1d39d478e5db8c6d03b19c6da83
dlingerfelt/DSC-510-Fall2019
/SMILINSKAS_DSC510/Temperatures.py
1,290
4.21875
4
# File: Temperatures.py # Name: Vilius Smilinskas # Date: 1/18/2020 # Course: DSC510: Introduction to Programming # Desc: Program will collect multiple temperature inputs, find the max and min values and present the total # number of values in the list # Usage: Input information when prompted, input go to retriev...
5a3b8e3859ec4f9a5ab2d215a948ce55cd295552
dlingerfelt/DSC-510-Fall2019
/HA_DSC510/Assignment_9_1.py
4,800
4.3125
4
#!/usr/bin/env python3 # File: Assignment_9_1.py # Name: Jubyung Ha # Date: 02/09/2020 # Course: DSC510-T303 Introduction to Programming (2203-1) # Desc: Last week we got a taste of working with files. # This week we’ll really dive into files by opening and closing files properly. # # For this week we will modify our...
7faffa27e0944548717be676c521fcb8ed1653a8
dlingerfelt/DSC-510-Fall2019
/FRAKSO_MOHAMMED_DSC51/week6-lists.py
1,257
4.46875
4
''' File: lists.py Name: Mohammed A. Frakso Date: 19/01/2020 Course: DSC_510 - Introduction to Programming Desc: This program will work with lists: The program will contains a list of temperatures, it will populate the list based upon user input. The program will determine the number of temperatures in the prog...
42d37509986bc3233ab711cef2496ab4fa17602a
dlingerfelt/DSC-510-Fall2019
/Ndingwan_DSC510/week4.py
2,921
4.28125
4
# File: week4.py # Name: Awah Ndingwan # Date: 09/17/2019 # Desc: Program calculates total cost by multiplying length of feet by cost per feet # Usage: This program receives input from the user and calculates total cost by multiplying the number of feet # by the cost per feet. Finally the program returns a summary of t...
8c70251443a384255c610a8a96d4977c5da28947
dlingerfelt/DSC-510-Fall2019
/JALADI_DSC510/TEMPERATURE_OPERATIONS.py
1,536
4.53125
5
# File : MATH_OPERATIONS.py # Name : Pradeep Jaladi # Date : 01/11/2020 # Course : DSC-510 - Introduction to Programming # Assignment : # Program : # Create an empty list called temperatures. # Allow the user to input a series of temperatures along with a sentinel value which will stop the user input. #...
03bb8bd26bf0fd57b9ce248009c8a616cc977ff3
dlingerfelt/DSC-510-Fall2019
/JALADI_DSC510/RECEIPT_CALCULATOR_V2.py
3,648
4.53125
5
# File : calculator.py # Name : Pradeep Jaladi # Date : 12/09/2019 # Course : DSC-510 - Introduction to Programming # Assignment : # Using comments, create a header at the top of the program indicating the purpose of the program, assignment number, and your name. Use the SIUE Style Guide as a refere...
f5428333663e7da9d39bdff3e25f6a34c07ebd08
dlingerfelt/DSC-510-Fall2019
/Steen_DSC510/Assignment 3.1 - Jonathan Steen.py
1,186
4.34375
4
# File: Assignment 3.1 - Jonathan Steen.py # Name: Jonathan Steen # Date: 12/9/2019 # Course: DSC510 - Introduction to Programing # Desc: Program calculates cost of fiber optic installation. # Usage: The program gets company name, # number of feet of fiber optic cable, calculate # installation cost, bu...
af093e824555df86dc56d2b1b581270fd1671d1c
dlingerfelt/DSC-510-Fall2019
/Stone_DSC510/Assignment2_1/Assignment2_1.py
751
4.21875
4
# 2.1 Programming Assignment Calculate Cost of Cabling # Name: Zachary Stone # File: Assignment 2.1.py # Date: 09/08/2019 # Course: DSC510-Introduction to Programming # Greeting print('Welcome to the ABC Cabling Company') # Get Company Name companyName = input('What is the name of you company?\n') # Get Num of feet fe...
edc28c6d0a7bd72d9a875d7716f8957874455fd0
dlingerfelt/DSC-510-Fall2019
/Steen_DSC510/Assignment 4.1 - Jonathan Steen.py
1,364
4.15625
4
# File: Assignment 4.1 - Jonathan Steen.py # Name: Jonathan Steen # Date: 12/17/2019 # Course: DSC510 - Introduction to Programing # Desc: Program calculates cost of fiber optic installation. # Usage: The program gets company name, # number of feet of fiber optic cable, calculate # installation ...
f70f72b4d449726be0bb53878d32116d999756f5
dlingerfelt/DSC-510-Fall2019
/Steen_DSC510/Assignment 2.1 - Jonathan Steen.py
1,105
4.28125
4
# File: Assignment 2.1 - Jonathan Steen.py # Name: Jonathan Steen # Date: 12/2/2019 # Course: DSC510 - Introduction to Programing # Desc: Program calculates cost of fiber optic installation. # Usage: The program gets company name, # number of feet of fiber optic cable, calculate # installation c...
d1502cfe21c91a68849e70294c62fe6967a264d7
dlingerfelt/DSC-510-Fall2019
/HA_DSC510/Assignment_10_1.py
3,875
4.40625
4
#!/usr/bin/env python3 # File: Assignment_8_1.py # Name: Jubyung Ha # Date: 02/16/2020 # Course: DSC510-T303 Introduction to Programming (2203-1) # Desc: We’ve already looked at several examples of API integration from a Python perspective and # this week we’re going to write a program that uses an open API to obtain...
2155f32ff8af7f310124f09964e576fe5b464398
dlingerfelt/DSC-510-Fall2019
/DSC510- Week 5 Nguyen.py
2,139
4.3125
4
''' File: DSC510-Week 5 Nguyen.py Name: Chau Nguyen Date: 1/12/2020 Course: DSC_510 Intro to Programming Desc: This program helps implement variety of loops and functions. The program will add, subtract, multiply, divide two numbers and provide the average of multiple numbers input by the user. ''' def performCa...
90d0175b5c46e60927c347156e6469c17a975bf4
DhruvBajaj01/Python
/eight.py
113
3.6875
4
#printing the sum of a container(list,tuple etc) s=sum([20,40,10]) print('The sum of the container is:', s)
ba83368c602a2e913276547ce86dd329b2afa127
DhruvBajaj01/Python
/Numpy/num.py
188
3.59375
4
#aliasing #only one array is created #both have same memory address import numpy as num arr1=num.array([4,7,9]) arr2=arr1 print(arr1) print(arr2) #both give the same output
99674baad6fbcc054de343d40e03fbd2b2cbfb0a
TsigeA/PairProgramming
/Problem_E/solution_E3.py
1,284
3.9375
4
import random print "first move" mycount=0; comp_count=0; while (True): input1 = raw_input("What is your move? ") #if (input1 == 'r' or input1 == 'p' ): if input1 in ['r','p','s','l','k','R','P','S','L','K']: #then it's valid input1 = input1.upper() mylist=['R','P','S','L','K'] comp_input=random.choice(myl...
0cab43bf0cf5269bb56ba6f4709225a613c9737f
mun5424/ProgrammingInterviewQuestions
/subarraySum.py
494
3.703125
4
#Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum equals to k from typing import List class Solution: def subarraySum(self, nums: List[int], k: int) -> int: count = 0 for i in range(0, len(nums)): curr = 0 j = i + ...
7792db4a011bb25c73d467bc62a18efaef04bfa8
mun5424/ProgrammingInterviewQuestions
/orgmodification.py
1,033
3.640625
4
# given an n-ary tree with values E and N, modify it so that the tree is only composed of E values. # E # E N E # E N E # will be # E # E E E # E # class Employee: def __init__(self, empid, isengineer): self.empid = empid self.i...
7bd2456b0c77f97e11f16454bfa9890c28d93f35
mun5424/ProgrammingInterviewQuestions
/MergeTwoSortedLinkedLists.py
1,468
4.15625
4
# given two sorted linked lists, merge them into a new sorted linkedlist class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: # set iterators dummy = ListNode(0) ...
8afd0a85e0d3155af190d469617c63fb63dd7ddf
MasonSUn-6270/interesting-python
/装饰器示例和functoolswrags.py
752
3.734375
4
import functools "能将被装饰丢失的元数据弄回来,装饰到闭包中" class Kongjian(): @staticmethod def upper_sugar(func): """ 俺是一个装饰器,我使用闭包会定义一个函数,并返回这个函数对象本身 :param func: 初始函数对象 :return: 处理后的函数对象 """ @functools.wraps(func) def temp(): return func().upper() ...
0ccb3aec02f4bd2d50ab132f1282374ba300b39e
jiqin/leetcode
/codes/037.py
5,075
3.5
4
class Solution(object): def solveSudoku(self, board): """ :type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead. """ data_structure = [] for s in board: data_structure.append([]) for c in s: ...
c24194de7885a64a7881a8eb7b638cd86ddbe301
jiqin/leetcode
/codes/380.py
2,475
3.875
4
import random class RandomizedSet(object): def __init__(self): """ Initialize your data structure here. """ self._map = {} self._last_index = -1 self._list = [None] * 10000 self._rand = random.Random() self._rand_index = 0 def insert(self, val)...
eeb2068deeec87798355fe1bdd1e0f3508cbdcab
jiqin/leetcode
/codes/212.py
2,112
3.53125
4
class Solution(object): def findWords(self, board, words): """ :type board: List[List[str]] :type words: List[str] :rtype: List[str] """ word_map = {} for word in words: for i in range(len(word)): word_map[word[0:i+1]] = 0 f...
e381c063e594c2f3337c69af42c50c3a880e960b
mateusz5564/AplikacjeInternetowe2
/lab2_GDC.py
106
3.671875
4
def gcd(a, b): while b != 0: (a, b) = (b, a % b) return a print(gcd(10, 25))
925e59807e389fa2e6ee7559319352f446d0240e
EythorB/Assaignment8
/Assaignment8.py
1,520
3.984375
4
#Við ákvuðum að skipta þessu niður í 4 áttir. North, south, east og west. #Við vildum einnig að reitirnir myndu hafa táknið y og x #Eftir það notuðum við þá að north væri + x og south - #og þá west væri - y og east væri + #Síðan gerðum við forritið og allt heppnaðist vel for_low = "" x = 1 y = 1 p = True n = "(N)orth...
8883c75c0d2adc200493c43c69832f87dcaa7104
NTNTP/-home-noam-Mypython-.git-
/TD 1-2-3.py
8,260
3.640625
4
#!/usr/bin/env python # coding: utf-8 # In[2]: # Exo 1 x, y, z = 8, 3.6, 5 addition = x + y + z soustraction = x - y - z produit = x * y * z exp = x ** y modulo = z % x div = z / x print("Exo 1 :\n", addition, soustraction, produit, exp, modulo, div,"\n\n") # In[6]: # Exo 2 s = "manger" t = "regnam" conc = s + ...
74ac2b7a759f96da3e8b4b89befd61daf191b427
amanbhal/pythonCodes
/editDistance_DP.py
425
3.53125
4
def editDistance(A,B): matrix = [[0 for i in range(len(A)+1)] for i in range(len(B)+1)] for i in range(len(B)+1): for j in range(len(A)+1): if i==0: matrix[i][j] = j elif j==0: matrix[i][j] = i elif B[i-1]==A[j-1]: matrix[i][j] = matrix[i-1][j-1] else: matrix[i][j] = 1 + min(matrix[i][j-...
8c9d4f86f361b0595004cef09aecef5d0735d713
MikeConnelly/PasswordManager
/passwordmanager/interface/interface.py
7,552
3.578125
4
from getpass import getpass from passwordmanager.src.password_manager import UserError, AccountError class Interface: """ command line interface for password manager """ def __init__(self, pm): self.pm = pm def get_user(self): """create new user or continue to login""" wh...
248ef272c1b5518bc65b5e1b3bea27c7c0d1e9a8
thabbott/prisoners-dilemma
/TitForTat.py
811
3.953125
4
from Prisoner import Prisoner """ TitForTat: a Prisoner who copies their opponent's last choice. """ class TitForTat(Prisoner): """ This strategy requires remembering the opponent's last choice, so the class overrides the constructor to initialize a field to store this information. The value i...
927c077986634720b228b8478194895e077a381f
thabbott/prisoners-dilemma
/Prisoner.py
944
3.875
4
""" Prisoner superclass """ class Prisoner(): """ Constructor. Called once at the start of each match. If needed, override this method to initialize any auxiliary data you want to use to determine your Prisoner's strategy. This data will persist between rounds of a match but not between match...
52ce201ab2761c9392aeabe85a0fe336d680d415
feldcody/zip-shapefiles
/example_usage.py
5,442
3.796875
4
import zipper def zip_shapefile_simple(): try: ### Inputs input_shapefile = "C:\\Temp\\Shapefiles\\test.shp" # this dir will be searched for shapefiles shape_zipper = zipper.ShapefileZipper() # Create Instance of Class # By only passing an input file, an individual shapefilenam...
e284861b85523ad7457328f1424171ce9c95bcff
netromdk/tbgame
/tbgame.py
1,185
3.828125
4
# -*- Coding: utf-8 -*- # Requires python 3.x+ # tbgame implements turn-based games for making board games easier to # play without requiring a lot of paper and pencils. import sys from games import Assano, Triominos GAMES = {"assano": Assano, "triominos": Triominos} def usage(): print("Usage: {} [-h] <...
ba93ce5b67eddaa894b1e386981f0f3844bff3b1
lgruelas/extra-geometria
/segment.py
919
3.953125
4
class Segment: """ Representa un segmento de recta, definido por dos puntos. ATTRS: - _upper_endpoint - _lower_endpoint - _color """ def __init__(self, p1, p2, color=None): """ Asume que necesariamente p1 != p2. ARGS: - p1 (SegmentPoint2D): endpoint. - p2 (SegmentPoint2D)...
06f2937be9c9b9dfc166b60c1b46787ac843ff1a
eseng4313/pyGame-project
/turtle files/g.py
296
3.6875
4
import turtle bob = turtle.Turtle() bob.speed(11) bob.shape("turtle") for times in range(300): bob.forward(times) bob.right(190) bob.forward(40) bob.forward(times) bob.circle(30) bob.color("green") bob.pencolor("yellow")