blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
6f41c333949df2fbf7eaadbdfa5a0c6b4850c24a
adwanAK/adwan_python_core
/week_03/labs/07_lists/Exercise_01.py
200
3.65625
4
''' Take in 10 numbers from the user. Place the numbers in a list. Using the loop of your choice, calculate the sum of all of the numbers in the list as well as the average. Print the results. '''
7dcd7ba4e196a0327b3e7bd3ff81fe70894040e1
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex11/ex11.5.py
1,588
4.375
4
#!/usr/bin/env python3 """ Exercise 11.5. Two words are “rotate pairs” if you can rotate one of them and get the other (see rotate_word in Exercise 8.5). Write a program that reads a wordlist and finds all the rotate pairs. Solution: http://thinkpython2.com/code/rotate_pairs.py """ def make_dict(file_input): dic...
429322c9edbce1c63e2b77deeef3bb5609d0c824
adwanAK/adwan_python_core
/week_03/labs/11_inheritance/11_01_subclasses.py
3,132
4.125
4
''' Build on 10_03_freeform_classes from the section on Classes, Objects and Methods. Create subclasses of two of the existing classes. Create a subclass of one of those so that the hierarchy is at least three levels. Build these classes out like we did in 10_03_freeform_classes. If you cannot think of a way to build...
8896dcbca3e399e6a80fed0f05b5637071b27e47
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex6/ex6.4.py
592
4.5
4
#!/usr/bin/env python3 """ Exercise 6.4. A number, a, is a power of b if it is divisible by b and a/b is a power of b. Write a function called is_power that takes parameters a and b and returns True if a is a power of b. Note: you will have to think about the base case. """ def is_power(a, b): """Checks if a is p...
6b72e92c07f8aaeec507c61417236348618bf5a7
adwanAK/adwan_python_core
/think_python_solutions/chapter-11/exercise-11.6.py
931
3.96875
4
#!/usr/bin/env python # encoding: utf-8 """ exercise-11.6.py Created by Terry Bates on 2013-01-08. Copyright (c) 2013 http://the-awesome-python-blog.posterous.com. All rights reserved. """ import sys import os import time known = {0:0, 1:1} def fibonacci_slow(n): if n == 0: return 0 elif n == 1: ...
ef6595b6ff142965ddee35ef3a470c13ed92952f
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex10/ex10.11.py
995
4.0625
4
#!/usr/bin/env python3 """ Exercise 10.11. Two words are a “reverse pair” if each is the reverse of the other. Write a program that finds all the reverse pairs in the word list. Solution: http://thinkpython2.com/code/ """ import bisect def word_list(file): fin = open(file) li = [] for line in fin: ...
7238de0437f5303653ac9c7c4e1b31f73c6d2419
adwanAK/adwan_python_core
/think_python_solutions/chapter-16/exercise-16.6.py
2,653
4.3125
4
#!/usr/bin/env python # encoding: utf-8 """ exercise-16.6.py Created by Terry Bates on 2014-07-05. Copyright (c) 2014 http://the-awesome-python-blog.posterous.com. All rights reserved. """ import sys import os from copy import copy class Time(object): """Represents the time of day. attributes: hour, mi...
fd9029451352828027391aaa5ac087358ed9fe0c
adwanAK/adwan_python_core
/flip.py
380
4
4
_list = [1, 6, 2, 3, 4, 5] temp = "" print(f"Original list {_list}") for i in range(0, len(_list)//2): temp = _list[i] print(temp) print(f"Before swap: i:{i} _list[i]:{_list[i]}") _list[i]= _list[len(_list) - i -1] _list[len(_list)-i - 1] = temp print(f"After swap: _list:[i]={_list[i]} _list[le...
93e9dc55bb7c107bd3f78bf4f2fa48d01f4b3611
adwanAK/adwan_python_core
/week_04/labs/06_generators/Exercise_01.py
799
4.3125
4
''' Create a Generator that loops over the given list and prints out only the items that are divisible by 1111. ''' # remember: range() also creates a generator object (try printing it!) nums = range(1, 1000000) gen = (n for n in nums if n%1111 == 0) print("Below print of items that are divisible by 1111 only") fo...
c56385e35207c09fdf91b3cb58e37cd1d44f67a2
adwanAK/adwan_python_core
/week_03/labs/06_strings/Exercise_05.py
536
4.40625
4
''' Write a script that takes a user inputed string and prints it out in the following three formats. - All letters capitalized. - All letters lower case. - All vowels lower case and all consonants upper case. ''' user_iput = input("type a word") print(user_iput.upper()) print(user_iput.lower()) vowels =...
77a04efb7e14d630ec7c72919a42a03df80b90e9
adwanAK/adwan_python_core
/week_02/mini_projects/guess.py
648
4.40625
4
''' -------------------------------------------------------- GUESS THE RANDOM NUMBER -------------------------------------------------------- Build a Guess-the-number game that asks a player for an input until they pick the correct (randomly generated) number between 1 and 100. Tip: Use python's 'rand...
aa67413cacdeb6f5b326337c88f7c125750f31ae
adwanAK/adwan_python_core
/think_python_solutions/chapter-18/PokerHand.py
2,288
3.734375
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 * class PokerHand(Hand): def suit_hist(self): """Builds a histogram of the suits that appear in the hand....
49da3d7c354aed0018686d0157e321920540d204
adwanAK/adwan_python_core
/think_python_solutions/chapter-09/exercise-9.7.py
2,083
4.0625
4
#!/usr/bin/env python # encoding: utf-8 """ exercise-9.7.py Write program with a function that will find a word with three consecutive letters. Created by Terry Bates on 2012-09-16. Copyright (c) 2012 http://the-awesome-python-blog.posterous.com. All rights reserved. Son of a gun: bookkeeper bookkeepers bookkeepin...
2e597dc70750b703a3ef4b3d4a39f7a2e31cc0bb
adwanAK/adwan_python_core
/week_03/labs/06_strings/Exercise_02.py
229
4.125
4
''' Complete Exercise 8.3 (p.95) from the textbook. ''' # noon is palindram so it should return True print("noon"[::] == "noon"[::-1]) # hello is not palindram so it should return False print("hello"[::] == "hello"[::-1])
74b262d98d91ae8d850b634c0879766c792878fe
adwanAK/adwan_python_core
/think_python_solutions/chapter-05/exercise-5.14.2.py
869
4.15625
4
#!/usr/bin/env python # encoding: utf-8 """ exercise-5.14.2.py Created by Terry Bates on 2012-08-01. Copyright (c) 2012 http://the-awesome-python-blog.posterous.com. All rights reserved.""" import sys import os def is_triangle(a,b,c): if (a + b > c) and (a + c > b) and (b + c > a): print "Yes" else: ...
c8f21cd42ccdcaa0bda562907e9862980d1f403e
adwanAK/adwan_python_core
/think_python_solutions/chapter-05/exercise-5.14.1.py
1,279
4.5
4
#!/usr/bin/env python # encoding: utf-8 """ exercise-5.14.1.py Created by Terry Bates on 2012-08-01. Copyright (c) 2012 http://the-awesome-python-blog.posterous.com. All rights reserved.""" import sys import os import math def check_fermat(a, b, c, n): '''This function does the actual checking of Fermat's last ...
d611f755d97fb5d19e6fb7ce5db7832b28f43950
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex5/ex5.5.py
912
4.40625
4
#!/usr/bin/env python3 """ The following exercise use the turtle module, described in Chapter 4. Exercise 5.5. Read the following function and see if you can figure out what it does. Then run it (see the examples in Chapter 4). def draw(t, length, n): if n == 0: return angle = 50 ...
8c1f05015c585ae6409961a25e97c1ff50304fe0
adwanAK/adwan_python_core
/week_02/labs/03_variables_statements_expressions/Exercise_04.py
252
4.375
4
# ''' # Write the necessary code that prints out the area and circumference # of a circle with a radius of 3.14 # ''' import math r = 3.14 area = math.pi * r * r print("area is: ") print(area) print("") print("circumference is: ") print(2*math.pi*r)
aa83c86f0632acaa73f90f3c4559beafb9fb5888
adwanAK/adwan_python_core
/solutions/labs_w3_w4/06_Strings_04.py
327
4.15625
4
''' Write a script that finds the first vowel in a a user inputted string. ''' vowels = list("aeiou") user_string = input("Enter text for sophisticated analysis: ") for c in user_string: # look at each letter (incl. whitespace) of the string if c in vowels: # check whether it's a vowel print(c) ...
52314aa54dd3d6961cf8af8761e96a7b0c9ebc48
adwanAK/adwan_python_core
/solutions/labs_w3_w4/06_generators_02.py
550
3.890625
4
''' Adapt your Generator expression from the previous Exercise (remove the print() statement), then run a floor division by 1111 on it. What numbers do you get? ''' # remember: range() also creates a generator object (try printing it!) nums = range(1, 1000000) # creating the generator expression div_gen = (n for n i...
48a55a09398893a301cc9ceac08946eed8afdb3a
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex10/ex10.10.py
1,293
4.25
4
#!/usr/bin/env python3 """ Exercise 10.10. To check whether a word is in the word list, you could use the in operator, but it would be slow because it searches through the words in order. Because the words are in alphabetical order, we can speed things up with a bisection search (also known as binary search), which is...
218d06e252b221c88b0d1322149142d0fd390d25
adwanAK/adwan_python_core
/week_02/labs/04_conditionals_loops/Exercise_03.py
158
4.25
4
''' Using a "for-loop", print out all even numbers from 1-100. ''' for x in range(1, 100): if((x % 2) == 0): print(x) else: continue
a624277096f0a7dbf3cbe5668b0f4076743ad202
adwanAK/adwan_python_core
/think_python_solutions/Think-Python-2e/ex10/ex10.6.py
424
4.25
4
#!/usr/bin/env python3 """ Exercise 10.6. Two words are anagrams if you can rearrange the letters from one to spell the other. Write a function called is_anagram that takes two strings and returns True if they are anagrams. """ def is_anagram(text1, text2): return sorted(text1) == sorted(text2) print(is_anagram(...
59fcf5893e503b28d878d8506585238871c6186f
adwanAK/adwan_python_core
/week_03/labs/12_files/12_01_long_words.py
508
3.765625
4
''' Write a program that reads in the file words.txt and prints only the words with more than 20 characters (not counting whitespace). Source: http://greenteapress.com/thinkpython2/html/thinkpython2010.html ''' with open('words.txt', 'r') as f: data = f.read() # create a list of word by splitting by EOL End...
1f6c41508212f2185819d1b2a47ddd704228efda
pigswillfly/RealTime
/Ex2/HelloWorld.py
463
3.5
4
from threading import Thread from threading import Lock i = 0 mtx = Lock() def adder(): global i for x in range(0,1000000): mtx.acquire() i+=1 mtx.release() def subber(): global i for x in range(0,1000000): mtx.acquire() i-=1 mtx.release() def main(): adder_thr = Thread(target = adder) subber_...
723924edc823249d1c1ebec9984dcc77231660ca
aaolcay/lib_app
/midterm_level_library_app.py
2,405
4.3125
4
#!/usr/bin/python # /* # * Copyright (C) 2020 Abdullah Azzam Olcay # * University of Southampton # * Lınkedin: https://tr.linkedin.com/in/abdullah-azzam-olcay-613453183 # * # * Please do not remove this header. # * */ import os import time book_list = list() menu = """ [1] Add books [2] Remove a book or take ...
52c86ad38a813a772f1b81959945685008e55e9c
francisduvivier/AdventOfCodePython
/2020-done/day6.py
1,172
3.5625
4
import re def yesLetters(group): persons = group.split('\n') uniqueLetters = '' for person in persons: for letter in person: if letter not in uniqueLetters: uniqueLetters += letter return len(uniqueLetters) def part1(): # input: str = open('day6-tinput.txt', ...
76ed47bd541c1ea5bb84b85e0c7b4facc292845d
karthikeyan-17/Simple-Python-program
/Palindrome of number.py
280
4.1875
4
''' Find the reverse of given numbers''' rev = 0 n=int(input("Enter the number:")) num=n while (n > 0): dig= n % 10 rev = rev * 10 + dig n = n // 10 if (num == rev): print("The Number is palindrome") else: print("The Number is not palindrome")
2076a855e19f1aad698fc9619a8af0371bab5332
keshav-03/ML_Algorithms
/Scrambled Tickets.py
502
3.5625
4
trip = [['Chennai', 'Bangalore'], ['Bombay','Delhi'], ['Goa', 'Chennai'], ['Delhi','Goa'], ['Bangalore', 'Beijing']] my_trip =[] for sub in trip: for item in sub: if item not in my_trip: my_trip.append(item) else: my_trip.remove(item) start = my_trip[0] e...
4f02e09eac8d38661b6c7c424f2223182713f4b0
mingmingclaire/CS_Foothill_Python
/assignment05.py
8,909
4.125
4
""" CS3A, Assignment05, Functions and lists Mingming Gu This program is aimed to use a few functions to extract some statistical information from a list of integers or manipulate the list in some fashion. Included Extra Credit 1 """ def get_integers(): """ This function asks user to type a list of integers se...
0f82f691895406a720f40d4de734623a0c7b5f93
iuliailies/Connect-4
/Console/GUI_Basics.py
5,396
4.25
4
from tkinter import * ''' basics ''' # root = Tk() # tkinter class we have just imported # theLabel = Label(root, text='Hihi') # theLabel.pack() # to display # root.mainloop() # to keep it open ''' organizing and layout ''' # root = Tk() # topFrame = Frame(root) # invisible container # topFrame.pack() # don t forge...
d7afaca7c72448f0dcb2a92f9a81be262950c03d
xingyuzzz/practice
/non-attacking.py
1,438
3.796875
4
board =[[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]] num = 0 #numbers of solutions def eight_...
7248293eb476f15aa0a57e20ed749a136b359ba8
patrenaud/Python
/CoursPython/GUIButton.py
554
4.03125
4
# Lazy Buttons # Demonstrate creating buttons from tkinter import * # create new window root = Tk() root.title("Lazy Buttons") root.geometry("400x500") # create frame in the window to hold other widgets app = Frame(root) app.grid() # create a button in the frame in the window btn1 = Button(app, text = "I do Nothing...
43346281cd73483ec1eac8d534611d68acd2747f
patrenaud/Python
/CoursPython/ListSetDic.py
413
4.09375
4
# Demonstrates lists, sets and dictionnaries # List can me modified anyhow List = [0, 1, 2, 3, 3, 3] # Set cannot be modified and CANNOT have 2 of the same Set = {0, 1, 2, 3, 3, 3} # May have a key and a value Dictionnary = {"un" : 0,"deux" : 1,"trois" : 2,"quatre" : 3} value = Dictionnary["trois"] print(value) v...
5c3dc5172a8c3a6a1f46a145f07cf4ae427efbda
patrenaud/Python
/CoursPython/TicTacToe.py
4,949
4.25
4
# Tic-Tac-Toe # Constants X = "X" O = "O" EMPTY = " " TIE = "TIE" NUM_SQUARE = 9 def display_instruct(): """Display game instructions.""" print( """ Welcome to the greatest intellectual challenge of all time: Tic-Tac-Toe. This will be a showdown between your human brain and my silicon processor....
f4bd81e0233348030682ddf78c9ae91bbad74b4d
patrenaud/Python
/CoursPython/Greeter.py
148
3.796875
4
#Greeter #Demonstrate the use of variables name = input("Hi. What is your name? ") print("Hi,", name) input("\n\nPress the enter key to exit.")
6106a76b040384cf09b3a58a47f7274405c8fa8f
GeorgeDonchev/Homework-Assignments
/Followers.py
1,197
3.609375
4
commands = input() users={} while not commands == "Log out": args = commands.split(": ") command = args[0] username= args[1] if command == "New follower": if username in users: commands = input() continue users[username]= {} users[username]['l'] = 0 ...
90d0ff7ba03cf37362a15a6ec033d279d9564e03
GeorgeDonchev/Homework-Assignments
/Username.py
1,260
4.21875
4
string = input() commands = input() while commands != "Sign up": tokens = commands.split() command = tokens[0] if command == "Case": state = tokens[1] if state == "lower": string = string.lower() else: string = string.upper() print(string) elif c...
471fa2fae082881846e0d431fa31e87f1aa727ba
GeorgeDonchev/Homework-Assignments
/5.Truck Tour.py
523
3.5
4
from collections import deque petrol_pumps=int(input()) index = 0 pumps = deque() for _ in range(petrol_pumps): pumps.append([int(x) for x in input().split()]) is_completed = False while index < len(pumps): tank = 0 for pump in pumps: (distance, fuel) = pump tank += distance - f...
099094353d3b6642aa4425e79e0b28133a9e239f
GeorgeDonchev/Homework-Assignments
/04. Number Classification.py
447
3.96875
4
numbers = [int(x) for x in input().split(", ")] positive_numbers = [str(p) for p in numbers if p >=0] print(f"Positive:", ', '.join(positive_numbers)) negative_numbers = [str(p) for p in numbers if p <0] print(f"Negative:", ', '.join(negative_numbers)) even_numbers = [str(p) for p in numbers if p % 2==0] print(f"...
fc73f812a0b6946bdc0f0ce38f1dc30c4a4c926e
GeorgeDonchev/Homework-Assignments
/take_skip_1.py
432
3.671875
4
class take_skip: def __init__(self, step, count): self.step = step self.count = count self.var = -step def __iter__(self): return self def __next__(self): self.var += self.step if self.count > 0: self.count-=1 return self...
e3fffcb457dbed30db29e62929188905cceaf65b
GeorgeDonchev/Homework-Assignments
/04. Negative vs Positive.py
504
3.8125
4
numbers = [i for i in map(int, input().split())] negative_numbers = filter(lambda x: x < 0, numbers) positive_numbers = filter(lambda y: y >= 0, numbers) sum_of_negative_numbers = sum(negative_numbers) sum_of_positive_numbers = sum(positive_numbers) print(sum_of_negative_numbers) print(sum_of_positive_numbers) i...
2a6e9a7a38d24c4f2c7861390e4d9641ab847ed6
GeorgeDonchev/Homework-Assignments
/The Isle of Man TT Race.py
888
3.578125
4
import re is_valid = False encrypted_message="" racer_name='' pattern = r"^(#|\$|%|&|\*)([A-Za-z]+)\1=(\d+)!!" while True: text = input() get_geohash=text.split('!!', 1) if len(get_geohash) <= 1: print ('Nothing found!') continue geohash_code = get_geohash[1] matches = re.findall(pat...
6fde149ffd1528d1f574380e37fd2ab097206631
GeorgeDonchev/Homework-Assignments
/Emoji Detector.py
621
3.78125
4
import re text = input() threshold_value=1 threshold_pattern = r"\d" threshold_matches = re.findall(threshold_pattern, text) for cool_threshold in threshold_matches: threshold_value*=int(cool_threshold) print(f"Cool threshold: {threshold_value}") emoji_pattern = r"(::|\*\*)([A-Z][a-z]{2,})(\1)" emoji_matches=re.f...
ef06ac790e62ee8b8f640d2a1ce3cc1d41626980
GeorgeDonchev/Homework-Assignments
/Warrior's Quest.py
961
4.0625
4
text = input() commands = input() while not commands == "For Azeroth": tokens = commands.split() command = tokens[0] if command =="GladiatorStance": text=text.upper() print(text) elif command == "DefensiveStance": text = text.lower () print(text) elif command == "Di...
2ad376640b2904e8280dd783d76f08c816b9e8c9
GeorgeDonchev/Homework-Assignments
/02. 2x2 Squares in Matrix.py
438
3.625
4
def read_matrix (): rows, cols = tuple(map(int, input().split())) matrix = [[str(c) for c in input().split()]for r in range(rows)] return matrix matrix = read_matrix() matrix_found = 0 for i in range(len(matrix)-1): for j in range(len(matrix[i])-1): if matrix[i][j]==matrix[i][j+1] ...
4cc385febba3ad4e78d18b6cebe001cc1e4bb7a4
GeorgeDonchev/Homework-Assignments
/03. Multiplication Function.py
192
3.671875
4
def multiply(*args): res = 1 for digit in args: res*=digit return res print(multiply(1, 4, 5)) print(multiply(4, 5, 6, 1, 3)) print(multiply(2, 0, 1000, 5000))
b5329c7ac80167b45337d5aa9f9a46001b2555ad
GeorgeDonchev/Homework-Assignments
/Hero Recruitment.py
1,130
4.03125
4
commands = input() spellbook ={} while not commands == "End": tokens = commands.split() command = tokens[0] hero_name = tokens[1] if command == "Enroll": if hero_name not in spellbook: spellbook[hero_name] = [] else: print(f"{hero_name} is already enrolled.") ...
afd0bc85167f2d0bf2a12566a6bf25825bc05bd2
noAudio/beginner_stuff
/exercises/counter.py
128
3.75
4
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sum_of_list = 0 for number in my_list: sum_of_list += number print(sum_of_list)
f2b94d37bc5f87681b4ee1d7b5c65d924463b898
Taylor365/Python
/DungeonHeroes/Functions/combat.py
1,677
3.765625
4
import time from Functions import moveRoll def fight(player, enemy): print() print('Enemy is: ') enemy.info() time.sleep(2) print() print() # We roll to see who goes first first = moveRoll.rollDice(player, enemy) if first == player: second = enemy else: second =...
db92ebc138f109f5f402bcbb6b1ad31fa210111f
Artemii181/python
/lesson_3.py
5,053
3.90625
4
#1. Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление. # Числа запрашивать у пользователя, предусмотреть обработку ситуации деления на ноль. def my_funk(): try: number_1 = float(input('Введите значение 1 - ')) number_2 = float(input('Введите значение ...
7f260f3582ac18c08a2f93ed6907e17377fe7e6b
CubeFlix/recursiveTest
/simplerecurseloopSecondFormula.py
808
4.125
4
# Python script for a simple recursive thingy # # Pick a number, n # If n is even, set n to n / 2 # Else, set n to 3n+1 # Add 1 to count # Continue until n is 1 # limLow = input("Start testing from: ") limLow = int(limLow) limHi = input("End testing at: ") limHi = int(limHi) bestN = 0 highestCount = 0 for testingNum...
2ee5598b6e54ff6bcdbd7355320a74b4d35260a7
samirad123/lab_lec_2
/task 4.py
159
3.875
4
n = int(input("Enter an integer: ")) for i in range(2,n): if n % i == 0: print("False") break else: print("True") break
2a45afd68823d7a213cc463eeb896c8012e0e442
anupama14609/covid-data
/df_data.py
431
3.5
4
import pandas as pd def df_data(): df = pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv') print(df) column_name=df.columns print(column_name) country_data = df['Country/Region'...
3ca2e12607f8b1d0fd39545c7bde835e466ee676
anupama14609/covid-data
/sort_values_descending.py
525
3.578125
4
import pandas as pd def sort_by_values(dfglobal): df = dfglobal[list(dfglobal.columns[1:2]) + list([dfglobal.columns[-1]])] df.columns = ['Country/Region','values'] df_unsorted = df print(df_unsorted) df_sort_descending = df.sort_values(by='values', ascending=False) print(df_sort_descending...
2d0c8fcf41494f6f62ebda4f80f2ac30a424b2a7
Vera0626/DataEngine
/Project3/test3.py
2,695
3.640625
4
""" 赛题3: """ # 使用KMeans进行聚类 from sklearn.cluster import KMeans from sklearn import preprocessing import pandas as pd import numpy as np # 数据加载 data = pd.read_csv('./car_price.csv',encoding = 'gbk') train_x = data[['symboling','CarName','fueltype','aspiration','doornumber','carbody','drivewheel','enginelocat...
e611f3ab3f87a21999eabaad044f854ab14dd5c2
sprinkle17/Baseball-Sort
/Baseball Sort/FinalProgram.py
5,226
3.625
4
#Dalton Sprinkle #CS 222 02 #Final Project #Due: 5/7/2018 #Turned in: 5/7/2018 #Description: program will take a file and read contents into shell and selection sort, then will diving them into seperate values and correct values to readible format A user search is included to allow the user to search for a date. A...
9f4bded32568e2b7b48a7265f216f4bd1a4bf9b1
afletche/football_game
/Player.py
4,925
3.578125
4
""" Player.py @author Andrew Fletcher Email: afletcher168@yahoo.com @since 08/16/2019 The object class for a player that will be on the roster. """ class Player(object): """ Constructor for the player class @param position the position that the player plays @param the speed of t...
5118d648c6ac1083328b6f7da566033c263fa255
ws0h3ll/ocr-project
/simpleocrscan.py
804
3.671875
4
def simplescanmulti(): doimg = True cnt = 1 while doimg == True: pathtoimg = raw_input("Path to image to OCR : ") read = image_to_string(Image.open(pathtoimg), lang='eng') print("Text for image number " + str(cnt) + " is : " + read) print("------------------------------------...
39b4bfea3e7f82ea3e84d53bb331475ff79771ef
dimivas/tictactoe
/players/tictactoe_human.py
2,015
4.03125
4
""" The implementation of the Tic-Tac-Toe human interface. This component receives the next move as an input from a human player. """ from __future__ import print_function import sys from .abstract_tictactoe_player import AbstractTicTacToePlayer class TicTacToeHuman(AbstractTicTacToePlayer): """ The implemen...
d715fa5f82ada0a611fe073826a82818b010027c
tianqwang/LeetCode
/Easy/2.add-two-numbers.py
656
3.640625
4
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: add = 0 output = Li...
723b3b22d61f57da7d7f8ea7971015729aba6c70
OCCOHOCOREX/HuangXinren-Portfolio
/Weekly Tasks/Week4/HuangXinren-Week4-Task1.py
400
3.96875
4
# list = [10, 43, 27, 8, 33] # def multi(nums): # return numpy.prod(nums) # print(multi(list)) # Key answer from other student # def multiplylist(inputlist): # output = 1 # correctoutput = Flase # for element in inputlist: # if type(element) ==int: # correctoutput = True # ...
b199a2dc2841a5b733fdadd8824c9a989c1aa23e
OCCOHOCOREX/HuangXinren-Portfolio
/Weekly Tasks/Week5/HuangXinren-Week5-Task1.py
555
3.984375
4
my_dict = {"a":"alfa", "b":"bravo", "c":"charlie", "d":"delta", "e":"echo", "f":"foxtrot", "g":"golf", "h":"hotel", "i":"india", "j":"juliett", "k":"kilo", "l":"lima", "m":"mike", "n":"november", "o":"oscar", "p":"papa", "q":"quebec", "r":"romeo", "s":"sierra", "t":"tango", "u":"uniform", "v":"victor", "w":"whiskey", "...
209d020b3fdf03ef8319e99e98d719c2cf1bee9b
ystromm/videostore
/python/test.py
1,051
3.609375
4
import unittest from movie import Movie from rental import Rental from customer import Customer from price import * class Test(unittest.TestCase): def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) def test_customer(self): customer = Customer("Jamie") ...
233ee00d9e19344e982499a6d241b2286505b6cb
hrrs/wikiscraper
/plot_network.py
814
3.53125
4
from turtle import * from types import * myTree = ["A",["B",["C",["D","E"],"F"],"G","H"]]; s = 50; startpos = (0,120) def cntstrs(list): return len([item for item in list if type(item) is type('')]) def drawtree(tree, pos, head=0): c = cntstrs(tree) while len(tree): goto(pos) item = tree.p...
83ddb9a9384118be878eb6d7a0a11b89c0934826
ramyasutraye/Python-13
/Beginner level/PrintMiddleElement*.py
160
3.828125
4
myString=raw_input("") length=len(myString) middle=length/2 for i in range(0,length): if(i==middle): print("*") else: print myString[i]
7bed03224544e2d15eafa2b2303b1da818d5389c
ramyasutraye/Python-13
/PlayerLevel/RomanToInteger.py
273
3.5625
4
r=raw_input() if(r=='I'): print 1 if(r=='II'): print 2 if(r=='III'): print 3 if(r=='IV'): print 4 if(r=='V'): print 5 if(r=='VI'): print 6 if(r=='VII'): print 7 if(r=='VIII'): print 8 if(r=='IX'): print 9 if(r=='X'): print 10
f15d1d78174b329afbe384db6c6c59b05b303c2f
ramyasutraye/Python-13
/Beginner level/swapNoBitwise.py
160
3.734375
4
number1=int(input()) number2=int(input()) print(number1,number2) number1=number1^number2 number2=number1^number2 number1=number1^number2 print(number1,number2)
c4f59d89e6718121a3ee71a015dee52434d11116
ramyasutraye/Python-13
/Beginner level/ArmstrongNoInterval.py
292
3.84375
4
lowerNumber =int(input('')) upperNumber =int(input('')) for number in range(lowerNumber,upperNumber+1): order = len(str(number)) sum = 0 temp = number while temp > 0: digit = temp%10 sum += digit ** order temp //= 10 if number == sum: print(number)
c5094d412da86a6ea8d2cce5eb70a14a7518af97
ramyasutraye/Python-13
/Beginner level/NumberNumeric.py
109
3.953125
4
input = input("") print ("Enter number",input) if type(input) == int: print("Yes") else: print("No")
a69021bc8b7c60732cabb5c1ed843bd320ab8543
qinlincmu/ReachModelPlex
/utility/math_tool.py
440
3.75
4
#!/usr/bin/env python #author: qinlin@andrew.cmu.edu import numpy as np import math def positive(x): return max(x, 0) def range_by_step(start, end, step): range = [] if end >= start: range = [item for item in np.arange(start, end, step)] else: range = [item for item in np.arange(start, ...
ff1ce3bc2d1bc63a62ef405a6ddba148673ea826
Lisolo/ACM
/odd_number.py
192
4.25
4
# coding=utf-8 """ Give you a string a, then print out the character of odd position. For example a= '12345', then print out 135. """ a = '12345' b = a[::-2] print int(b[::-1]) print a[::2]
3721a37364ca9a1fb19616d753f333217b42c6e5
Lisolo/ACM
/descending_sort.py
170
3.71875
4
# coding=utf-8 """ 给你一个list L, 如 L=[2,8,3,50], 对L进行降序排序并输出, 如样例L的结果为[50,8,3,2] """ L = [2, 8, 3, 50] L.sort() print(L[::-1])
98cee813d5ec2f8b818cadd1ac0132924565fdf5
Lisolo/ACM
/shape_of_triangle.py
838
3.9375
4
# coding=utf-8 """ 给以一个三角形的三边长a,b和c(边长是浮点数),请你判断三角形的形状。 若是锐角三角形,输出R, 若是直角三角形,输出Z, 若是钝角三角形,输出D, 若三边长不能构成三角形,输出W. """ a = 12 b = 13 c = 15 d = [] def is_triangle(side1, side2, side3): if side1 + side2 > side3 and side1 + side3 > side2 and side2 + side3 > side1: return 1 else: return 0 def shap...
a7603498454f1fe88742bc61079c52760a24b25d
swapUniba/MyrrorBotRepo
/demo/foodWebApp/web_expl.py
37,475
3.8125
4
from flask import Flask, request from flask_restful import Resource, Api import re import csv import sys import json import random import numpy as np import pandas as pd from random import choice app = Flask(__name__) api = Api(app) app.debug = True class Explain(Resource): def get(self): #--- ...
2e878b0d721856418b77ad2fa7c39310eb3f42f0
crg8055/AI-Lab-5th-Sem
/5. Vacuum Cleaner/Vacuum Cleaner.py
920
3.703125
4
def print_floor(floor, i, j): for l in range(len(floor)): for m in range(len(floor[l])): if i == l and j == m: print('_ ', end="") else: print(str(floor[l][m]) + " ", end="") print() print() def clean(floor): for i in range(len(fl...
bd5f70e3e25c1bf1f04166f54ecfdb1e735c8f9d
WooWan/Koala-Algorithm
/study/week1/BOJ_20207_이도희.py
853
3.59375
4
#!/usr/bin/env python # coding: utf-8 # In[9]: trial = int(input()) #인덱스는 0부터시작, but 우리는 입력을 1부터 받아 -> 365만들기 위해 배열 1칸더필요 schedule = [0]*367 scheduleend = 0 for i in range(trial): start, end = map(int,input().split(" ")) scheduleend = max(scheduleend, end) for i in range(start,end+1): schedule[i]...
68f5a53afa112c3fd9c2df860abfb3589be7782a
WooWan/Koala-Algorithm
/study/week1/BOJ_1931_이도희.py
753
3.53125
4
#!/usr/bin/env python # coding: utf-8 # In[38]: trial = int(input()) meeting = list() for i in range(trial): start, end = map(int,input().split(" ")) meeting.append([start,end]) meeting.sort() # 시작순 시간 정렬 temp = sorted(meeting, key = lambda meeting:meeting[1]) # 이후 끝나는 시간대로 정렬 #>> 결론적으로 끝나는거 기준 -> 시작 기준 으로...
6f191c65306a93f78ffc916f3c1dc7059e214a29
vinuh42/Python-Code
/vinuh42/fibonacci.py
620
4.15625
4
#Vinu Harihar #Fibonacci Sequence user_choice_lowerbound = input("Enter the lowest term you want, please") user_choice_higherbound = input("Enter the highest term you want") a = int(user_choice_lowerbound) b = int(user_choice_higherbound) number1 = 0 number2 = 1 for i in range(a-3): number = number1 number1 ...
a53fb3288649ffccad1debabaf136247a225f001
vinuh42/Python-Code
/vinuh42/table.py
246
4.0625
4
# Vinu Harihar # Multiples Program for i in range (1, 11): print (i, end = " ") print ("\n") print ("______________________________") print ("\n") for i in range (1, 21): for j in range(1, 11): print (i*j, end = " ") print ("\n")
25ad60be2b7d77726528678b9b0d92987772afdd
vladimirjankov/leetcode
/maximum_subarray/main.py
2,316
4.15625
4
""" @author: Vladimir Jankov @email: vladimir.jankov@outlook.com @file: main.py @description: solution to maximum subarray """ from typing import List from common.print_functions import print_result import math class Solution: """ Given an integer array nums, find the contiguous subarray (containing at least...
23336ccb78b96ca7ce065411a4fb748e1ebfbfb7
san99tiago/MULTIPLE_PROJECTS
/MLH_2021/random_number_generator/my_random_number.py
2,109
3.8125
4
# RANDOM NUMBER GENERATOR FROM SCRATCH # Santiago Garcia Arango # MHL 2021 # Inspired on linear conguential generator # https://towardsdatascience.com/how-to-generate-random-variables-from-scratch-no-library-used-4b71eb3c8dc7 # X_(i) = m*X_(i-1) + p # --> U_(i) = X_(i)/p import time import numpy as np import matplot...
65f9cc0f7304fe5af4b70654037fc4bd6383b3d8
az1115/ultimate-python
/ultimatepython/variable.py
510
3.78125
4
def main(): # Here are the main literal types to be aware of a = 1 b = 2.0 c = True d = "hello" # Notice that each type is a 'class'. Each variable # refers to an 'instance' of the class it belongs # to. This leads to an important point: everything # is an object in Python print...
8d8db487472d54bf5f31b81e0fe6ac5a710c1b0b
Shreeya7/Project107
/code.py
515
3.640625
4
import pandas as pd import csv import plotly.express as px # importing graph objects import plotly.graph_objects as go df = pd.read_csv("data.csv") print(df.groupby("level")["attempt"].mean()) # Using the go.bar method ploting the mean on the x-axis and list of levels on y-axis fig = go.Figure(go.Bar( x = df.gr...
b2879fe963493d7d957e77e3b4a81e6a180357a0
JeroenVerstraelen/GegevensAbstractie
/Main (python code)/test_hashmap.py
3,351
3.71875
4
# Tests for the hashmap implementation according to the contract by Nico Beyer # import the classes to test import hashmap # change if needed import time # function to add a collection of items to a hashmap def additems(map0): print("Adding items 1 through 20, 1000 and 99999999999999999999") map0.insert("one"...
13b9d2baec97a086c7b069ce561fe1067bc88b07
JeroenVerstraelen/GegevensAbstractie
/Main (python code)/queue.py
1,994
3.703125
4
class Linknode: ''' Represents a node in a chain. ''' def __init__(self, data, pointer=None): ''' Initialise the node. ''' self.data = data self.pointer = pointer def getPointer(self): ''' Returns the pointer of the node. ''' return self.pointer def setPointer(s...
e29d11d43bc2edb7c0fc51c4b6e26cf190053a97
dmcdekker/cracking-the-coding-interview
/linked-lists/intersection.py
1,226
4.03125
4
class Node(object): """Class in a linked lst.""" def __init__(self, data, next=None): self.data = data self.next = next class Linkedlst(object): '''Linked lst using head and tail''' def __init__(self): self.head = None self.tail = None def lst_print(self): ...
224eabcde36e2689a15edab1e080a401df3d5aeb
AntonBarash/QuantcastAssessment
/most_active_cookie.py
5,909
3.671875
4
from Cookie_Class import Cookie import sys #converts date string to integer representation without dashes def convert_date_string_to_int(date_str): check_valid_date(date_str) return int(date_str.replace('-','')) #analyzes a line from the csv file, finding the cookie name, date, and time from it def analyze_li...
455ef4fdaa04715260c96f37ce16b3e95edd2ae2
1065865483/python_script
/Python/test7.py
1,778
4.28125
4
# #pickle存放数据 # import pickle # # #通过pickle打开并保存文件 # a_dict={'da':111,2:[23,1,4],'23':{1:2,'d':'sad'}} # file = open('pickle_example.pickle','wb') #以写入二进制形式打开 # pickle.dump(a_dict,file) #dump文件并将其装载如file中 # file.close() # # #通过pickle打开并继续加工文件 # file = open('pickle_example.pickle','rb') #以读的形式打开 # a_dict = pickle.load...
d504069b2c76df3b8caf8f31a0c9df4248b97d5a
1065865483/python_script
/three/Exception.py
513
4.1875
4
''' #try...exception try: fileName=input("Please input fileName:") open("%r.txt"%fileName) except FileNotFoundError: print("File not found") #NameError try: stu='jack' print(stu) except NameError: print("变量未定义!") #BaseException try: print(stu) except BaseException: print("变量未定义!") '''...
61c9706b3d00524c4e6d387ca50bc013caae94b5
1065865483/python_script
/three/for_while.py
263
3.71875
4
# student=['jack','bob','herry','mac'] # for stu in student: # print(stu) # sum=0 # for i in range(11): # sum=sum+i # # print(sum) #打印sum的每次数值 # print(sum) #打印sum最终值 n=10 while n>0: n=n-1 print(n) print('over')
33bb8762cfe0c0d1a7df2fcb82fef23e094e5c5f
1065865483/python_script
/Python/004.py
400
3.9375
4
# a=[1,2,3] # b=[4,5,6] # ab=zip(a,b) # print(list(ab)) #需要加list来可视化这个功能 import random answer = random.randint(0,100) print(answer) num = int(input('Please input a num:')) while num != answer: if num>answer: num = int(input("your num is more,continue:")) elif num<answer: num = int(input("you...
6e0c3f2b6df7dccd10c573992016e0106f5c06e2
tarunbanda/intro_to_python
/Week3/Week3Notes.py
844
4.0625
4
'''phoneBook = {'mickey': '213-333-2341', 'minnie': '510-540-2390', 'goofy': '818-399-2763'} for a in sorted(phoneBook): print (a + ' has phone number ' + phoneBook[a])''' """ generates a random number between 1 and 10, and asks the user to guess what it is """ import random # needed to use randint() ...
4b57b891ca435905237a399789993be8ea17d6ff
tarunbanda/intro_to_python
/Week2/LetterChallenge.py
1,179
4.21875
4
''' *** Assignment 2 *** Name: Tarun Banda *** This program takes in a series of inputs (addressee, candidate, and sender *** and automates inserting their information into a pre-worded letter. ''' ## Instruction on how to enter data print ("Enter addressee followed by, candidate, and sender.\n" + "Hit return...
eaf788cb89b3bd9f730f4852317d767ace2adbd2
LSetrakian/assignments
/hello.py
398
4.28125
4
print("Hello, im a python program") a = 5 b = 7 print("The sum of a and b is " + str(a + b)) # This part of the code defines a function def multiply(a,b): print("I'm multiplying two numbers") return a * b # This part of the code then calls that function and assigns the variable x to its return value x ...
32a7201ae2663214b6f9109e91f20af6cc3787da
bhagesh-codebeast/mscbioinfo
/MATHEMATICS/MATRIX_CALCULATION/KKEETS/eigenval.py
243
3.546875
4
import numpy as np from numpy import linalg as LA r = int(input("Enter the number of rows:")) c = int(input("Enter the number of columns:")) mat = [[int(input()) for x in range(c)] for y in range(r)] print(mat) ev = LA.eigvals(mat) print (ev)
dc3e6e2b00c620faee8c49a8d0da62f6b3b7e10a
PlutoniumProphet/Problem-Solving-with-Algorithms-and-Data-Structures-Using-Python
/ex1_10_Control_Structures.py
458
4.375
4
# nested loop to print characters in a list of words word_list = ['cat', 'dog', 'rabbit'] letter_list = [] for a_word in word_list: for a_letter in a_word: if a_letter not in letter_list: letter_list.append(a_letter) print("For Loops: ") print(letter_list) # equivilent using list comprehensions...
e67d5008471ad7c0decc93307e205fce16c859f2
yuvasmart/pyt
/vowcon.py
184
3.953125
4
a=input() c=['a','e','i','o','u','A','E','I','O','U'] if((a>='a' and a<='z')or(a>='A' and a<='Z')): if(a in c): print("vowels") else: print("Consonants") else: print("Invalid")
4e3502585ed56658dfc164b71ed6932a32cb1249
michal20-meet/meetyl1201819
/lab8.py
861
4.125
4
import turtle from turtle import * import random import math class ball(Turtle): def __init__(self, radius, color, speed, dx, dy): Turtle.__init__(self) self.shape("circle") self.shapesize(radius/10) self.radius = radius self.color(color) self.speed(speed) self.dx = dx self.dy = dy def move(self): ...
7119cc7475d8d9a43291471864686b0f3c6e72ca
dannguyen99/codewar_2019
/Phase 3/problem 1.py
408
3.609375
4
from math import factorial def findTrailingZeros(n): count = 0 i = 5 while n / i >= 1: count += int(n / i) i *= 5 return int(count) def numberOfZeroDigits(n): result = 0 for i in range(n, 1, -1): plus = findTrailingZeros(i) if plus == 0: break ...