blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
acaab692d282107be58f8e1cb4716b0b29b4342a
leila100/coding-exercises
/AdventOfCode/day6/star1.py
2,882
4.3125
4
''' You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input). Except for the univer...
26fb0cc983b8bafbafcded8bba4a34df7e658911
Ajaymenonm/python-programming-CPSC-442
/Assignment-02/assignment1.py
1,572
4.53125
5
## If you are given three sticks, you may or may not be able to arrange them in a triangle. For example, if one of the sticks is 12 inches long and the other two are 1‐inch‐long, you will not be able to get the short sticks to meet in the middle. For any given three values, there is a simple test to see if it is possib...
ee7b34e14b46e4629de1ae299bc4bdae52120b0c
Ajaymenonm/python-programming-CPSC-442
/Assignment-05/assignment2.py
12,853
3.625
4
# import csv # class PatientManagement: # """ # CONSTRUCTOR WILL REQUEST FOR THE FILE NAME AND INITIALISES ALL THE VARIABLES # """ # def __init__(self): # print("Welcome to UB patient management system") # self.patient_dict = {} # self.file_name = input("Enter the file Name: ") # self.read_pat...
1d39cbb5e7b6b65497dd339bbafbf394f2846696
abhishpj/Sample_automation
/leetcod/findminimum_inroatated_array.py
690
3.9375
4
"""" Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. You may assume no duplicate exists in the array. """ class Solution(object): def findMin1(self, nums): """ :ty...
18bf72fcfcf586b25283272527dcafcc68aea56d
Rojifa8800/classwork1
/lesson4.py
337
3.703125
4
a, b, c = 5, 3.2, "\"Hello\"" print(a) print(b) print(c) print("%s %s %s" (a,b,c)) print("%s\n%s\n%s" %(a,b,c)) print('I love {} and {}'.format('bread','butter')) print('I love {0} and {1}'.format('bread','butter')) age=23 message= "Happy"+ str (age)+"rd Birthday!" Y=10 X= print=("Happy {}th Birth...
92362f9157ea384b3b277c33874fa9d19b5bf79e
danthelion/python-st-petersburg-paradox
/main.py
1,392
3.953125
4
import random class Game: def __init__(self, fee): self.turn = 0 self.coin = None self.player_money = 0 self.bank_money = 0 def __repr__(self): return 'Player total: {0} | Bank total: {1}'.format(self.player_money, self.bank_money) def toss_coin(self): tos...
834d82c113ccf11438fc93f39ccd85de9549ea16
slovb/advent_of_code_2017
/17/silver.py
455
3.796875
4
def calc(steps, repeats = 2017): pos = 0 buf = [0] for i in range(1, repeats + 1): pos = (pos + steps) % len(buf) pos += 1 # insert ahead buf.insert(pos, i) pos = (pos + 1) % len(buf) return buf[pos] def main(inp): print calc(int(inp)) if __name__ == "__main__": imp...
eeb6509e895bb400b46745c2a747af97ab0c6283
slovb/advent_of_code_2017
/8/silver.py
2,524
3.5625
4
class Condition: def __init__(self, key, comparison, value): self.key = key self.comparison = comparison self.value = value def isTrue(self, registers): value = registers[self.key] if self.comparison == '==': return value == self.value elif self.compar...
e08b3b08160c54f44aeb5e7002b2097a8bfd0f4d
Ashrutha/calculator-
/calculator.py
881
4.125
4
def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y print("select options") print("1.add") print("2.subtract") print("3.multiply") print("4.divide") while True: choice = input("ënter the options 1./2./3./4.") ...
be89f567d7fdb699e39224e586eb36a30f919a05
taoqi98/Training
/python/code/for ppt python1/5.py
198
3.859375
4
def three_num_sum(a, b=3, c=4) : d=a+b+c return d #def three_num_sum(a=2, b, c) : # d=a+b+c # return d print(three_num_sum(2)) print(three_num_sum(2,4)) print(three_num_sum(2,c=10))
0b38b787bf8b1e661590067b84414dfcdb999b66
KingsleyDeng/PythonTraining
/Chapter_05/课后练习2.py
434
3.796875
4
def sort_list(sort_lst): lst_len = len(sort_lst) for i in range(0, lst_len): sort_flag = True for j in range(0, lst_len - i - 1): if sort_lst[j] > sort_lst[j + 1]: sort_lst[j], sort_lst[j + 1] = sort_lst[j + 1], sort_lst[j] sort_flag = False if...
e5ec238f06f3fa684f6b6950c5bced9435c2e041
KingsleyDeng/PythonTraining
/Chapter_05/课后练习1.py
260
3.859375
4
def sort_list(sort_list): temp_list = [] for i in range(len(sort_list)): min_var = min(sort_list) sort_list.remove(min_var) temp_list.append(min_var) return temp_list my_list = [3,42,43,12,5,3,65] print(sort_list(my_list))
91d416a812683fb1c2e531341ceec5a60188e9f2
KingsleyDeng/PythonTraining
/Chapter_04/空心菱形.py
589
3.875
4
#codeing: utf-8 height = int(input("请输入菱形的高度: ")) height = (height +1)//2 for i in range(height): half_blank = " " * (int((height*2-1-(i*2+1))/2)) if i == 0: print(half_blank,"*",half_blank,sep='') else: mid_blank = " " * (i*2-1) print(half_blank,"*",mid_blank,"*",half_blank,sep='') ...
a9353dfd3fe4385edbb05e2df7d66ed93c41ecdb
KingsleyDeng/PythonTraining
/Chapter_07/练习1.py
542
3.578125
4
n = input("请输入一个整数") try: num = int(n) i = 0 while (True): num_str = input("请输入以空格分隔的两个整数") try: a, b = num_str.split(' ') print("%d整除%d的结果为:%d" % (int(a), int(b), int(a) // int(b))) i += 1 if i >= num: break except Valu...
8d77cd7debdf6134ab071bb1cdfe4d79d15756d6
KingsleyDeng/PythonTraining
/Chapter_05/课后练习8.py
265
3.515625
4
import random def fn(n): temp_lst = [] for i in range(n): while(True): num = random.randint(0, 100) if num not in temp_lst: temp_lst.append(num) break return tuple(temp_lst) print(fn(10))
09fd31d23b7d130d6cec98ba3268bee8d7469835
yatish0492/PythonTutorial
/42_Database_Connection.py
602
3.5
4
''' ''' import mysql.connector # Connection mydb = mysql.connector.connect(host = "localhost", user = "yatish" , passwd = "1234", database = "TestDatabase") # We need this cursor like how we have 'statement' in java, which will call 'execute' mycursor = mydb.cursor() #execute the statement mycursor.execute("selec...
7ea17de345ad08df4f97bf7fcf7d9fcb843209e6
yatish0492/PythonTutorial
/5_Tuple.py
447
3.96875
4
''' Tuples are defined using '()' Tuples are IMutable unlike List. So they are fast in Iteration Tuple is also heterogeneous. ''' a = (1,2,"yatish",25.3) # Tuple is also heterogeneous # We can access each element of set by using the indexes including negative and ranges as shown below print(a) print(a[0]) print(a[-1...
213d00d8a5fa9bb059104c6f6115d1aac247df61
yatish0492/PythonTutorial
/23_Recursive.py
710
4.53125
5
''' Recursive Functions ------------------- Same as how it is in java but in python, by default the default recursive limit is 1000, which means, if function can be called recursively for 1000 max and if it calls after 1000 times then python will throw an error - 'RecursionError: maximum recursion depth exceeded while ...
b25105a22397b6d8cf73732c9cb705e8f47f8004
yatish0492/PythonTutorial
/3_Variables.py
2,204
4.21875
4
''' Variables in Python ------------------- You do not need to declare variables before using them, or declare their type. Every variable in Python is an object. ''' a = 10 # Getting address of the variable. 'id(<VARIABLE>)' is the function used to fetch address of the variable. print(id(a)) ''' Python is more mem...
4ba7991bba15c5db63247eb6df606dfa9392e7f9
yatish0492/PythonTutorial
/7_DataTypes.py
3,653
4.21875
4
''' Following are the data types as follows, 1) None 2) Numeric a) int b) float c) complex d) bool 3) List 4) Set 5) Tuple 6) String 7) Range 8) Dictionary ''' ''' None ---- This is same 'null' in java. In python, instead of 'null' we call it as 'none' ''' #a # print(type(a)) --> This will give er...
f1c6954e880042b87f7cf4083430dfac2288d2bf
yatish0492/PythonTutorial
/16_Print.py
886
4.375
4
''' print ''' # print() is equivalent to println() in java. Automatically '\n' will be added at last print("this is println ") print("this is println ") # How to achieve print() of java. we need to explicitly specify what should be the end string by providing 'end=' print("this is print() functionality",end="") pri...
d963405176854205a95b17fc59a65fff55ac772e
yatish0492/PythonTutorial
/pandas/1_DataFrame.py
8,116
3.953125
4
# Import panda library import pandas as pd ''' What is a DataFrame? DataFrame is a type of data. What is the data type of columns? 'Series' is the data type of columns. its not list or tuple, make sure. 'Series' is a data type in pandas library 'pandas.core.series.Series' ...
53a9a9ec7ccbb200330cba50d2ded4f709b5b051
RachealIfe/Data-Structures-Sample
/Selection_sort.py
332
3.921875
4
def selection_sort(arr): for k in range(len(arr)): min_index=k#smallest element for j in range(k+1, len(arr)): if arr[min_index]>arr[j]: min_index=j arr[k], arr[min_index] = arr[min_index],arr[k] nums = [65,43,23,4,23,4,34,45] selection_sort(nums) p...
95dfa9b12e8a704dd74445e3fa86f47e05e0a68e
sharmosarkar/ML-NEU-Course
/HW-2/code/Multilayer_Perceptron/src/perceptron.py
3,603
4.34375
4
""" Implement a Feed Forward Neural Network, with an input layer with S1 units, one hidden layer with S2 units, and an output layer with S3 units using the backpropagation algorithm and the sigmoid activation function. Run it on the dataset provided. Try different number of hidden nodes in the hidden layer, S2 = 10, 20...
ac2e6d93ac0bd585a64f6fda7129f033e1e980b3
ChangHyun2/python
/Cousera/week3/files/Files.py
694
3.78125
4
# Using open() # handle = open(filename, mode) fhand = open('test.txt', 'r') # 'r' & 'w' fhand2 = open('test.txt') print(fhand) print(fhand2) # newLine cgaracter stuff = 'h\ni' print(stuff, len(stuff)) # File processing ''' a text file has newlines at the end of each line a text file can be though...
1e6f797fa3f6b296f89c7d8da37ce2f43f97823f
ChangHyun2/python
/Cousera/week1/strings/looping.py
175
3.75
4
''' fruit = 'banana' index = 0 while index < len(fruit): c = fruit[index] print(index, c) index+=1 ''' fruit2 = 'apple' for c in fruit2: print(c)
b0d60036e5837a88e8ac25b916cb28b9c1ab5417
AlexNVanPatten/TargetAudience
/ReadFile.py
713
3.515625
4
import io import csv file1 = 'dogs.csv' file2 = 'tweens.csv' file3 = 'researchers.csv' def readFile(): list1 = [] list2 = [] list3 = [] with open('dogs.csv') as csvfile: reader = csv.reader(csvfile, delimiter='\n', quotechar='|') for row in reader: list1 = list1 + row ...
2f7b9b2d8d31aa162aef46368602a905cca2b7ff
Santosh-J/PythonProgramming
/Practice/Strings.py
716
4.21875
4
import operator # using operator library message= "Meet me tonight." print(message) message2 ="""One of my favotite is: "I'm really bad""" print(message2) # understanding sorting xs={'a':4,'b':3,'c':2} print(sorted(xs.items(),key=operator.itemgetter(1))) print(sorted(xs.items(),key= lambda x:x[1])) x,y,z=0,1,0 if x==1 ...
4368d97b780d85c85622fd8d45bbdd110ba93d95
SPritchard86/cp1404
/cp1404Practicals/prac_01/electricity_bill_estimator.py
609
4.09375
4
print("Electricity bill estimator.") TARIFF_11 = 0.244618 TARIFF_31 = 0.136928 print("""Please choose the number from the list of Tariffs below: 1. Tariff 11 ($0.244618 c per kWh) 2. Tariff 31 ($0.136928 c per kWh)""") tariff_choice = int(input("1 or 2? ")) if tariff_choice == 1: cents_per_kWh = TARIFF_11 else: ...
573dcd70974f208f6cc70f0c15855375529a9270
jshrake/google-code-jam
/africa-2010/qualification/store-credit/store-credit.py
928
3.671875
4
import sys def find_two_items(credit, items, num_items): # complexity O(num_items * log(num_items)) # need to keep track of original indices of the sorted items indices = sorted(range(num_items), key = lambda k: items[k]) items.sort() beg = 0 end = -1 while True: first = items[beg] last = items[...
16f251201669ada05b242023b16c971851845648
KyawZinAung12/python-exercise
/ex34.py
460
3.890625
4
animals = ['bear', 'python3.6', 'peacock', 'kangaroo', 'whale', 'platypus'] bear = animals[0] python =animals[1] peacock =animals[2] kangaroo =animals[3] whale =animals[4] platypus =animals[5] print(f"The first animals is at 0 and is a {bear}") print(f"The third animals is at 2 and is a {peacock}") print(f"The first a...
4596a8a1b66ed3c5d601b2e852edd638cb7dd8e7
pilarhan/Djangogirlsnauka
/test.py
175
3.828125
4
print("hello world") liczba = input("podaj liczba: ") if 5 > int(liczba): print('5 jest jednak większe od '+liczba) else: print('5 nie jest większe od '+liczba)
369b7b2aca91f843d9a2e9d4d32bca00a17a9478
Davidlwanwai/basic_free
/7_data_structures_and_algorithms/python_implementations/quick_sort2.py
1,879
3.71875
4
# sammie bae def quick_sort(items) : return quick_sort_helper(items, 0, len(items) - 1); def quick_sort_helper(items, left, right) : # index; if (len(items) > 1) : index = partition(items, left, right); print("\n", items, "index=", index, "L=", left, "R=",right) ...
2ec4d265b92ec17ce9a79c2ea60fc056a2a1f233
Pia-Park/class-python-0224
/12-py_json.py
273
3.53125
4
import json #sample JSON userJSON = '{"first_name":"Inae", "last_name":"park", "age":34}' #parse to dict user = json.loads(userJSON) print(user) print(user['first_name']) car = {'make': 'toyota', 'model':'soora', 'year': 1970} carJSON = json.dumps(car) print(carJSON)
78ad2333845c07c5f047c3acef10e11b792fc05b
Pia-Park/class-python-0224
/08-loop.py
576
4.09375
4
people = ['ami', 'inae', 'kideok', 'marina'] #simple loop for person in people: print(f'Current person: {person}') #break for person in people: if person == 'kideok': break print(f'Break Current person: {person}') #continue for person in people: if person == 'inae': continue #skip ...
02a0c90c32151fda51502a3ffcf429ea40ac42d1
avaldez22/cs451-hw02-geopy
/avaldezHw2.py
963
3.640625
4
from geopy.geocoders import Nominatim # Create a geolocator object to access geo data using Nominatum geolocator = Nominatim() # A query address query = '1314 chavez st, las vegas, nm' # Build/retrieve a geopy Location object with a query address location = geolocator.geocode(query) # Access the latitude from locat...
3b9e9e27282ef9fba729b0299b6cf89feeb93b3a
Itisdanil/Tinkoff_ML
/recom_system_hw9/utils.py
1,669
3.59375
4
import numpy as np from typing import Optional, Union, Tuple def euclidean_distance(x: np.array, y: np.array) -> float: return np.sqrt(np.sum((x - y)**2)) def euclidean_similarity(x: np.array, y: np.array) -> float: return 1 / (1 + np.sqrt(np.sum((x - y)**2))) def pearson_similarity(x: np.array, y: np.arr...
17c702fca1a0110e05f5b3c7e48d01a63cf7a991
parv00cypher/kartik_python
/RPS_terminal.py
1,035
4.1875
4
import random n=random.randint(1,3) if n==1: c="rock" elif n==2: c="paper" else: c="scissor" print("R. Rock\nP. Paper\nS. Scissor\n") u=input("Enter your choice: ") print("\n") if u.lower()=="rock" or u.lower()=="r" or u.lower()=="a" or u=="1" : ur="rock" print("You choosed rock") elif...
ae7ed351f247300db727547366b5399aa3b2e05e
xuejieshougeji0826/leetcode_top100
/169.py
562
3.8125
4
'''给定一个大小为 n 的数组,找到其中的众数。众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。 你可以假设数组是非空的,并且给定的数组总是存在众数。 示例 1: 输入: [3,2,3] 输出: 3 示例 2: 输入: [2,2,1,1,1,2,2] 输出: 2''' class Solution: def majorityElement(self, nums): nums=sorted(nums) if len(nums)%2==1: return nums[int((len(nums)/2))] else: re...
6914946c28e3bd23b75f76898aab584cf6bba42f
xuejieshougeji0826/leetcode_top100
/832.py
507
3.734375
4
class Solution: def flipAndInvertImage(self, Lists): l=len(Lists[0]) for i in range(0,len(Lists)): Lists[i]=list(reversed(Lists[i])) print(Lists) for j in range(l): #List[i][j]=List[i][j]^1 #print(Lists[i]) if Lists...
88f6226d961363f38d8c5611e5a74e279f9f94f2
xuejieshougeji0826/leetcode_top100
/240.py
458
3.65625
4
class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if matrix==[]: return False else: while (i<) try: e s = Solution() str=[ [1, 4, ...
d7ed303f45a19d03be427b8332a05fae821f78d9
Deepakkoli93/mini-twitter-api-client
/run.py
1,507
3.5625
4
#!/usr/bin/python import os from flask import Flask, render_template, request from TwitterApiClient.api_client import api_client app = Flask(__name__) """ This is the landing page. Only a form is displayed here with pre-filled input values. """ @app.route("/") def index(): hashtag = "#custserv" min_retweets = 1 ...
8b7bd7e3fea93dc77cc4288f695d178177fd37b3
CDeas9/Mortgage
/mortgage_Deas_Callie.py
775
4.125
4
def main(): cost = float(input('How much does the house cost? ')) down = float(input('What percentage are you putting down? ')) percent = down/100 money_down = float(cost*percent) total = cost-money_down print('You are putting down ' + str(money_down) + ' leaving ' + str(total) + ' for the mortg...
d92eb74ff63e67cab307fdcb5a4a52e3957d9c32
baskaravishnus/General
/Battery_Notifier.py
650
3.59375
4
import psutil import time from tkinter import * # from psutil we will import the # sensors_battery class and with # that we have the battery remaining while(True): battery = psutil.sensors_battery() percent = battery.percent if(percent>99): #Here,Set the percentage as you want root =...
45362cc9d9d53dfe8e452a150757c0e892981abb
ChenLumen/Coursera-Assignments
/Modern_Robotics_Robot_Motion_Planning_and_Control/Sampling-Based_Planning_Assignment/code/node.py
2,122
3.765625
4
from math import inf, sqrt import numpy as np from numpy.linalg import norm class Node(): """Node used in search algorithms. Contains node information like position, least-cost parent, and any neighbors connected to this node. ... Attributes ---------- id : str id of the node object x : float x locat...
b09a652a743f73dbb10d758e4fc373c4532e8e10
Nithinkumar-s/Python
/tst1.py
525
4.125
4
print("input two numbers") num = input() num2 = input() print("addition = ",int(num) + int(num2)) print("substraction = ",int(num) - int(num2)) print("product = ", int(num) * int(num2)) print("qoutiant = ", int(num) / int(num2)) print("reminder = ", int(num) % int(num2)) print("input two numbers") num = int(input()) n...
01d91baf164cd4e05f0e4938450be5e6ff91d3d7
jiyong013/python_prac
/quiz6.py
531
3.859375
4
#function def std_weight (height, gender) : if(gender == '남자') : return (height * height * 22) elif(gender == '여자') : return (height * height * 21) else : return -1 height = int(input("키(cm)를 입력하세요(ex. 170): ")) gender = input("성별을 입력하세요(ex. 여자): ") # height = 170 # gender = '남자' ...
30ffda2895e68850c03e2f8663cfc87455d6f93a
joselitan/selenium-python-framework
/tests/trash/date_yyyymmdd.py
424
4.03125
4
## Adding days to date in Python import datetime from datetime import date ## Date object # date_original = datetime.date(2019, 7, 20) date_original = date.today() ## Days to add days_to_add = 16 ## Add date_new = date_original + datetime.timedelta(days_to_add) print("\n Original Date: ", date_original, "\n") print...
c908199b50c49556f1724bce5ce1d2975ed5d7e3
andymithamclarke/Pundits-Review-Scraping
/phase_two_scrapy_inside_notebook/modules/target_identifier.py
2,532
3.953125
4
# ========================= # This file contains a function to loop through the dataframe and return target players # ========================= # Function will loop through the rows in the dataframe # It will then loop through the players in the teams listed # Using the function 'identify_nsubj_pobj' it will identi...
34d5ce2147c3cafb2d1891823ccb64e750d3e0dc
kandomere/TestOTR
/SQLfunks.py
6,113
3.5625
4
import sqlite3 as sql import datetime import tkinter as tk import tkinter.ttk as ttk def create_databases(): """Создание трех таблиц""" with sql.connect('Test.db') as db: cur = db.cursor() cur.execute("""CREATE TABLE IF NOT EXISTS clients (client_id INTEGER PRIMARY KEY AUTOINCREMENT, ...
1e1968ffb9b77969b3b451f79a70fb5e0dbb5262
Sofista23/Aula2_Python
/Aulas_2/Aula36/Aula36a..py
206
3.625
4
#Converter de JSON para DICTIONARY import json carrosJson='{"Marca":"Honda","Modelo":"HRV","Cor":"Prata"}' carros=json.loads(carrosJson) print(carros) for x,y in carros.items(): print(f"{x}: {y}")
f69a83dac3bc2cd8a72dc061e7c455ca30287e81
Sofista23/Aula2_Python
/Aulas_2/Aula06/Aula06a.py
301
3.640625
4
anime="Toradora - Tigre e Dragão" anime2="Erased - Boku Dake Igai na Imachi" print(anime[0:15]) print(f"Tamanho: {len(anime)}") print(anime.strip()) print(anime.lower()) print(anime.upper()) print("Tigre" in anime) print("Dragão" not in anime) print(f"{anime} e {anime2} são animes muito bons!")
660ecf4fc2487a348c735ab1a544f8d0c5e51c15
Sofista23/Aula2_Python
/Aulas_2/Aula17/Aula17a.py
356
3.71875
4
#Key:Value carros={ "Fabricante":"Honda", "Modelo":"HRV", "Ano":"2021" } carros["Cambio"]="Autmático" carros.pop("Cambio") fab=carros.get("Fabricante") mod=carros["Modelo"] print(fab) print(mod) print(carros["Ano"]) print("-="*35) for x in carros: print(x+": "+carros[x]) print("-="*35) print(f"Tam...
b5bd435132b1fe01a94f4f340952d44241af25ae
Akanksha080197/Python
/Automation/15May/script2.py
1,250
3.890625
4
#walk function in OS -> allow the traversal in the directory even in nested form , self recursive #Three return values :->1. names of files #2.names of subdirectories #3.parent folder #absolute path should be given , or else where the directory is present there the .py file should be there from sys impor...
f280ddbc8135989a5830704690161dd2e4f54c0a
nguyenhoangdung123/nguyenhoangdung
/session4/validateinput.py
163
3.984375
4
while True: txt = input("nhap ten cua ban? ") print(txt) if txt.isalpha(): print("nhap ten thanh cong ") break else: print("nhap ten khong thanh cong")
91dfacac086cb375100dca531cceb5ad00be97f4
nguyenhoangdung123/nguyenhoangdung
/session5/dung8.py
306
3.96875
4
while True: email = input("nhap email:") taikhoan = input ("Nhap tai khoan:") matkhau = input ("nhap mat khau:") matkhau2 = input ("nhap lai mat khau:") if matkhau2 != matkhau: print("Tao tai khoan thanh cong !") break else: print("Tao tai khoan thanh cong")
02f783521ad022f480439f5ace3ed107a2b72273
nguyenhoangdung123/nguyenhoangdung
/session7/minihack4.py
173
3.953125
4
from turtle import* item = ['blue','red','green'] print("Our list: ", *item) color('blue') forward(100) color('red') forward(100) color('green') forward(100) mainloop()
09933e0b9b5a8fc33363b2c36c16d906d3f0ae74
nguyenhoangdung123/nguyenhoangdung
/session3/muatrongnam.py
176
3.953125
4
yob = int(input("a month of year")) season = yob*3 print(season) if <30: print("rainy") else <60: print("summer") if <: print("autumn") else: print("winter")
5d9e4cc1f4c8403a40c381808d8997cb4600f1d3
nguyenhoangdung123/nguyenhoangdung
/muatrongnam.py
172
3.953125
4
yob = int(input("a month of year")) season = yob*3 print(season) if : print("spring") elif : print("summer") elif : print("autumn") else: print("winter")
18f159f519390544c78312012894dcf70d524862
Sparkle-cloud/python_sums
/-Palindrome.py
2,297
4.375
4
"""A palindrome is a word that is spelled the same backward and forward, like “noon” and “redivider”. Recursively, a word is a palindrome if the first and last letters are the same and the middle is a palindrome.The following are functions that take a string argument and return the first, last, and middle letters: ...
136a94e662d09352e3ab337bca0427cd519a3d3c
jasemabeed114/Email-Extraction-Project
/Repository.py
1,362
3.671875
4
# Repository.py # python # # Created by Micheli Knechtel on 05/03/2018. # Copyright © 2018 Micheli Knechtel. All rights reserved. # # Description: class Repository() # Class to manage a repository, with a path representing of a given # repository, its possible to answer such questions: # # 1) Does this rep...
cae7268838b29fcb9d890c0d33a8030826322014
leonzh2k/Harbinger
/Tic Tac Toe.py
2,530
3.671875
4
from tkinter import * from time import * print("---------------Tic-Tac-Toe---------------\n") class TheGame(Frame): def __init__(self): Frame.__init__(self) #Creates the board self.myCanvas = Canvas(width=500, height=500, bg="black") self.myCanvas.grid() #Cre...
4e88c14995663839438e5e0a0271d6686e31813a
littlecorner/LearnPython
/untitled/chapter06/6.5继承/6.5.1单继承.py
1,645
4.34375
4
''' #单继承:子类只继承自一个父类 #定义Animal动物类 class Animal: #定义动物类具有的一些行为 def eat(self): print("----吃----") def drink(self): print("----喝----") def run(self): print("----跑----") #定义子类Dog继承父类Animal class Dog(Animal): #狗类除了继承父类Animal具备的行为,它还会握手 def hand(self): print("******汪汪汪...
8a06b37a4fd13f41d5f692d478c2d2c70ffa4569
littlecorner/LearnPython
/untitled/chapter09/9.2文件管理.py
694
4.09375
4
''' 文件管理相关的操作需要引入python内置的os模块,使用“import os”方式引入 ''' import os ''' 1、rename(oldfile,newfile)函数:对文件或者文件夹重命名 ''' #os.rename("test.txt","测试.txt") ''' 2、remove(path)函数:删除指定文件 ''' #os.remove("测试.txt") ''' 3、mkdir(path)函数:在指定的路径下创建新文件夹 ''' #os.mkdir("d://testdir") ''' 4、getcwd()函数:获取程序运行的绝对路径 ''' print(os.getcwd()) ''...
a8a3d689b204e4b46c2134f049203f6719b71f40
jacob-bonner/ICS3U-Unit6-02-Python
/number.py
981
4.46875
4
#!/usr/bin/env python3 # Created by: Jacob Bonner # Created on: September 2019 # This program finds the largest number in an array import random def calculate(array_of_numbers): # This function finds the largest number in a list # Variables large_number = 0 # Process for counter in range(len(...
919417df08096b5406299ea7d220e06081fac0b7
tmsteen/flight_planner
/course_calc.py
1,862
3.65625
4
#Import necesary mdules #import urllib2 from BeautifulSoup import BeautifulSoup import requests import re import LatLon23 import sys def get_lat_lon(origin): #Got to FAA page to gather airport data soup = BeautifulSoup(requests.get("https://nfdc.faa.gov/nfdcApps/services/airportLookup/airportDisplay.jsp?airportId={0...
4978bdd8a7ec75c9187a0d4779a915e3b2f47f8d
YeQarybe-crazyboy/Year
/crazyYear.py
448
3.671875
4
a = int(input("Enter the number of year/years >>> ")) print("-------------------------------") print(f"\n{a} year = \n\nsecond = ",a*31557600,"\n") print("Minutes = ",a*31557600/60,"\n") print("hours = ",a*31557600/60/60,"\n") print("Day = ",a*31557600/60/60/24,"\n") print("Week = ",a*31557600/60/60/24/7,"\n") pr...
d94ad09f001435cb6c81775f1ae73d65a457f412
lxcl96/AlienInvasion
/bullet.py
1,412
3.609375
4
# @Time : 2021-03-16 22:17 # @Author : ly # @File : bullet.py.py # @Software : PyCharm import pygame from pygame.sprite import Sprite class Bullet(Sprite): """管理飞船所发射子弹的类""" def __init__(self, ai_game): """在飞船当前位置创建一个子弹对象""" super().__init__() # super后要加()代表调用 self.screen = ai_game.sc...
06ae8cc99de45d4a4e4aa982900a9b91b1bcd7ed
lyiker/leetcode
/leetcode-py/leetcode061.py
998
3.796875
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def rotateRight(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ if not hea...
cd2ca1bade5b958ad570cac1ff55a13bdc69d47f
lyiker/leetcode
/leetcode-py/leetcode007.py
290
3.53125
4
class Solution: # @param {integer} x # @return {integer} def reverse(self, x): neg = 1 if x < 0: neg = -1 xStr = str(x)[1:] else: xStr = str(x) x = int(xStr[:: -1]) return 0 if x > 2 ** 31 else x * neg
a4a1369d84f3c26a9365cc5bc9c22de6d3f1cbad
sibylle69/CS50-Harvard-course-exercises
/sibylle69-cs50-problems-2020-x-cash/cash.py
647
3.875
4
from cs50 import get_float def main(): dollars = get_positive_int() print(f"Change owed: {dollars}\n") cents = int(dollars * 100) number_of_coins = 0 if cents % 25 >= 0: number_of_coins += cents // 25 cents = cents % 25 if cents % 10 >= 0: number_of_coins += cents ...
f4aaf2f09738a9c61ca3a5abc7ee9c0990a09cd0
acb16ua/COM3110-Text-Processing
/code_data/distance_convert_v2.py
386
4.21875
4
# -*- coding: utf-8 -*- """ Created on Wed Sep 26 10:40:13 2018 @author: acb16ua """ # Converts distance in miles to kilometers miles = input("Enter the miles to be converted to kilometers: ") kilometers = (float(miles) * 8.0) / 5.0 print("Converting distance in miles to kilometers:") print("Distance in mi...
e0582c27adbf59bedf34b58b63d60b07ab83c1ce
LutherCS/ads-class-pub
/exercises/hashing/hashing.py
2,922
3.984375
4
#!/usr/bin/env python3 """ `hashing` implementation and driver @authors: Roman Yasinovskyy @version: 2021.10 """ def hash_remainder(key: int, size: int) -> int: """ Find hash using remainder :param key: key to hash :param size: size of the map :returns: hash of the key >>> hash_remainder(160...
b99f0b00053a6511c5e6a6460a90f0e5dfe9f0fd
TheTekUnion/Software
/console_applications/random_number.py
652
4.34375
4
""" ***PSUEDOCODE*** Give Instructions Ask for the users minimum number. Ask for the users maximum number. Create a random number from the range. Print the number. """ # import modules import random #instructions print("Welcome to Random Number.") print("Enter your minimum and maximum numbers. ") print("Numbers wi...
c6689646b9c0b5b51b36ff1a187b7a64b5e32625
TheTekUnion/Software
/console_applications/console_universal_calculator/geometry/trapezoid.py
711
3.703125
4
import math def trapezoid_area(base_a, base_b, height): return ((base_a + base_b) / 2) * height def trapezoid_height(base_a, base_b, area): return 2 * (area / (base_a + base_b)) def trapezoid_base_a(base_b, height, area): return (2 * (area / height)) - base_b def trapezoid_base_b(base...
367e4697c36c3cac9d77f196dd62bfe817b9f5b9
TheTekUnion/Software
/console_applications/slope.py
431
4.21875
4
while True: try: y2 = float(input("Enter y2: ")) y1 = float(input("Enter y1: ")) x2 = float(input("Enter x2: ")) x1 = float(input("Enter x1: ")) def slope(y1, y2, x1, x2): return (y2 - y1) / (x2 - x1) print("Slope: " + str(slope(y1, y2, x1, x2))) e...
7f4293f97ff4e20b4bee546c76793d4b801b265e
TheTekUnion/Software
/console_applications/console_universal_calculator/arts_and_design/color_codes.py
1,003
4
4
import pygame import sys import math def hex_to_rgb(value): value = value.lstrip("#") len_val = len(value) #Convert hex to an integer then divide it up into three parts thus creating an rgb value return tuple(int(value[i:i + len_val // 3], 16) for i in range(0, len_val, len_val // 3)) de...
56648f6973dd2b79b3e33e4f37d37875e434c7fb
priyankasingh/advent_of_code
/day2b.py
436
3.640625
4
f = open("day2","r+") lines = f.readlines() total_ribbon = 0 for l in lines: # gets the 3 sides s = l.rstrip().split('x') # calculate bow bow = int(s[0]) * int(s[1]) * int(s[2]) # new list with integer vale k =[int(s[0]), int(s[1]), int(s[2])] # remove biggest side k.remove(max(k)) # calculate the two small...
f7acb13cf5d3cea198d0701f4029477a4fe2f4ff
SpirosOrfanos/Global-Coding-Challange-2020
/Question_1/Python/Question1.py
499
3.609375
4
def findMaxProfit(predictedSharePrices): maxis = predictedSharePrices[1] - predictedSharePrices[0] minis = predictedSharePrices[0] for i in predictedSharePrices: if i - minis > maxis: maxis = i - minis elif i < minis: minis = i return maxis def main(): line ...
07ebe04919f33ac67636bc9501d6496f6abd3ef0
ummagumm-a/minesweeper
/Board.py
4,421
3.640625
4
import random from Cell import Cell class Board: # Constructor for board # Specifies width, height, and number of bombs def __init__(self, w, h, n_bombs): self.cells = [[Cell(y, x) for x in range(w)] for y in range(h)] self.w = w self.h = h self.n_bombs = n_bombs se...
0c920a66815401f1e767a4867834d3d7e8128f80
vero-obando/Programacion
/Clases/clase2.py
711
3.71875
4
# Falso o verdadero pruebaV = True pruebaF = False print (pruebaF) print (pruebaV) pruebaV = pruebaF print (pruebaV) # Datos iniciales edad = 18 estatura = 1.55 peso = 55 NOMBRE = "Veronica Obando Builes" print ("#"*15, "Mayor Edad", "#"*15) isMayorEdad = edad >= 18 print (isMayorEdad) print ("#"*15, "Bajo La Estatu...
ac285b62a1ac8c331ad132519d1736227527d0e6
vero-obando/Programacion
/Clases/ClasesyObjetos/introduccion.py
3,173
4.1875
4
class Humano(): def __init__ (self, nombreEntrada, edadEntrada, estaturaEntrada): ''' Esta es la clase Humano y pide atributos de nombre, edad y estatura. Tiene las acciones de: * Hablar *Mostrar atributos *Recorrer distancia *Ahorrar dinero ''' ...
b7ecd35a07d31436d5ef11906a47653fa3d3c112
vero-obando/Programacion
/Clases/Funciones/conversorTemperatura.py
1,389
3.84375
4
def conversionTemperatura (temperaturas, unidad): ''' Convierte una lista de temperaturas segun la unidad ingresada... K. Kelvin F. Fahreheint Devuelve la lista convertida en las unidades deseadas, Si se ingresa un valor no valido retorna None ''' listaConvertida = [] for temperatura...
440b6970468c73e211d995fc131ea1c62d616b4f
adriano-pacheco/atividades-mentorama
/desafio97.py
395
3.78125
4
#faça um programa que tenha a função chamada escreva() # que receba um texto qualquer como parâmetro # e mostre uma mensagem com o tamanho adáptvel. def lin(quantidade): print('~'*len(quantidade)) def escreva(txt): lin(txt) print(txt) lin(txt) escreva('Helo') escreva('Como é fácil aprender com o Gu...
55b7928dfd10bd8128b1c87e1a94ddaf5bba6cba
nalrasbi/astrostats
/HW2_1_2.py
1,432
3.71875
4
import numpy as np box = [40]*4 + [60]*5 + [75]*6 print(f"A box has contents {box}") print(f"A box has {len(box)} light bulbs") two_where_75 = 0 all_three_same = 0 one_of_each = 0 n = 100000 for i in range(n): bulbs = sorted(np.random.choice(box, 3, replace=False)) # Part a # Count when 2type...
595356aad0d9950e0089d3eb94ee43948cc0e1fd
youyuebingchen/chatbot
/nlp_basic_knowledge/sentiment_classify_dictionary/sentiment_with_ml.py
463
3.5
4
from nltk.classify import NaiveBayesClassifier # 分词打标签然后进行训练 def preprocess(s): return {word:True for word in s.lower().split()} s1 = " " s2 = " " s3 = " " s4 = " " training_data = [[preprocess(s1),"pos"], [preprocess(s2),"pos"], [preprocess(s3),"neg"], [preprocess...
6b8f5de142637bb5eab4b446acd15b8a6413689e
cjb5799/DSC510Fall2020
/BREHM_DSC510/Brehm_Week4.py
1,345
4.1875
4
# DSC 510 # Week 4 # Programming Assignment Week4 # Author: David Brehm # 09/21/2020 # Function to calculate the total cost. def rateCalc(inFeet, inRate): total = inFeet * inRate return total print('Welcome Customer!') # Welcome message. name = input('Please enter your name: ') # User input name. company =...
2bc4b068a7f6c5e9ea39ea782564406d40b7fadc
cjb5799/DSC510Fall2020
/CHAVALI_DSC510/Assignment_9.1.py
1,738
4.09375
4
# DSC510 # Week 8 Assignment - Assignment_8.1.py # calculating Word frequency to a file # Author Sowmya Chavali # 10/31/20 import string # This function checks if an individual word is in the dictionary and adds it as a key if it is not present. def add_word(w,dict): if w not in dict.keys(): dict[w] = 0 ...
c9094193dcb688ae4101f3c8cb1e8fbf5214fac5
cjb5799/DSC510Fall2020
/Rickord_DSC510/WeatherCheck.py
6,285
3.53125
4
#DSC 510 #Week 12 #Programming Assignment Week 12 #Author Jake Rickord #11/17/2020 import warnings import string warnings.filterwarnings("ignore") import requests from requests.exceptions import HTTPError ##city object to hold each data point, enter in default values just in case class CityWeather: ...
d325d75e1876bedaa77f79ab4ef8506b4a261336
cjb5799/DSC510Fall2020
/Sutow_DSC510/Assignment 2.1.py
515
4.09375
4
#DSC 510# #Week 2# #Programming Assignment Week 2# #Author: Brett Sutow# #9/07/2020# print('Hello!') name = input('What is your company name?/n') #Please input your company name below# print(name) #Please input how much feet is needed# prompt = 'What is the length of feet fiber optic cable to be installed?/n' feet_need...
f9f83fe57209ab1dda75f917a8fe961cde9efff6
cjb5799/DSC510Fall2020
/BREHM_DSC510/Brehm_Week8.py
2,773
4.40625
4
# DSC 510 # Week 8 # Programming Assignment Week8 - Prompt the user to input a list of temperatures. Determine the max, min, and count. # Author: David Brehm # 10/19/2020 # Change Log: # No changes. import re from collections import OrderedDict def add_word(word, wordDict): """ Add_word checks if an individ...
e2a9e87a10117edcf3488bc6ecdddb7dd112388c
cjb5799/DSC510Fall2020
/FENCL_DSC510/Assignment 4.1.py
1,071
4.21875
4
# DSC 510 # Week 4 # Programming Assignment Week 4 # Author Riley Fencl # 09/13/2020 print("Welcome User! Please, input the requested information and your receipt will be generated! Thank you!") # User Input cname = input("What is the name of your company?\n") cable = int(input("How many feet of fiber optic cable is...
870ee38c6e1a212ae2197d4536ac5245a497bbe8
cjb5799/DSC510Fall2020
/Sutow_DSC510/Assignment10.1.py
3,232
4.1875
4
#DSC 510# #Week 10# #Programming Assignment Week 10# #Author: Brett Sutow# #11/02/2020# #If changes made please fill-out log# #Change:# #Changes Made:# #Date of Change:# #Author:# #Change Approved By:# #Date Moved to Production:# #Below does an introduction to the person and gets them ready for the joke generator# pri...
9d696f3e873b3171d1a8cc5c290e06e8602182cf
cjb5799/DSC510Fall2020
/CHAVALI_DSC510/Assignment_5.1.py
2,685
4.4375
4
# DSC510 # Week 5 Assignment - Assignment_5.1.py # Program to perform Arithmetic operations # Author Sowmya Chavali # 10/03/20 import getpass # Function to perform Arithematic operations like +,-,*,/ def performCalculation(opr): try: value1 = float(input("Enter first number: ")) # Validating the input...
702b13a792d6833ad664de1b00eec061999719ea
cjb5799/DSC510Fall2020
/CHAVALI_DSC510/Assignment_4.1.py
2,196
4.1875
4
# DSC510 # Week 4 Assignment - Assignment_4.1.py # Program to calculate the cost of fiber installation based on the user input # Author Sowmya Chavali # 09/25/20 import getpass # gets the username to display it in the welcome message UserName = getpass. getuser() print("------ Welcome to FIBER OPTICS "+UserName+...
62f558cd9bde025b5878170eb790898580d54ebc
cjb5799/DSC510Fall2020
/RATTANAVILAY_DSC510/rattanavilay_assignment_10.1.py
3,116
4.53125
5
# File: rattanavilay_assignment_10.1.py # Assignment: 10.1 # Course: DSC 510 # Week 10 # Programming Assignment Week 10 # Author: Thip Rattanavilay # DATE: 11/8/2020 """ 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 ope...
99c4a39af650c28fca48c6a21822b6fcf1e2308f
cjb5799/DSC510Fall2020
/Sutow_DSC510/Assignment 3.1.py
887
4.4375
4
#DSC 510# #Week 3# #Programming Assignment Week 3# #Author: Brett Sutow# #9/14/2020# print('Hello!') name = input('What is your company name?/n') #Please input your company name below# print(name) #Please input how much feet is needed# prompt = 'What is the length of feet fiber optic cable to be installed?/n' feet_need...
6ef4c115e4125f07521a755b075a67250efac28e
cjb5799/DSC510Fall2020
/FENCL_DSC510/Assignment 8.1.py
1,199
3.65625
4
# DSC 510 # Week 8 # Programming Assignment Week 8 # Author Riley Fencl # 10/25/2020 def main(): gba_file = open("Gettysburg.txt", "r") Process_line() gba_file.close() def Process_line(): word_dictionary = dict() text_file = 'Gettysburg.txt' import string with open(text_...
165d0c6456bfa883bcafca4cadf3b67211eb6c2d
cjb5799/DSC510Fall2020
/SUMBARAJU_DSC510/9_1_Programming_assignment.py
3,635
3.625
4
# DSC 510 # Week 8 # Programming Assignment Week 9 - 9_1_Programming_assignment.py # Author Aditya Sumbaraju # 10/30/2020 # Change Control Log: reused the code from assignment 8 and replaced pretty_print with process_file # Change#:1 # Change(s) Made: NA # Date of Change: 10/30/2020 # Author: Aditya Sumbaraj...
4d1dcff1512004bef93f138d3f6af8a9dd13986d
mstill3/OverTheWire
/krypton/ceasar.py
1,328
3.984375
4
#!/usr/bin/env python3 import argparse def letters_to_nums(letters): nums = [] for l in letters: nums.append(ord(l) - 97) return nums def nums_to_letters(nums): letters = [] for n in nums: if(n != -51): n = n % 26 letters.append(chr(n + 97)) return letter...