blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
421db14161fffc2155c0475266c70154b9acf0c8 | gabriellaec/desoft-analise-exercicios | /backup/user_298/ch16_2020_09_09_11_45_22_713719.py | 164 | 3.84375 | 4 | val= input("Qual o valor da conta? ")
val= float(val)
def conta(val):
fin = 1.1*val
return fin
print("Valor da conta com 10%: R${0:.2f}".format(conta(val))) |
db64bb47b9db2c6c48e2af39df78609ccb15769f | Karls-Darwin/kreck | /lab7/rev2.py | 225 | 4.25 | 4 | def reverse(string):
x=""
i=-1
while abs(i)<len(string)+1:
x+=string[i]
i-=1
return x
def main():
x=input('Enter a string: ')
print(reverse(x))
if __name__ == '__main__':
main()
|
a4933426e475c8d8d34bc7ea7ca00f9706836202 | stanwar-bhupendra/LetsLearnGit | /snum.py | 411 | 4.1875 | 4 | #python program to find smallest number among three numbers
#taking input from user
num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
num3 = int(input("Enter 3rd number: "))
if(num1 <= num2) and (num1 <= num3):
snum = num1
elif(num2 <=num1) and (num2 <=num3):
snum = num2
else:
... |
b3835c22508ecb68d116d03f7365cf1157e552e2 | potentia/University-Projects | /Simple-Pentest-Tool/pentest.py | 8,438 | 3.75 | 4 | import socket
import pycurl
from io import BytesIO
import os
def showBanner():
""" Prints the logo of the program """
print(" _____ _ ____ ____ ")
print(" |_ _| / \ |_ || _| ")
print(" | | / _ \ | |__| | ")
print(" _ | | / ___ \ | __ | ")
... |
be17cada4dd9933904eae9fcb7e2ae52e990ca87 | rutuja1302/Login-Signup_System | /Main/LoginSystem.py | 4,198 | 4.3125 | 4 | from tkinter import *
import sqlite3
#create an object to create a window
window = Tk()
#Actions on Pressing Login Button
def login():
def login_database():
conn = sqlite3.connect("1.db")
cur = conn.cursor()
cur.execute("SELECT * FROM test WHERE email=? AND password=?",(e1.get(),e2.get()))... |
aacccdbd244dd21b31268344bc4a6cbcd31fa597 | Ang3l1t0/holbertonschool-higher_level_programming | /0x0B-python-input_output/1-number_of_lines.py | 311 | 3.703125 | 4 | #!/usr/bin/python3
"""Number of Lines
"""
def number_of_lines(filename=""):
"""number_of_lines
Keyword Arguments:
filename {str} -- file name or path (default: {""})
"""
count = 0
with open(filename) as f:
for _ in f:
count += 1
f.closed
return(count)
|
c44c924d65e1eb4e3739d64405527eed272686a2 | Aurel37/Mopti-SA | /page_ranking.py | 3,178 | 3.515625 | 4 | import numpy as np
def soustraction(u0, u1):
"""
u0, u1, two vectors
return the vector (u0-u1)
"""
n = len(u0)
res = []
for i in range(n):
res.append(u0[i] - u1[i])
return res
def copie_vect(u):
"""
copy the vector u
"""
res = []
for i in u:
res.ap... |
f7b2b3c9f8fe48602f870cd21dce8c2016117d27 | git4lhe/lhe-algorithm | /Stack_and_Queue/ํ๋ฆฐํฐ.py | 769 | 3.609375 | 4 | from collections import deque
def solution(priorities, location):
# ์์น์ ๋ํ ๊ฐ ์ ์ฅ
priorities = deque(priorities)
loc_arr = deque([i for i in range(len(priorities))])
answer = []
for i in range(len(priorities)):
max_value = max(priorities)
while priorities:
if priorities[0... |
930cc1f5374e122e3cce84074554f163cd0d2474 | DrAlbertCruz/5210-programming-fundamentals | /ch1-expressions.py | 1,159 | 3.640625 | 4 | import random
NUM_QUESTIONS = 10
def createExpression():
startedPar = False
string = str(random.randint(1,5)) + " ";
for x in range(random.randint(1,3)):
# Append a random connective
op = random.randint(1,5)
if op == 1:
string += "+"
elif op == 2:
string += "-"
elif op == 3:
string += "*"
elif... |
696c2e57eca36e0a719d5c16b0a283019d91b684 | Anri-Lombard/python | /GeeksForGeeks/27_06_2021_merge_sort.py | 599 | 4.21875 | 4 | def merge ( list1, list2 ):
"""Merge 2 sorted lists."""
new_list = []
while len(list1)>0 and len(list2)>0:
if list1[0] < list2[0]:
new_list.append (list1[0])
del list1[0]
else:
new_list.append (list2[0])
del list2[0]
return new_list + list1 + list2
def merge_... |
de9750eb85195f3808650e24557627833051fd66 | github-2643/Password-Generator-using-python | /password.py | 767 | 4.03125 | 4 | import random
print("\t**********PASSWORD GENERATOR**********\t")
print("\t___________________________________________\t\n")
name: str=input("Enter your Name:") #user name
chars = 'abcdefghijklmnopqrstuvwxyz@#$&' #small letter and special symbol
chars1: str ='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'#capital letter and num... |
ffe37d31a5c756843797b525f977c4e881dd2078 | ai-kmu/etc | /algorithm/2022/0405_1038_Binary Search Tree to Greater Sum Tree/Joohye.py | 1,430 | 3.5625 | 4 | '''
# ์ค๋ฅธ์ชฝ๊ฒ์ฌ->๊ฐ์
๋ฐ์ดํธ->์ผ์ชฝ๊ฒ์ฌ->์์ชฝ๋
ธ๋๋ก ์ด๋
# ์์ ๊ณผ์ ๋ฐ๋ณต ํ ๋ ์ด์ ํ์ํ ๋
ธ๋๊ฐ ์์ ๊ฒฝ์ฐ ์ข
๋ฃ
ex)Example 1 ์ผ๋ก ์ค๋ช
. 4(root.val)์์.
4(root.right) -> 6(root.right) -> 7(root.right) -> 8(root.right) = null -> score : 8 = 0 + 8
7(root.right) = 8 -> score : 15 = 7 + 8
6(root.right) = 15 -> score : 21 = 6 + 15
6(root.left) = 5 -> score : 26 = 5 + 2... |
a48356b956325a7e162cc345c556b8c855f218c9 | shivhudda/python | /24_Functions_And_Docstrings.py | 398 | 3.796875 | 4 | # built-in function
a=10
b=34
c = sum((a,b))
print(c)
# user-defined function
def function1(a,b):
return a+b
print(function1(10,34))
# using docstring
def function2(a,b):
"""
this function returns average of a and b.
this function does not work for three digits.
"""
average = (a+b)/2
retur... |
abb4c9d01d6634e9ba6bade1e6333b817dfc4cf1 | ojhaanshu87/LeetCode | /314_vertical_tree_traversal.py | 2,117 | 4.3125 | 4 | '''
Given the root of a binary tree, return the vertical order traversal of its nodes' values. (i.e., from top to bottom, column by column).
If two nodes are in the same row and column, the order should be from left to right.
'''
# Pre-order traversal
# need a col and level variable to indicate which column and level... |
5a499d9cab6afefe0fb05c39ca25c5560edbab40 | Majician13/magic-man | /dateTime.py | 1,140 | 4.65625 | 5 | import datetime
#Print todays date.
currentDate = datetime.date.today()
print(currentDate.strftime("%b %d, %Y"))
#Print today's date in Python format, Just the month, just the Year.
print(currentDate)
print(currentDate.month)
print(currentDate.year)
#Print a special sentence including different aspects of... |
d31f7b0b80aa7c8d7659a1ea3ca5022756030b1c | Lfritze/cs-module-project-algorithms | /moving_zeroes/moving_zeroes.py | 1,299 | 4.4375 | 4 | '''
Input: a List of integers
Returns: a List of integers
'''
def moving_zeroes(arr):
# Your code here
# x is the index
for x, i in enumerate(arr):
# enumerate accepts arguments like -for c, value in enumerate(my_list, 1): print(c, value)
# and creates a counter [(1, 'apple') (2, 'banana').... |
5842a3c5d619c9d6317aedd07b53493c03e6019b | Miracle1111/Diplomchik | /Fur.py | 3,825 | 3.71875 | 4 | import random
# class Cafe_type:
# def __init___(self, spendings, max_entrance):
# self.spendings = spendings
# self.max_entrance = max_entrance
#
# def get_type(self, id):
# if id == 0:
# self.spendings = 25000
# self.max_entrance = 15
# elif id == 1:
# ... |
a107364f9889554937b500e5bb437250cc64b26f | AJAkil/catch-the-ghost-game | /Main.py | 991 | 3.671875 | 4 | from Game import Game
import pprint
from Coordinate import Coordinate
if __name__ == '__main__':
game = Game(9)
game.initiate_board()
game.print_board()
while True:
print('1. Advance Time 2. Scan 3. Bust The Ghost')
choice = input('choose: ')
if choice == '1':
game.... |
1de01b107f583200b06f986b41693ca747984088 | wj1224/algorithm_solve | /leetcode/python/problem_117.py | 1,133 | 4.0625 | 4 | """
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
i... |
65468261597ea27874ca6e17e2646b710f6ce8a4 | litoos11/cursoMasterPython | /17-poo-constructor/main.py | 580 | 3.6875 | 4 | from coche import Coche
carro = Coche("Rojo", "Chevrolet", "Corsa", 250, 240, 4)
carro1 = Coche("Gris", "Chevrolet", "Atos", 250, 240, 4)
carro2 = Coche("Verde", "Chevrolet", "Camaro", 250, 240, 4)
carro3 = Coche("Rojo", "Renault", "Rio", 250, 240, 4)
"""
print(carro.getInfo())
print(carro1.getInfo())
print(carro2.ge... |
8fe4cf5bd53f0cfa47751e6f918cc1d942539241 | devmetalbr/card_identifier | /card_identifier/card_type.py | 1,462 | 3.546875 | 4 | # Card name constants
AMEX = 'AMEX'
DISCOVER = 'Discover'
MASTERCARD = 'MasterCard'
VISA = 'Visa'
UNKNOWN = 'Unknown'
# Card number constants
AMEX_2 = ('34', '37')
MASTERCARD_2 = ('51', '52', '53', '54', '55')
DISCOVER_2 = '65',
DISCOVER_4 = '6011',
VISA_1 = '4',
def identify_card_type(card_num):
"""
Identif... |
bbed1d3c352570590322a3e37dcddd03c858ae00 | nac0n/AoC2019 | /day1/1b.py | 924 | 4.125 | 4 | # Day 1
# The Fuel Counter-Upper needs to know the total fuel requirement. To find it, individually calculate the fuel needed for the mass of each module (your puzzle input), then add together all the fuel values.
# What is the sum of the fuel requirements for all of the modules on your spacecraft?
def get_raw_mass_in... |
45b4b4e1a7aff51e2d00d9168cfd4679d9d98edb | HerbertSu/PrincetonAlgorithms | /Part 1/geometric-applications-of-bsts/intervalST.py | 1,131 | 3.59375 | 4 | class IntervalST:
def __init__(self):
self.root = None
return
class Node:
def __init__(self, key, val):
self.key = key
self.val = val
self.left = None
self.right = None
self.count = 0
def contains(self, key):
... |
1c8cfe4eff336b230f111045a2c66a0879645e01 | nikkirethyo/CS61A | /lab07.py | 2,468 | 4 | 4 | # List Mutation
def reverse(lst):
"""Reverses lst using mutation.
>>> original_list = [5, -1, 29, 0]
>>> reverse(original_list)
>>> original_list
[0, 29, -1, 5]
"""
lst.reverse()
def map(fn, lst):
"""Maps fn onto lst using mutation.
>>> original_list = [5, -1, 2, 0]
>>> map(l... |
72465470daef4346055c1c2c028109d3888ab7eb | Grrw/RobCo-Terminal | /robchar.py | 485 | 3.890625 | 4 | """ File for char class
is length one
chars are made and decided by the templates
used in charword for each char """
class robchar():
def __init__(self, char, owner):
""" char is the character that is
owner is the charword or False """
self.char = char
self.owner = owner
def o... |
d1836477827a04f153f70878f72f61b7801206bb | Kanchan528/assignment1 | /function/fun_10.py | 227 | 4.28125 | 4 | #Write a Python program to print the even numbers from a given list.
def even_num(n):
enum = []
for i in n:
if i % 2 == 0:
enum.append(i)
return enum
print(even_num([1, 2, 3, 4, 5, 6, 7, 8, 9])) |
ecc42457d998d669bd1a9cbc2263bfa40a3d1aad | dalaAM/month-01 | /day07_all/day07/exercise01.py | 549 | 3.859375 | 4 | """
็ปไน 1๏ผๅฐไธคไธชๅ่กจ๏ผๅๅนถไธบไธไธชๅญๅ
ธ
ๅงๅๅ่กจ["ๅผ ๆ ๅฟ","่ตตๆ","ๅจ่ท่ฅ"]
ๆฟ้ดๅ่กจ[101,102,103]
็ปไน 2๏ผ้ข ๅ็ปไน 1ๅญๅ
ธ้ฎๅผ
"""
names = ["ๅผ ๆ ๅฟ", "่ตตๆ", "ๅจ่ท่ฅ"]
rooms = [101, 102, 103]
dict01 = {names[i]: rooms[i] for i in range(len(names))}
dict02 = {value: key for key, value in dict01.items()}
print(dict02)
# ้ๆฑ: ๆ นๆฎๅผๆฅๆพ้ฎ
# ่งฃๅณๆนๆก1: ้ฎๅผๅฏน้ข ... |
27502803dfc4067d2e3010b7d0f887c036c07e11 | Ran500/Python | /Github-python/variables.py | 1,213 | 4.34375 | 4 | # --------------------------------------
# -- Variables --
# ---------------
# Syntax => [Variable Name] [Assignment Operator] [Value]
#
# Name Convention and Rules
# [1] Can Start With (a-z A-Z) Or Underscore
# [2] You Cannot With Num Or Special Characters
# [3] Can Include (0-9) Or Underscore
# [4] Cannot Include Spe... |
b78874e7c462baee6082f8864b96fbf986d4ff26 | ameymahadik1997/amudi97 | /Studentclass.py | 464 | 3.875 | 4 | #Student name and course joined
class Student:
def __init__(self):
self.__sname=input('Enter The Student Name=>')
self.__course=input('Enter The course joined=>')
def showinfo(self):
print('Student Name=',self.__sname,',Thanks for joining course= ',self.__course)
def __del__(self):
print('Thanks for ... |
2bb64adbdd9edb6a3bc71b4c0ffcc34328b5bea8 | joshlevin91/Project-Euler | /p26.py | 834 | 3.703125 | 4 | from math import sqrt
def find_period(n, d):
z = x = n * 9
k = 1
while z % d:
z = z * 10 + x
k += 1
digits = f"{z // d:0{k}}"
return k, digits
def skip(n):
i = 1
while i <= sqrt(n):
if (n % i == 0):
if (n / i == i):
if i =... |
f3abc1dfe41efd3952a4fa529933c09e6b6640b5 | santiagoahc/coderbyte-solutions | /members/soduko_checkers.py | 2,864 | 4.46875 | 4 | """
Using the Python language,
have the function SudokuQuadrantChecker(strArr) read the strArr parameter being passed
which will represent a 9x9 Sudoku board of integers ranging from 1 to 9.
The rules of Sudoku are to place each of the 9 integers integer in every row and column and not have any integers repeat in the ... |
003af195e424fb4a78ba60cc34519129420b72dd | adarshSrivastava01/GUI-CALCULATOR-TK | /guiapp.py | 4,056 | 3.90625 | 4 | from tkinter import *
window = Tk() # Creating Window
window.geometry('354x460') # Defining Size
window.title('GUI CALCULATOR')
label = Label(window,text='CALCULATOR',bg='#2C3335',fg='#ffffff',font=('Monotype Corsiva',28,'bold'))
label.pack(side=TOP)
window.config(background = '#2C3335')
text = StringVar() ... |
20a95acf4f462ca30aeef9827fbb7b472e54a85c | smarthimawari/hi | /hi.py | 58 | 3.5 | 4 | name = input('Please enter your name')
print('Hi,', name)
|
dba6d19e22a9dba78cae8546981b0f073ccea453 | TCReaper/Computing | /Computing Revision/Computing Quizzes/Computing Quiz 1/A4.py | 1,663 | 3.59375 | 4 |
debug_mode = True
n = input("positive integer: ")
tempPermutations = [["",n]]
finalPermutations = []
output = []
itr = 1
while len(tempPermutations) > 0:
print(str(itr))
currentPermutations = tempPermutations[0]
if debug_mode:
print("\tRemoving: [" + currentPermutations[0]... |
855f3d7c51e53c4ad9cf0d1880f23be9ea368020 | usako1124/teach-yourself-python | /chap06/set_union.py | 416 | 3.515625 | 4 | sets1 = {1, 20, 30, 60, 10, 15}
sets2 = {10, 15, 30}
sets3 = {20, 40, 60}
print(sets1.union(sets2)) # ???
print(sets1.union(sets2, sets3)) # ???
print(sets1.intersection(sets2)) # {10, 30, 15} ???
print(sets1.intersection(sets2, sets3)) # set()
print(sets1.difference(sets3)) # {1, 30, 10, 15} ???
print(sets1.diff... |
20a70f2b45eb79a284674ac5aa10266dc99f6172 | Wrangler416/afs210 | /week6/shuffle/shuffle.py | 566 | 4 | 4 | list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
n = len(list)
# I used the fisher yates algo which is O(n) time complexity
# this algo starts from the last list item and swaps it with
# a randomly assigned index position and keeps doing so until all items are swapped
# it is O(n) because it is swapping in place, linear time
imp... |
ab43217649313b0894c131a1a55be8d07ebdac18 | GaloMago/URI_Answers_py | /uri_1071.py | 474 | 3.78125 | 4 | def main()
# entrada
x = int(input())
y = int(input())
# processamento
impares_bet(x,y)
def impares_bet(x,y):
impar = 0
soma = 0
if x > y:
while x > y:
if x % 2 !=0:
impar += x
print(impar)
impares_bet(x-1,y)
... |
d4400cb01e6d557eee6d96b18f642329f8d81c05 | Polin-Tsenova/Python-Fundamentals | /Nikulden's meals.py | 1,062 | 4 | 4 | likes = {}
unlikes = {}
count = 0
while True:
commands = input()
if commands == "Stop":
break
tokens = commands.split("-")
action = tokens[0]
guest = tokens[1]
meal = tokens[2]
if action == "Like":
if guest not in likes and guest not in unlikes:
lik... |
b5ea91ec4dbf2bfcbb263c7e8fdfe8bc0f43a93e | nathramk/fp | /keny.py | 194 | 3.53125 | 4 | #a un areunion asistieron n persona, cuatos apretones de mano hubieron?
#entrada
a=input("ingrese valor: ")
#proceso
r=a*(a-1)/2
#salida
print "la cnatidad de apretones es: %s"%r
|
96e3502eab78a7f72d660cccb4d2780cbecf5d21 | airrain/Algorithm-questions-and-answers | /LeetCode-python/N-Queens.py | 826 | 3.8125 | 4 | """
็ปๅ
ธ็ๅ
ซ็ๅ้ฎ้ข็ไธ่ฌๆ
ๅต๏ผ็จPythonๆๆ ทๆฅๅฟซ้ๅฐ่งฃๅณๅข๏ผ
8-queens
ๆณจๆ็น๏ผ
็ๅ็จ"Q"่กจ็คบ๏ผ็ฉบ็ฝ็จ"."่กจ็คบ
ไพๅญ๏ผ
่พๅ
ฅ: n = 4
่พๅบ:
[ ['.Q..',
'...Q',
'Q...',
'..Q.'],
['..Q.',
'Q...',
'...Q',
'.Q..']]
่งฃ้ขๆ่ทฏ
็จไธไธชๆฐ็ปๆฅ่กจ็คบๅใๆญฃๅๅฏน่ง็บฟ็ๅ ็จๆ
ๅตใไธ่ก่ก็้ๅ๏ผๅฆๆๆฒกๆๅฒ็ชๅฐฑๆ็ธๅบ็ไฝ็ฝฎ็ฝฎไธบๅ ็จ๏ผ็ปง็ปญๅค็ไธไธ่ก๏ผๅนถ่ฎฐๅฝๆน่ก็็ๅๆพๅจไบๅชไธๅ๏ผๅฝ็ๅ้ฝๆพๅฎๅ๏ผๆ นๆฎ่ฎฐๅฝ็ๅๅทๆฅๆผๅบ็ปๆใ่ฟ่กๅๆบฏๆถ่ฆๆๅ ็จ็ไฝ็ฝฎ่ฟๅๅปใๅฏน่ง็บฟไฝ... |
f9fb309830d35b918b0a6c097cdf3ddeee40a0f6 | slottwo/rpg-dpc | /calculator/old.py | 3,020 | 3.78125 | 4 | # The next step for optimization is using the sample space with maybe:
# faces if amount == 1
# faces**2 if amount == 2
# ??? if amount > 2
# ;-;=b
# if amount == 3: if faces is even: 2* (mid*(min+mid)/2); elif faces == 3: (faces+1)**2; elif faces==5: (faces+2)**2...
# I think...
def sums_counter(amount: int, faces: ... |
d47e48bbcc52eff5adebcd9a9a9ead0bb8089f49 | rlashdk2341/91907_Quiz-Game | /04_game_gui_v.2.py | 7,298 | 3.859375 | 4 | from tkinter import *
import csv
import random
class Start:
def __init__(self):
# Start GUI
self.start_frame = Frame(padx=10, pady=10)
self.start_frame.grid()
# Heading row 0
self.director_label = Label (self.start_frame, text="Movies and Directors Quiz",
... |
c0fa16ccd4fda578289323b2f03360b3004f568c | luizhuaman/platzi_python | /p6_prueba.py | 637 | 3.765625 | 4 | OPCION = "-abcdefghijklm"
#RECORRER STRING
for letra in OPCION:
print ("Opcion {} ".format(letra.upper()))
entrada = input('Ingresa tu opcion : ')
print("El indice de la opcion que elegiste, es el siguiente: {}".format(OPCION.rfind(entrada.lower())))
#RFIND() PARA TRAER EL INDICE DE INPUT
if OPCION.rfind(entrad... |
e075818681b7dd48701ad5520e003e5652e149b1 | nflondo/myprog | /python/hardwaybook/ex40-first-class.py | 1,113 | 3.796875 | 4 |
class Song(object):
def __init__(self, lyrics, title):
self.lyrics = lyrics
self.title = title
def sing_me_a_song(self):
# for line in self.lyrics:
# print line
print self.lyrics
def __str__(self):
return self.title
... |
c3f88a3ba356ab1be000c8a4d133b691b7cbd062 | Danieloliver11/Python | /Impacta/semana 10,11,12/teste marco.py | 955 | 4.21875 | 4 | #AC 4 Lรณgica de programaรงรฃo
n = int(input('Digite a quantidade de nomes que irรก digitar:'))
list = []
#Digitar nรบmeros entre 3 e 10.
while n <3 or n>10:
n = int(input('Digite um nรบmero entre 3 e 10:'))
#lista de n elemento.
for x in range(1,n):
valor = input('Digite um nome:')
list.append(valor)
print('Nomes... |
bf84d3cbaa398008632649a14114369c33c05063 | gilsonaureliano/Python-aulas | /python_aulas/desaf033_if_numeromaioremenor.py | 1,126 | 4.125 | 4 | n1 = int(input('Digite um numero '))
n2 = int(input('Digite o segundo numero: '))
n3 = int(input('Digite o terceiro numero: '))
if n1 > n2 > n3:
print('{} รฉ o maior numero1'.format(n1))
print('{} รฉ o menor numero'.format(n3))
if n1 < n2 < n3:
print('{} รฉ o maior numero2'.format(n3))
print('{} รฉ o menor ... |
90e9c911d923a95741323a41673607e07fd564ba | ajayvenkat10/geek-trust | /geektrust.py | 1,062 | 3.59375 | 4 | import sys
from GoldenCrown import *
MIN_REQUIRED_TO_BE_RULER = 3
RULER = "SPACE"
def solveGoldenCrown(input_file):
kingdoms_list = ["SPACE", "LAND", "WATER", "ICE", "AIR", "FIRE"]
animals_list = ["GORILLA", "PANDA",
"OCTOPUS", "MAMMOTH", "OWL", "DRAGON"]
goldenCrown = GoldenCrow... |
efbcabca3514d4cf2b7cbac91a3c6a0f142d7662 | jonathanjaimes/python | /3_primos.py | 359 | 3.859375 | 4 |
num = int(input("Ingrese un numero: "))
def primo(num):
for n in range(2, num):
if num % n == 0:
return False
else:
return True
resultado = primo(num)
if resultado is True:
print("El nรบmero es primo")
else:
print("El ... |
dec03f49d8a4e4f5028a64c4d47661a4b7a43f10 | ksteinfe/decodes_examples | /106 - Lines and Planes/1.06.E03 - Solar Incidence/1.06.E03a.py | 921 | 3.609375 | 4 | '''
1.06.E03a
required:
result:
'''
"""
Angle of Incidence Between Ray and Plane
This function does not return the actual angle, but rather the cosine of the angle of incidence between a given plane and vector. If the vector is "behind" the plane, a value of 0.0 is returned, thereby constraining the result to a ran... |
425d46fd323d0860c1df9bcf20a64c950773418b | EzraKatzman/Algo-Sandbox | /sarcasticText.py | 186 | 3.71875 | 4 | import random
def sarcastify(your_string):
return "".join(x.upper() if random.randint(0,1) else x for x in your_string)
print(sarcastify("well what are you going to do about it?")) |
a623e5322002ee54b00f9485464c2cb80f8fb12b | asterinwl/2021-K-Digital-Training_selfstudy | /5.24/09_Tuple/Homework.py | 984 | 3.984375 | 4 | my_variable=()
print(type(my_variable))
#t = (1, 2, 3)
#t[0] = 'a'
#tuble์๋ ์๋ก์ด ์์๋ฅผ ์ง์ด๋ฃ์ ์ ์์ด์ ์ค๋ฅ๊ฐ ์๊ธด๋ค.
hi=tuple()
hi=(1,)
print(type(hi))
print(*hi)
# num = tuple()
# list(num)
# num.append(1)
# num=tuple(num)
# tuple(num)
t=1,2,3,4
print(type(t))
t=('a','b','c')
tl=list(t)
tl[0]='A'
t=tup... |
89ea588542582981e9730733d80bbf37838017fe | GalinaLopez/data-analytics-portfolio | /car_test.py | 5,206 | 3.5 | 4 | import unittest
from car import Car, EngineCar, PetrolCar, DieselCar, ElectricCar, HybridCar
# Car test suite
# tests the car functionality
class TestCar(unittest.TestCase):
def setUp(self):
self.car = Car()
# this tests the default constructors
def test_car_default_const... |
7dfab631ae6616dc1c5b51706e2276016cf69a2d | WillOsoc/CursoPython | /10_Condicionales.py | 301 | 3.796875 | 4 | print("Programa de Evaluaciรณn")
nota_alumno=input("Introduce la nota: ") #todo input es considerado un string
def evaluacion(nota):
val01="Aprobado" #variables pertenecen solo a su รกmbito
if nota<5:
val01="Reprobado"
return val01
print("El alumno ha sido: " + evaluacion(int(nota_alumno)))
|
4d0b91940897d697178551f4624909f7ea4336fb | chloesheen/NSW-classifier | /NSW.py | 2,957 | 4.28125 | 4 | # Name: Chloe Sheen
# CMSC208 Assignment 5
# Fall 2017
# Example text as a string.
mytext = """NSWs must be classified for phonetic analysis.
This is especially important in the case of numbers,
which differ in their pronunciation depending on their category.
For example, it is necessary to distinguish a year like 184... |
822092290af328d26c9e097e83f0048f7e09d226 | CatalinMB/Python-work | /files.py | 1,944 | 3.703125 | 4 | import time
# Open a file
try:
# line = fHandle.readline()
# for line in fHandle.readlines():
# print(line.rstrip("\n"))
# allLines = fHandle.readlines()
# print(len(allLines))
# allLinesAsAString = fHandle.read()
# print(type(allLinesAsAString))
# print(fHandle.readline())
... |
6618d400dd80fe182ed305dbc06969154fbcb945 | sayalipawade/Python-Programs | /encapsulation.py | 647 | 3.90625 | 4 | <<<<<<< HEAD
#If you want to access and change the private variables, accessor (getter) methods
#and mutators(setter methods) should be used, as they are part of Class.
=======
>>>>>>> Swap_Nibbles
class Person:
def __init__(self, name, age):
self.name = name
self.__age = age
def display(se... |
f9c980ee8e90bf1b89cab106e99859b441418c61 | try-your-best/leetcode_py | /string_pkg/valid-palindrome-ii.py | 821 | 3.5625 | 4 |
class Solution:
def validPalindrome(self, s: str) -> bool:
i = 0
j = len(s) - 1
# print(len(s))
# print(s[0:22])
# print(s[80:len(s)])
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
else:
return self.isValid(s, i+1, j) or self.isValid(s, i, j-1)
return True
def isValid(self, s, left,... |
1c4a001b9ead976e0300907bc55642bba2b061ac | morphatic/isat252s20_04 | /python/fizzbuzz/fizzbuzz.py | 1,190 | 4.125 | 4 | """A FizzBuzz program"""
# import necessary supporting libraries
from numbers import Number
def fizz(x):
"""
Checks to see if the input `x` is numeric and a multiple of 3.
If it is, it outputs 'Fizz'.
Otherwise, it outputs the input.
"""
return 'Fizz' if isinstance(x, Number) and x % 3 == 0 else x
... |
ad182e23cbcc4830d54daee57791e02f24a9199d | fplucas/exercicios-python | /estrutura-de-repeticao/1.py | 224 | 4.0625 | 4 | valor_invalido = True
while(valor_invalido):
nota = float(input('Entre com uma nota de zero a dez: '))
if(nota > 0 and nota < 10):
valor_invalido = False
else:
print('Entre com um valor vรกlido!') |
24827a07f9f799c8dc0ac5d34c77a6db88a1dc61 | OmkarPatkar/Python-Matplotlib | /2 - bar graph/csv file/count.py | 1,015 | 3.796875 | 4 | import csv
import numpy as np
from collections import Counter
from matplotlib import pyplot as plt
#styling the graph
plt.style.use('seaborn')
#read csv file
with open('data.csv') as csv_file:
csv_reader = csv.DictReader(csv_file)
#to count the itteration of each item
language_counter = Counter()
... |
7f408900b5306a4648dc815dff719ef13adf9b06 | catchonme/algorithm | /Python/026.remove-duplicates-from-soted-array.py | 423 | 3.53125 | 4 | #!/usr/bin/python3
class Solution(object):
def removeDumlicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
i = 0
while i < len(nums) - 1:
if nums[i] == nums[i+1]:
nums.pop(i)
else:
i += 1
re... |
ad708394ce6288656199c86d22daeb4f282c279e | kaelinh/csc211 | /hw/hw1/hw1.py | 24,804 | 3.921875 | 4 |
#----------------------------------------------------------------------
# Problem 204
#----------------------------------------------------------------------
#
# Create a function named myfunc with two parameters: x and y.
#
# It should:
#
# 1. Add the parameters
#
# 2. Save that value in a variable z
#
# 3. Return t... |
1a9980b2cc417f18e46362b1962ee0ebd3e792ff | unaiz123/luminarpython | /Collections/introduction/listdemo/binarysearch.py | 377 | 3.765625 | 4 | lst=[10,11,12,13,15,2,3,5,6]
lst.sort()
print(lst)
low=0
upp=len(lst)-1
element=int(input("enter found element : "))
flg=0
while(low<=upp):
mid=(low+upp)//2
if(element>lst[mid]):
low=mid+1
elif(element<lst[mid]):
upp=mid-1
elif(element==lst[mid]):
flg+=1
break
if(flg>0)... |
47b8b34ad9cafd5584dd65615929c31a7edaa585 | floydchenchen/leetcode | /905-sort-array-by-parity.py | 649 | 3.96875 | 4 | # 905. Sort Array By Parity
# Given an array A of non-negative integers, return an array consisting of all the even elements of A,
# followed by all the odd elements of A.
#
# You may return any answer array that satisfies this condition.
class Solution:
def sortArrayByParity(self, A):
"""
:type A:... |
51e464bc81504db4b8e556a8a4b6327a0e1c40b3 | BennoStaub/CodingInterview | /Sort/insertionsort.py | 513 | 3.859375 | 4 | class InsertionSort():
def __init__(self, input_list):
self.list = input_list
def sort(self):
for i in xrange(1, len(self.list)):
next_element = self.list[i]
while self.list[i-1] > next_element and i-1 >= 0:
self.list[i] = self.list[i-1]
... |
b2281bd55f219cc20e15450af09a517534de42eb | DostonKayimov/learnpython | /assignment#3_dostonkay.py | 799 | 3.796875 | 4 | #Yearly expenses($) to study in dream University
total_fees = 28000
my_yearly_income = 2000
if_I_rob_bank = 25000
if total_fees > my_yearly_income:
print("Not that bad! Keep working and you will be applying with your children")
if total_fees < my_yearly_income:
print("Congrats! pack your stuff righ... |
464ae45926da454c084e780c7ae20d0521f70b7a | kyeongminlee/python-mannaEdu | /source/ex02.py | 177 | 3.5625 | 4 | import sys
args = sys.argv[1:]
for i in args:
print(i.upper(), end=' ')
# ๋ช
๋ น ํ๋กฌํํธ๋ฅผ ์คํํ ํ ์๋ ๋ช
๋ น์ด๋ฅผ ์คํํ๋ค.
# python ex02.py i love you |
c8aa9c40d811e7c302711f32edb49a742f4963cb | arinablake/python-selenium-automation | /hw_algorithms_5/hw_5_2.py | 794 | 4.3125 | 4 | # ะะฒะพะดะธััั ะฝะตะฝะพัะผะธัะพะฒะฐะฝะฝะฐั ัััะพะบะฐ, ั ะบะพัะพัะพะน ะผะพะณัั ะฑััั ะฟัะพะฑะตะปั ะฒ ะฝะฐัะฐะปะต, ะฒ ะบะพะฝัะต ะธ ะผะตะถะดั ัะปะพะฒะฐะผะธ ะฑะพะปะตะต ะพะดะฝะพะณะพ ะฟัะพะฑะตะปะฐ.
# ะัะธะฒะตััะธ ะตะต ะบ ะฝะพัะผะธัะพะฒะฐะฝะฝะพะผั ะฒะธะดั, ั.ะต. ัะดะฐะปะธัั ะฒัะต ะฟัะพะฑะตะปั ะฒ ะฝะฐัะฐะปะต ะธ ะบะพะฝัะต, ะฐ ะผะตะถะดั ัะปะพะฒะฐะผะธ ะพััะฐะฒะธัั ัะพะปัะบะพ ะพะดะธะฝ ะฟัะพะฑะตะป.
' Enter some abnormal string '
def clean_string(string):
cl... |
4f8d3055121c128f2df83d72d864184608b328e0 | s-markov/geekbrains-python-level1 | /les05/task05_04/task05_04.py | 1,240 | 3.5 | 4 | # ะกะพะทะดะฐัั (ะฝะต ะฟัะพะณัะฐะผะผะฝะพ) ัะตะบััะพะฒัะน ัะฐะนะป ัะพ ัะปะตะดัััะธะผ ัะพะดะตัะถะธะผัะผ:
#
# One โ 1
# Two โ 2
# Three โ 3
# Four โ 4
# ะะตะพะฑั
ะพะดะธะผะพ ะฝะฐะฟะธัะฐัั ะฟัะพะณัะฐะผะผั, ะพัะบััะฒะฐัััั ัะฐะนะป ะฝะฐ ััะตะฝะธะต
# ะธ ััะธััะฒะฐัััั ะฟะพัััะพัะฝะพ ะดะฐะฝะฝัะต. ะัะธ ััะพะผ ะฐะฝะณะปะธะนัะบะธะต ัะธัะปะธัะตะปัะฝัะต
# ะดะพะปะถะฝั ะทะฐะผะตะฝััััั ะฝะฐ ััััะบะธะต.
# ะะพะฒัะน ะฑะปะพะบ ัััะพะบ ะดะพะปะถะตะฝ ะทะฐะฟะธััะฒะฐัััั ะฒ ะฝะพะฒัะน ัะต... |
a55f66b451d4871e6625b0d756c788543a9557d9 | nileshpandit009/practice | /BE/Part-I/Python/BE_A_55/assignment1_3.py | 222 | 4.0625 | 4 | my_list = input("Enter numbers separated by spaces\n").split(" ")
try:
my_list = [int(x) for x in my_list]
print("Max number is %f" % max(my_list))
except ValueError:
print("Not all items are numbers")
|
595b01d91230e09d202ffd8fa378f814c1725852 | bs980201/leetcode | /173_Binary_Search_Tree_Iterator.py | 1,038 | 3.890625 | 4 | """173_Binary_Search_Tree_Iterator.py."""
class TreeNode:
"""Definition for a binary tree node."""
def __init__(self, x):
"""Init."""
self.val = x
self.left = None
self.right = None
class Stack:
"""Stack."""
def __init__(self):
"""Init."""
self.item... |
22c960e9eacb7cc3a380ced45d4aca6bcce1d800 | fedgut/daily-challenge | /Hackerrank/python3 cavity_map.py | 482 | 3.578125 | 4 | def cavityMap(grid):
import math
n = int(math.sqrt(len(grid)))
for indx in range (n , len(grid)-n):
if indx % n != 0 and (indx % n) +1 != n:
if grid[indx - n] and grid[indx - 1] != 'X':
if grid[indx] > grid[indx-n] and grid[indx] > grid[indx+n] and grid[indx] > gri... |
a8fdd47794ce6ef9b99e63fcc8b4659ac2587c0e | SoloMessiah/LA-2 | /stamp_program.py | 420 | 3.59375 | 4 | """
Start
Get numbers of sheets
Sheets / 5
Round answer to next number
Output to user
End
"""
def calculate(sheet):
answer = sheet / 5
rounded_answer = round(answer)
print("Sheet is: ", sheet)
print("The answer is: ", answer)
print("Rounded is: ", rounded_answer)
print("===================... |
8ee3398b03f58d1026d0118681228908c1ebeb93 | lukamanitta/Coding-Challenges | /PolarCoordinates/solution.py | 1,029 | 3.78125 | 4 | # Enter your code here. Read input from STDIN. Print output to STDOUT
from math import *
from test_cases.py import tests, answers
#compNumber = input()
def main(compNumber):
#Needs to deal with negative numbers - turn string into negative number
if(compNumber.find('+')):
compNumber = compNumber.spl... |
192a68d25e4f12529e3a61b7982ad831ddced1ab | Koyter/geekbrains_hw | /lesson_4/lesson_1_3.py | 74 | 3.5 | 4 | print([item for item in range(20, 241) if item % 20 ==0 or item % 21 ==0]) |
6829749ba551965e77f6554aa347b200b514888d | katefranks/python_hangman_game | /hangman.py | 1,761 | 3.984375 | 4 | def hangman():
word = "dulce"
word_list = ["d", "u", "l", "c", "e"]
word_list2 = ["_", "_", "_", "_", "_"]
guesses = ""
turns = 10
failed = 0
while turns > 0:
guess = input("Guess a letter! ")
if guess in word:
failed = 0
turns -= 1
guess... |
ae3640987a6674be2e785ab9f70a8c0d944e0e98 | RichieSong/algorithm | /็ฎๆณ/ๆฐ็ป/ๆๅบๆฐ็ปไธญๆพๅฐๆๅฎ็ๅผ.py | 654 | 3.75 | 4 | # -*- coding: utf-8 -*-
"""
ๅฆไฝๅจๆๅบๆฐ็ปไธญๆๅฎ็ๅ
็ด ็็ฌฌไธไธชไฝ็ฝฎ๏ผ
1ใ็ดๆฅๅ้ไธ้ ๆถ้ดๅคๆๅบฆO(n)
2ใไบๅๆฅๆพ O(logn)
"""
def binarySearch(nums, value):
l, r = 0, len(nums) - 1
while l <= r:
mid = l + ((r - l) >> 1)
if nums[mid] > value:
r = mid - 1
elif nums[mid] < value:
l = mid + 1
e... |
3d03712b8c94137f5b40640e3cb1b5ab00fa8963 | jimlawton/euler | /007.py | 370 | 3.625 | 4 | """
Project Euler Problem 7
=======================
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see
that the 6th prime is 13.
What is the 10001st prime number?
"""
from utils import isprime
INDEX = 10001
nprimes = 0
i = 1
while True:
if isprime(i):
nprimes += 1
if nprimes... |
e1ca60e880dea8181cc49a35688f6b2f86acb8c9 | return007/computer-vision-basics | /Tutorial2.py | 566 | 3.671875 | 4 | # Tutorial 2 : Video capture and display using webcam
import cv2
import numpy as np
import matplotlib.pyplot as plt
cap = cv2.VideoCapture(0)
# 0 means attached webcam
# 1 means USB camera
while True :
ret, frame = cap.read()
# ret is True or False, depending on the state of the frame read
cv2.imshow('Video c... |
9e0d4c925679521fd36c1b6f9e4882add0e8e0a6 | antoniorcn/fatec-2019-1s | /djd-prog2/noite/aula4/teste_decisao_temp.py | 231 | 4.09375 | 4 | temp = int(input('Digite a temperatura'))
if temp > 30:
print("Esta muito quente")
elif temp > 25:
print("Esta quente")
elif temp > 15:
print("Agradavel")
elif temp >= 0:
print("Frio")
else:
print("Muito Frio")
|
c72b9b52c9b7bac493dff96b262c208005ec25cc | ConceptCodes/CS101-labs | /test.py | 1,854 | 3.875 | 4 | __author__ = 'dojo'
# Import turtle graphics library
import turtle
from math import *
from random import *
def random_color(turtle):
screen = turtle.Screen()
screen.colormode(255)
r, g, b = randint(0, 255), randint(0, 255), randint(0, 255)
turtle.pencolor((r,g,b))
def drawConstellation... |
89fee5740f827b783d38a119457b3ef5f0d283d3 | HaroldCA/ExamenDeFP | /EjercicioNยฐ001HTCA.py | 499 | 3.65625 | 4 | import os
#Calcular nota final del curso de FP
PU = float (input ('Ingrese nota de la primera unidad: '))
SU = float (input ('Ingrese nota de la segunda unidad: '))
TU = float (input ('Ingrese nota de la tercera unidad: '))
TF = float (input ('Ingrese nota del trabajo final:'))
final=(PU * .20) + (SU * .15) + (TU * .1... |
60ffc0b6aaaf91cbef4b2cb28e7652f5b78aaffc | bporcel/DataStructures | /dataStructures/trees/classBinarySearchTree.py | 5,832 | 3.796875 | 4 | # 9
# 4 20
# 1 6 15 170
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def __str__(self):
string = 'value: {}\nleft: {}\nright: {}'.format(
self.value, self.left, self.right)
return string
c... |
efc729a75b8f59a2d0a63b66582cd6ac03980715 | gauriindalkar/more-exercise | /acending order.py | 160 | 3.828125 | 4 | list1=[1,5,10,12,16,20]
list2=[1,2,10,13,16]
i=0
while i<len(list2):
m=list2[i]
if m not in list1:
list1.append(m)
i+=1
print(sorted(list1)) |
bbad9e85b28b7aa9eccd3050f65dede04ddc7764 | kqxu1992/linux_python_learning | /python_work/cvs_json/highs_lows.py | 1,069 | 3.53125 | 4 | import csv
from datetime import datetime
from matplotlib import pyplot as plt
#filename = "sitka_weather_07-2014.csv"
filename = "death_valley_2014.csv"
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
print(header_row)
for index1, column_header in enumerate(header_row):
print(index1,... |
1f3968e8762831e13b703e59dbb8503eef1debc3 | synergie-asso/jeu-videal | /src/square.py | 711 | 3.78125 | 4 | class Square:
def __init__(self, v):
self.value = v
self.fusion = False
def __int__(self):
return self.value
def __add__(self, other):
return self.value + other
def __mul__(self, other):
return self.value * other
def __float__(self):
return float(s... |
728d89e9653c071263de646aa0a89808bb65545f | Abhirvalandge/Python-Practice-Programs | /Loop's/Q.37.py | 108 | 4.1875 | 4 | # What is the output of the following
i=0
while i<3:
print(i,end="")
i+=1
else:
print(0,end="") |
6ec81376ebc2ad9fb23c1d7e97befd591d06528e | kwm94/PythonP | /Practical 2/kitwm_p02/kitwm_p02/kitwm_p02q05.py | 1,237 | 4.53125 | 5 | # File Name: days_in_month.py
# Name: Kit Wei Min
# Description: Displays the number of days in the month of a year entered by the user.
# Prompts user to input the month and year.
yr = int(input("Enter a year: "))
mth = int(input("Enter the month: "))
# Determines the number of days in the month of the year entered... |
b0361dff570abc72b26cd13e8fc12ff2dbc55ff4 | sunliuxun/repo-eulerproj | /euler_util.py | 379 | 3.984375 | 4 | def is_prime(x):
if x < 2:
return False
for i in range(2, x):
if x % i == 0:
return False
return True
def sqrt(x):
if x < 0:
raise ValueError("sqrt func input invalid")
i = 1
while i * i <= x:
i *= 2
y = 0
while i > 0:
if (y... |
88a3687b53318c80ce56b908758c9f88d5637c22 | JRHyc/Python | /Practice/compare_lists.py | 708 | 4.0625 | 4 | list_one = [1,2,5,6,2]
list_two = [1,2,5,6,2]
# list_one = [1,2,5,6,5]
# list_two = [1,2,5,6,5,3]
# list_one = [1,2,5,6,5,16]
# list_two = [1,2,5,6,5]
# list_one = ['celery','carrots','bread','milk']
# list_two = ['celery','carrots','bread','cream']
list_length = len(list_one)
final_answer = ""
def compare(one, two... |
94b9808f46c14b5d8b8f61b30d0d1c2efc469d40 | yhs3434/Algorithms | /baekjun/exercise/2020DEC/6378.py | 281 | 3.71875 | 4 | def getAnswer(num):
numStr = str(num)
val = 0
for nStr in numStr:
n = int(nStr)
val += n
if val >= 10:
val = getAnswer(val)
return val;
while True:
n = int(input())
if n == 0:
break
val = getAnswer(n)
print(val) |
27cf6807fa97fb2020f6cc393899c88fee6364e9 | Aasthaengg/IBMdataset | /Python_codes/p02262/s728236013.py | 671 | 3.578125 | 4 | import sys
def insert_sort(A, n, g):
global cnt
# ๆๅฎๅคใฎgใใใชในใใฎๅคงใใใพใง็นฐใ่ฟใ
for i in range(g, n, 1):
# print(f"bef{A=}")
# ๆๅใซใใใใใๆฐๅค
v = A[i]
j = i - g
# print(f"{j=}")
while 0 <= j and v < A[j]:
A[j+g] = A[j]
j = j - g
cnt +... |
2f3b5e65ff6211e1c4783fda4ab2b2885eecc040 | dclouzada/python-520 | /aula_1/main.py | 669 | 4.0625 | 4 | usuario = {
'nome': input('Digite seu nome'),
'idade': input('Digite sua idade'),
'email': input('Digite seu email'),
}
nome = usuario['nome']
print('Usuario {} cadastrado com sucesso!'.format(usuario))
exit()
GRAVIDADE = 9.8
primeiro_nome = 'David'
segundo_nome = 'Castro'
ultimo_nome = 'Louzada'
idad... |
fecde979f3065aaf8a86ad5ad6101751885c9104 | NikhilVarghese21/AI-ML | /Python_AIML/Q9_MostRepeatedWord.py | 815 | 4.34375 | 4 | count = 0
word = ""
maxCount = 0
words = []
# Opening Text file in read mode
file = open("Text", "r")
# Gets each line till end of file is reached
for line in file:
# Splits each line into words
string = line.split(" ")
# Appending each word in string to words.
for s in string:
words.append(s)... |
b3bdb73b4addcda03ee4096b505689eee0e8fcfd | dallasmcgroarty/python | /DataStructures_Algorithms/graphs/dfs.py | 922 | 4.1875 | 4 | # depth first search:
# algorithm to traverse a graph by going down each branch and visiting all children
# before backtracking
# method:
# 1. make the current vertex as visited
# 2. explore each adjacent vertex that is not included in the visited set
class Node:
def __init__(self,value):
self.value = valu... |
97e062d4f973163917d2e3d3d548088b36019f1e | AdamBures/Machine-Learning-Projects | /linear_regression.py | 638 | 3.78125 | 4 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
#Here creating arrays of x, y
time_studied = np.array([5, 15, 25, 35, 45, 55]).reshape(-1,1)
scores = np.array([5, 20, 28, 40, 22, 38]).reshape(-1,1)
#Precreated model from Sklearn module
model = LinearRegressi... |
28c3e6b5963cd90dde626acab2880823c33e2a5c | rizquadnan/codeForces | /3_wayTooLongWords.py | 297 | 3.65625 | 4 | n = int(input())
words = []
for i in range(n):
words.append(input())
for word in words:
if len(word) > 10:
first = word[0]
last = word[-1]
between = str(len(word[1:-1]))
output = first + between + last
print(output)
else:
print(word)
|
3860f0ea6ce99ecd994fadd7c2f6262e22f73a44 | SDRLurker/starbucks | /20160823/20160823_1.py | 244 | 3.703125 | 4 | words = []
for N in range(int(input())):
words.append(input())
words.sort()
for Q in range(int(input())):
word = input()
rank = words.index(word) + 1
score = 0
for c in word:
score += ord(c) - ord('A') + 1
score *= rank
print(score)
|
e60e841fe236aebc85ff3a03067ea5b004de5c73 | ipacharapold/sennalabs-test-candidate | /quiz2.py | 400 | 3.625 | 4 | import csv
import os
def read_csv(file):
output = ""
people = {}
file = open(file, 'r')
render = csv.reader(file)
for row in render:
people[row[1]] = row[0]
for lname, fname in sorted(people.items()):
output += "{first}{last}\n".format(first=fname, last=lname)
file.close()... |
a2bcfb99672ee1580bf3f0f6fff062756df7cd9d | idreesdb/Tutorials | /python/Zetcode/Python Tutorial/09 - Functions/types.py | 219 | 3.578125 | 4 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# types.py
from math import sqrt
def cube(x):
return x * x * x
# built in function
print abs(-1)
# defined function
print cube(9)
# external function
print sqrt(81) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.