blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
d12872c0e7e1227e4031d1f7ea69faa5e94ec75c
AlexTatarov/RUG-Multi-Agent-Systems
/game.py
7,864
3.65625
4
from card import Card from computer import Computer from kripke_model import KripkeModel import random class Game: def __init__(self, players): self.cards = set() self.deck = [] self.attacking_cards = [] self.defending_cards = [] self.discard_pile = [] self.outcome = 0 # smallest card that every pla...
e466834b9340473dbaa16f341e9b37c448ec2933
Andrey-Pivtorak/python-projects
/stadium_seating.py
985
3.84375
4
# a task: Stadium Seating # global constants CLASS_A_SEATS = 20 CLASS_B_SEATS = 15 CLASS_C_SEATS = 10 # main function def main(): print('How many tickets were sold?') countAtickets = int(input('Class A: ')) countBtickets = int(input('Class B: ')) countCtickets = int(input('Class C: ')) incomeAtick...
936efc1ae262f96cd45be0d4e9a474b44e54eedf
Andrey-Pivtorak/python-projects
/coffee_write.py
698
4.1875
4
# This program adds coffee inventory records to # the coffee.txt file. # main function def main(): # Create a variable to control the loop another = 'y' coffee_file = open('coffee.txt', 'a') while another == 'y' or another == 'Y': print('Enter the following coffee data:') descr = input(...
f1b56c567836f792edf0394939ab5583eeb2b9ba
iwoty/basic_ERP
/common.py
2,087
3.65625
4
# implement commonly used functions here import random # generate and return a unique and random string # other expectation: # - at least 2 special char()expect: ';'), 2 number, 2 lower and 2 upper case letter # - it must be unique in the list # # @table: list of list # @generated: string - generated random string (...
cc582cd5046be97c7089bbf6a7c3f43ca7ff9a3d
stvnorg/checkio-python
/censor.py
353
3.796875
4
#!/usr/bin/python def censor(text,word): text = str(text) word = str(word) asterix = "" text_split = text.split() if word in text_split: asterix = "*" * len(word) for n in text_split: if (n==word): text_split[text_split.index(n)] = asterix return " ".join(text_split) print censor(...
78a39b0798f6dd0322ec942b2a2fb549598cf587
stvnorg/checkio-python
/investment-target.py
383
3.5625
4
#!/usr/bin/python initial_deposit = input("Initial Investment($) : ") return_rate = input("Return Rate(%) : ") timeline = input("Target Time (in month): ") return_amount = 0 total_month = initial_deposit + return_amount for i in range (1,timeline+1): return_amount = (return_rate/100.0) * total_month total_month +=...
1f660b7598c9cd5c5ba2e11101983de309adc4b2
stvnorg/checkio-python
/matrix-determinant.py
883
3.625
4
def determinant(matrix): return (matrix[0][0]*matrix[1][1])-(matrix[0][1]*matrix[1][0]) def pMatrix(matrix,n): if len(matrix)==2: return determinant(matrix) else: result = [] for i in range(1,len(matrix)): tmp = [] for j in range(len(matrix[0])): ...
e29c0520256a5dcc906e5880bcaf07a53e7ec931
stvnorg/checkio-python
/extra-dashes.py
328
4
4
def checkio(data): count = 0 n = "" for i in range(len(data)): if data[i] != '-' and data[i-1] == '-': count = 0 if data[i] == '-' and count == 0: n += '-' count += 1 elif data[i] == '-' and count == 1: pass else: n += data[i] return n print checkio('I---like-python') print checkio('I like p...
d0e2077f0ce27c2b6e899a01a4feb0168c8fd231
zamora1607/python
/reverse_string.py
193
4.40625
4
user_string = input("Please enter string") reversed_string = "" for item in range(len(user_string) -1, -1, -1): reversed_string += user_string[item] print("reversed: " + reversed_string)
9461c3c2e235fc7852d1a364526233b2c9a3f4de
esalcido/Sprinklord
/polls/SprinklerLord.old/relay.py.old
1,555
3.59375
4
#!/usr/bin/env python # This will import the GPIO library. import Adafruit_BBIO.GPIO as GPIO import logging # This will import the sleep function for the timer below. from time import sleep #Configure the logger. logging.basicConfig(filename='/home/front_yard_sprinkler.log',format='%(asctime)s %(levelname)...
2fa068cb3a81b0560137380ef41b43ad3d5e3ee9
sayeed007/PythonProgramming
/Pandas/8_Cleaning Data of Wrong Format.py
288
3.609375
4
import pandas as pd df = pd.read_csv('dirtydata.csv') ###Convert Into a Correct Format df['Date'] = pd.to_datetime(df['Date']) print(df.to_string()) ###Removing Rows df['Date'] = pd.to_datetime(df['Date']) df.dropna(subset=['Date'], inplace = True) print(df.to_string())
d83ed8e8933fd4c8b3731952d12bd609f0779638
sayeed007/PythonProgramming
/Numpy/13_NumPy Filter Array.py
1,226
3.890625
4
import numpy as np arr = np.array([41, 42, 43, 44]) #Create an array from the elements on index 0 and 2 x = [True, False, True, False] newarr = arr[x] print(newarr) #Creating the Filter Array # Create an empty list filter_arr = [] # go through each element in arr for element in arr: # if the element is higher tha...
4939693aaa46eecc1d1c59bdcbe80e14d788344a
sayeed007/PythonProgramming
/Collections/Counter_Basic.py
308
3.5
4
from collections import Counter X = int(input()) #Number of Shoes li = list( map (int,input().split())) N = int(input()) #Number of customers total = 0 for i in range(N): size, price = map( int,input().split()) if size in li: total += price li.remove(size) print(total)
1ca2c7bf237f6f9286f9bd288f3b128455ff3c1f
sayeed007/PythonProgramming
/Numpy/8_NumPy Array Iterating.py
1,160
3.53125
4
import numpy as np #Iterating 2-D Arrays arr = np.array([[1, 2, 3], [4, 5, 6]]) for x in arr: print(x) print('Iterate on each scalar element of the 2-D array:') for x in arr: for y in x: print(y) #Iterating 3-D Arrays print('Iterating 3-D Arrays') arr = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11,...
f28a75ab4606d2a42c72e2d094abbc51f676e3ce
sayeed007/PythonProgramming
/Numpy/3_NumPy_Array_Indexing.py
556
4.125
4
import numpy as np #Accessing 1-D Array arr = np.array([1, 2, 3, 4]) print('\n2nd element of the array: ',arr[1]) #Accessing 2-D Array arr = np.array([[1,2,3,4,5], [6,7,8,9,10]]) print('\n2nd element on 1st dim: ', arr[0, 1]) print('\n5th element on 2nd dim: ', arr[1, 4]) #Access 3-D Arrays arr = np.array([[[1, 2, 3...
5dd7f380a589d11e686003c8285c99a665846568
sayeed007/PythonProgramming
/Numpy/29_NumPy Products.py
263
3.546875
4
import numpy as np arr1 = np.array([1, 2, 3, 4]) arr2 = np.array([5, 6, 7, 8]) x = np.prod([arr1, arr2]) print(x) #Product Over an Axis newarr = np.prod([arr1, arr2], axis=1) print(newarr) #Cummulative Product newarr = np.cumprod(arr1) print(newarr)
81bcc5c5120270295107c36af1dfcd0861fb6d29
sayeed007/PythonProgramming
/SciPy/SciPy_Statistical_Significance_Tests.py
1,540
3.828125
4
#Find if the given values v1 and v2 are from same distribution: import numpy as np from scipy.stats import ttest_ind print("T-Test") #T-tests are used to determine if there is significant deference between means of two variables v1 = np.random.normal(size=100) v2 = np.random.normal(size=100) res = ttest_ind(v1, v2) ...
b26dc12172c4573ba375e61a54d3113346b0af5d
sayeed007/PythonProgramming
/HackerRank/PythonProblems/Time_Delta.py
743
3.734375
4
import math import random from datetime import datetime # Complete the time_delta function below. def time_delta(t1, t2): time_format = '%a %d %b %Y %H:%M:%S %z' """ %a = weekday %d = Day of month 01-31 %b = Month name, short version %Y = Year, full version %H:= Hour 00...
e5e2c879a497f222e53ad560ed7c158f09a3025a
sayeed007/PythonProgramming
/HackerRank/PythonProblems/Capitalize!.py
182
3.796875
4
def solve(s): for i in s.split(): s = s.replace(i,i.capitalize()) return s if __name__ == '__main__': s = "1 w 2 r 3g" result = solve(s) print(result)
c27f03b2e0352418973c1eab2f50db7c613fc205
sayeed007/PythonProgramming
/HackerRank/PythonProblems/Plot_Bars.py
405
3.71875
4
import matplotlib.pyplot as plt import numpy as np x = np.array(["A", "B", "C", "D"]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 2, 1) plt.bar(x,y, color = "green", width = 0.2,) #Horizontal Bars x = np.array(["A", "B", "C", "D"]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 2,2 ) plt.barh(x, y, color = "hotpink", h...
f3e1620cd617e20878cf36f56916fe8c32b699c8
sayeed007/PythonProgramming
/Numpy/34_NumPy Hyperbolic Functions.py
338
3.5
4
import numpy as np x = np.sinh(np.pi/2) print(x) #Find cosh values for all of the values in arr arr = np.array([np.pi/2, np.pi/3, np.pi/4, np.pi/5]) x = np.cosh(arr) print(x) ####Finding Angles x = np.arcsinh(1.0) print(x) #Angles of Each Value in Arrays arr = np.array([0.1, 0.2, 0.5]) x = np.arctanh(arr) print(x...
c2bcaca04265c9d583e8b7147ab802c14086534a
sayeed007/PythonProgramming
/Numpy/33_NumPy Trigonometric Functions.py
802
3.84375
4
import numpy as np #sin(), cos() and tan() that take values in radians and produce the corresponding sin, cos and tan values x = np.sin(np.pi/2) print(x) #Find sine values for all of the values in arr arr = np.array([np.pi/2, np.pi/3, np.pi/4, np.pi/5]) x = np.sin(arr) print(x) #Convert Degrees Into Radians #radian...
740536ac56c15b826b210136f04b88e631a28020
sayeed007/PythonProgramming
/Numpy/16_Random Permutations.py
354
3.875
4
from numpy import random import numpy as np arr = np.array([1, 2, 3, 4, 5]) #Shuffling Arrays print('Original Array: \n', arr) random.shuffle(arr) print('Shuffeled Array: \n', arr) #Original Array Changed #Generating Permutation of Arrays print('Permutation of Array: \n', random.permutation(arr)) #Original ar...
0b539c24ec7cb86c5e7ba5fd6fda4c4d8b06d07a
mpant84/pynet_ons
/madhur_exercise7.py
417
3.5625
4
#!/usr/bin/env python ip_addr = raw_input("Please enter an IP addr? ") octets = ip_addr.split(".") octets[3] = '0' print ("{:<12} {:<12} {:<12} {:<12}".format("Octet 1","Octet 2","Octet 3","Octet 4")) print ("{:<12} {:<12} {:<12} {:<12}".format(octets[0],octets[1],octets[2],octets[3])) print ("{:<12} {:<12} {:<12} {...
b168f936fafab53de1c67ea0578153208aec0e9f
Ta-SeenJunaid/Data-Structures-and-Algorithm
/Associative Arrays/linear_probing.py
1,580
3.984375
4
class HashTable(object): def __init__(self): self.size = 10 self.key_list = [None] * self.size self.value_list = [None] * self.size def hash_function(self, key): sum = 0 for pos in range(len(key)): sum += ord(key[pos]) return sum % self.size d...
ff0700c28f61791437058a9ead59fbb5f3779960
Ta-SeenJunaid/Data-Structures-and-Algorithm
/Dynamic-Programming/Tabulated (bottom up) version of nth Fibonacci number.py
304
4
4
# -*- coding: utf-8 -*- def fib(n): f =[0]*(n+1) f[1] =1 for i in range(2,n+1): f[i]=f[i-1]+f[i-2] return f[n] def main(): n=int(input("Enter a number: ")) print("Fibonacci Number is ",fib(n)) if __name__=="__main__": main()
4f0dbb2de9700cbf39a4db197b091a887fb964bc
Ta-SeenJunaid/Data-Structures-and-Algorithm
/Dynamic-Programming/longest_common_subsequence_r.py
465
3.734375
4
# https://practice.geeksforgeeks.org/problems/longest-common-subsequence-1587115620/1 class Solution: #Function to find the length of longest common subsequence in two strings. def lcs(self,x,y,s1,s2): # code here if x == 0 or y == 0: return 0 if s1[x-1] == s2[...
4ff3dc98b92e2f95dbe30457dc79b53363bedffb
karippery/Genetic-Algorithm
/roulette_wheel_selection.py
396
3.546875
4
def roulettewheel_selection(p_population): #print(random_number) cumulative_sum=np.cumsum(p_population) # Return the cumulative sum of the elements along a given axis random_number=np.random.uniform(0,cumulative_sum[-1]) place=np.argwhere(random_number<cumulative_sum) #Find the indices of array element...
8ecf71a5d4e67910c0d2aca8f5a21bae500c0819
gold1740/dndSheet
/codeWritingScripts/load.py
1,185
3.546875
4
def function(skill, other): s = "\t\t\t\tvalue = in.readObject().toString();\n" s +="\t\t\t\tif (value.equals(\"3\")){"+skill.lower()+".twice.setSelected(true);}\n" s +="\t\t\t\telse if (value.equals(\"2\")){"+skill.lower()+".full.setSelected(true);}\n" s +="\t\t\t\telse if (value.equals(\"1\")){"+skill.lower()+".h...
4e274cdb918828d41099f18b652385a34f54e7fa
yut-kt/jumbled-python
/kaibunsuu2.py
311
3.703125
4
#coding:utf-8 def generator(): num = 11 while True: yield num num += 2 for num in generator(): num2 = bin(num) num2 = num2[2:] num8 = '%o' % num num10 = str(num) if num2 == num2[::-1] and num8 == num8[::-1] and num10 == num10[::-1]: print num break
8b2a3cc17ec5e778a480284cb400e5f8f80670a0
cmooshil/MATH-215-Projects
/215 Final Project.py
7,310
3.578125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 5 15:06:23 2018 @author: christinamooshil Creates visuals for complex mathematical functions with matplotlib """ import numpy as np import matplotlib.pyplot as plt #LOG FUNCTION def reLog(N_max, xmin, xmax, ymin, ymax, nx, ny): x = np.linspa...
037d85178772301245c208ee1f151b9b9b82577a
Tinkriss/Introduction-to-Algorithms
/Chapter2. Getting Started/2.3-6/insertion-sort-modified.py
702
3.9375
4
def binary_search(array, l, r, value): middle = int((l+r)/2); if array[middle] >= value: if array[l]<=value: return _search(array, l, middle, value); else: return l; else: if array[r]>=value: return _search(arra...
28c5a511e3d1f828ee3940687c8c0be94a3a7300
derek-harbaugh/pdsnd_github
/bikeshare.py
9,245
4.4375
4
import pandas as pd CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } #Define valid month options months = ['january', 'february', 'march', 'april', 'may', 'june'] #Define day options days = ['sunday','monday','tuesday','wednesday...
c63684bc411df076a141c5be40734f7f9dc8c7a0
RIGBY-RUT/pythonintask
/INBa/2015/Sosnovy Mikhail/python tasks/1.1.3.py
123
3.8125
4
import math n=float(input("Число n:")) y=float(input("Число y:")) g = n*(y + 3.5) + math.sqrt (y) print (g)
f6095468d43d8acc898c26ba945eb2f5bd65c25d
RIGBY-RUT/pythonintask
/INBa/2015/Sosnovy Mikhail/python tasks/1.1.4.py
128
3.6875
4
import math a=float(input("Число a:")) t=float(input("Число t:")) d = 9.8 * a**2 + 5.52 * math.cos(t**5) print (d)
dd4897b4287cdc5ca87103883bc170a612130040
Alanrah/WorkSpace
/device_classfier/VGG_categorical/pythonServerTest.py
2,313
3.765625
4
# -*- coding: cp936 -*- ''''' һpython serverָ˿ڣ ö˿ڱԶӷʣȡԶӣȻݣ Ӧ ''' if __name__ == "__main__": import socket print("Server is starting") sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost', 8002)) # soketIPַͶ˿ں sock.listen(5) # ӺserverͨѭFIFOԭ,ָٸͻӵ print("Server is listenting port 8002, w...
c87495a7ff6bc0539ba08fceec5d9bded202d5e4
sunidhiyadav/bookReview
/app/models/Book.py
3,395
4.1875
4
""" Sample Model File A Model should be in charge of communicating with the Database. Define specific model method that query the database for information. Then call upon these model method in your controller. Create a model using this template. """ from system.core.model import Model class Boo...
533423d848a42570fec6162a52e5b87153b8b236
Kaleidophon/shiny-robot
/experiments/distances.py
9,676
4.125
4
# -*- coding: utf-8 -*- """ Functions to analyze the distances between given number inside a sudoku. """ # STD from collections import defaultdict import math import functools # EXT import numpy import matplotlib.pyplot as plt from scipy.linalg import eigh # PROJECT from general import Sudoku, SudokuCollection, read...
23b5170dfb529eb04c6e350012080841659caf19
chris-r-harwell/HackerRankRegex
/find-hackerrank/ans.py
790
3.65625
4
#!/bin/env python3 import re def FindHackerRankScore(test_string): """ -1 if line neither starts nore ends with hackerrank 1 if line starts with hackerrank 2 if line ends with hackerrank 0 if line both starts and ends with hackerrank """ score = -1 # assume none start = re.searc...
3c9d0be930284e4ef7f538b2b778b5e6b8e22121
chris-r-harwell/HackerRankRegex
/matching-word-non-word/ans.py
227
3.96875
4
#!/bin/env python3 # \w word char [0-9 a-Z] # \W non-word import re regex_pattern = r'(\w){3}\W(\w){10}\W(\w){3}' test_string = input() search = re.search(regex_pattern, test_string) is not None print(str(search).lower())
5224a3f8c66efd68f51bdeccc871dce903017d3f
Ashot-Sargsyan/lesson
/lesspn5.py
3,147
3.5625
4
# import math # print(math.pi) # print(math.sqrt(16)) # from math import*#karanq grenq naev from math pi # print(pi) # print(sqrt(25)) # import random # print(random.random())#0 minchev 1 random tver # import random # print(random.randint(0,20))# 0 minchev 20 random tver # import random # human=int(input('human num...
07fe273a80757f1fc8c7700f908766c56018ba6c
Ashot-Sargsyan/lesson
/lesspn12.py
1,292
3.53125
4
import random count = 0 while True: if count==20: user = int(input('number betwen (1) ')) if user == 1: print('win pc') break else: print('please write 1') elif count == 19: user = int(input('number betwen (1-2) ')) if user == 2: print('win pc') break elif user == 1: print(cou...
b2e725cbbf035f8175c3ffd2c791ce6cb594d62e
Ashot-Sargsyan/lesson
/lesspn13.py
1,757
4.1875
4
# a=() # print(type(a)) # b=tuple()#miat vedro vorte karas pahes ham string ham int # print(type(b)) # tupl=('physics','chemistry',1997,2000) # print(tupl.__sizeof__())#sizeof cuica tali ira chape ichkana tex gravum biterov # thistuple = ('apple','banana','cherry',12,2000)#cuica tali erkarucune # print(len(thistu...
3a947b015db8f727f1a6e6c7e8e65244ea8131a1
tomo0611/Protocol-Buffers-Python
/write.py
1,682
3.953125
4
#! /usr/bin/python # coding: UTF-8 import addressbook_pb2 import sys # This function fills in a Person message based on user input. def PromptForAddress(person): person.id = int(raw_input("IDを入力 : ")) person.name = raw_input("名前を入力 : ") email = raw_input("メールアドレスを入力 (空でも良い): ") if email != "": person.emai...
1c054648cd3bbc6566c13782f4199fd77fedba64
GabrieladaRocha/N1LinguagemProgramacao
/Q4.py
1,193
4.03125
4
#- Explique o que é decorator e padrões de projeto. Crie um decorator que mostre #o tempo de execução de uma função que soma 4 números aleatórios. import datetime """ Decorator -> “O padrão Decorator atribui dinamicamente responsabilidades adicionais a um objeto. Os decoradores fornecem uma alternativa de subclasse...
9760fda15c34b19861251aaab0c9e4921da31ed8
michalprchlik/project_euler_python3
/smallest_multiple/function.py
619
3.734375
4
# 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. # # What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? def get_list_of_numbers(max_number): result = [] for x in range(1, max_number + 1): result.append(x) re...
ba7c650db06a91de892b41ac8997a4d08f91d0be
michalprchlik/project_euler_python3
/10001st_prime/function.py
594
3.984375
4
# 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 10 001st prime number? def get_xxx_prime_number(max_number): number = 1 count = 0 prime_number_list = [] while count < max_number: number = number + 1 if is_prime_number(number, prime_number_...
edc66db278bd0a21b287248191c56f3c00017519
ConorHK/adventofcode2019
/daytwo/daytwo.py
1,994
3.921875
4
# Program for daytwo of advent of code # by Conor Knowles # ------------------------------------ import sys # for using sys.exit() function input_lis = [] # declaration of master list # reading in input from text file with open("input.txt") as file: input_lis = file.read().split(',') file.close() # converting c...
aaaf58126e1d8d4cd3c0d07d9d08db5918723257
FumihisaKobayashi/The_self_taught_python
/5_section/5_8.py
270
4
4
colors = ["purple", "orange", "green"] #例文通りやろうとすると、日本語だと反応しない、、分からない、、確認。 guess = input("Guess a color:") if guess in colors: print("You guessed correctly!") else: print("Wrong! Try again.")
c2c1915a399cb1c01d3d5670759718f319b8d1c4
FumihisaKobayashi/The_self_taught_python
/6_section/6_4.py
231
3.515625
4
#.upper()にて全て大文字 a = "We are the world...".upper() print(a) #.lower()にて全て小文字 b = "SO IT GOES".lower() print(b) #.capitalize()にて1文字目大文字。 c = "four score and...".capitalize() print(c)
c840ae508ba91dbffa557d6e5e37dde0b21d09c5
FumihisaKobayashi/The_self_taught_python
/5_section/5_1.py
120
3.65625
4
#新しい要素を追加 fruit = ["Apple", "Orange", "Pear"] fruit.append("Banana") fruit.append("Peach") print(fruit)
53908cedc415e936c88fc2f62e60a4378139c9b2
FumihisaKobayashi/The_self_taught_python
/3_section/3_12.py
245
3.984375
4
x = 100 #複数の条件指定の組み合わせ。 if x == 10: print("10!") elif x == 20: print("20!") else: print("わかりません") if x == 100: print("100") if x % 2 ==0: print("偶数") else: print("偶数")
c1a1079343de6f4d6ad36bd3c5ec080577049df1
FumihisaKobayashi/The_self_taught_python
/3_section/3_6.py
108
3.53125
4
x = 10 y = 10 #定数に1の値を足す。 print(x + 1) #省略形のやり方、+=,-= y -= 1 print(y)
27552b171ed6980dac3fe50f73a773b5b81dee44
FumihisaKobayashi/The_self_taught_python
/pra1/24.py
194
3.703125
4
def if_test2(num): if 50 < num < 100: print('50 < num < 100') else: print('num <= 50 or num >= 100') if_test2(70) # 50 < num < 100 if_test2(0) # num <= 50 or num >= 100
1119c570f8472c305f39623855802ad377e53673
FumihisaKobayashi/The_self_taught_python
/12_section/12_a.py
459
3.6875
4
class student: def __init__(self, name, age, gender): self.name = name self.age = age self.gender = gender #他で開くときに実行(表記されないようにする。) if __name__ =="__main__": student = student("fumihisa", "24", "man") #インスタンスがクッキー、 CLASSがクッキーの型の例。classのなかに情報入れていく, #辞書と違うところは、参照できるところ。
1f47c085c1210c684078554ecf17a9e8ad5cf11f
FumihisaKobayashi/The_self_taught_python
/3_section/3_c5.py
224
3.90625
4
age = 27 if age <= 12: print("小学生の年齢") elif age <= 15: print("中学生の年齢") elif age <= 18: print("高校生の年齢") else: print("大人と判断してよろしいでしょう!")
174a04ae3e880d7d1fa2ad20c8a4a8018d8aff88
FumihisaKobayashi/The_self_taught_python
/7_section/7_c3.py
226
3.8125
4
a = ["ウォーキング・テッド", "アントラージュ", "ザ・ソプラノズ", "ヴァンパイア・ダイアリーズ"] for index, a in enumerate(a): print(index) print(a) #数値表記index, enumerateで
cbee9a90e5f7ce867a86b5352ab9b2d2fd48214d
guidorombola/EDD-UNTREF
/Practica 1/ej3-punto6.py
449
3.59375
4
#Extrae una palabra de un texto y la almacena en una variable def extractor(texto, palabraDeseada): longitud = len(palabraDeseada) posicion = texto.find(palabraDeseada) if posicion < 0: return "La palabra no se encuentra en el texto" else: extraccion=texto[posicion:posicion+longit...
c40539bc336325174596a1eb4cfa323b69a4158d
guidorombola/EDD-UNTREF
/Practicas-Parciales/segundo-parcial/parcial-23-11-15/Ejercicio3.py
1,587
3.5
4
from lxml import etree '''Dado el documento 'recetario.xml' Escribir las siguientes consultas:''' arbol = etree.parse("recetario.xml") #1) Todas las recetas en la categoría Pescado que tengan Vino blanco como ingrediente; a = arbol.xpath("//receta[categoria='Pescado']/ingredientes[ingrediente='Vino blanco']...
b82771cfce19c056d915f8443f62e1b6a3e269bd
guidorombola/EDD-UNTREF
/Practica 4/Ejercicio1.py
3,238
3.640625
4
import csv import natsort def leer_csv_old(ruta): archivo = open(ruta, "r") lector = csv.reader(archivo, delimiter=";") lista = list(lector) dicc = {} for reg in range(1,len(lista)): clave = lista[reg][-1] dicc[clave] = {"Total": 0, "Barrios": None} #Inicia...
583db232a730a53b45be471145a28889dc379c8c
cb0n3y/python3
/python_crash_course_2/chapter_05_if_statement/amusement_park.py
394
3.921875
4
#!/usr/bin/python3 age =12 # First way to make the if-statement # # if age < 4: # print("Your admission cost $0.") # elif age < 18: # print("Your admission cost $25.") # else: # print("Your admission cost $40.") # Second way to make the if-statement # if age < 4: price = 0 elif age < 18: price = 25 elif age < 6...
32bff2af3b91acdf26e7e1cf6eea1d080fa1c3ee
Aadyaghumre/Aadya-python
/Python Task sheet 1 - Task 4.py
266
4.1875
4
""" Code to store 2 values in variables 'num1' and 'num2' and print the remainder of division of num1 and num2. """ num1 = 78 num2 = 5 #Use of Modular division. Modulo= num1 % num2 print("The remainder of division of num1 and num2= " + str(Modulo))
5abd3b4a447936ed7a8700359de358e3c03c8f23
Aadyaghumre/Aadya-python
/Python Tasksheet 1- Task 10.py
445
4.28125
4
""" Program to take input as Friend's name and if the name is 'Sheela' , then print 'She is my best friend.' If the name is Rina, then print, I know her and if any other name is found, print I don't know her/him ' """ username = input("Enter friend's name: ") if username == "Sheela": print("She is my...
fd4624caa67a00206fa4d3cc16c78c7a15ec252d
shouryaraj/base64Decoder
/base64Decoder.py
2,361
3.6875
4
""" Name: Shourya Raj Email: sraj0008@student.monash.edu """ class coder: def __init__(self): # Initializing the values of the standard Encoded characters letters = "".join([ "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", "0123456789+/", ])...
65810a57a94f394cf514913d39ef5e4fe074326b
ManinderpreetPuri/Python_programs
/temp(1).py
8,186
4.25
4
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ # Task 1: # ============================================================================= # Minimum of Two Numbers: Write a program that reads two integers and prints out # the Minimum fn = int(input('Enter first number =')) s...
7d690af0578d2dac18ef208f73b3ae96e05ee692
AdamMC-GL/AdamMC
/opdracht11-AI.py
289
4.03125
4
string1 = input('Geef een tekst: ') rotation = input('Geef een rotatie: ') newstring = '' for letters in string1: if letters not in '.,? \'''!``""': newstring += chr(ord(letters) + int(rotation)) else: newstring += letters print('Ceasarcode: '+newstring)
966eb0c4db9cff9197f37f7c63c3411262c0d173
AdamMC-GL/AdamMC
/opdracht4 -AI.py
187
4.0625
4
string = 'lepel' stringreverse = string[::-1] if stringreverse == string: print('Het woord ' + string + ' een palindroom') else: print('Het woord ' + string + ' geen palindroom')
664f38d82acbe179d875712ec5ef9a026fe8591d
Selvapeace/python-introduction-turtle-myNote
/课时2/2.py
159
3.734375
4
temp=input("which number?") guess=int(temp) if guess==8: print("6666666666") print("but no prize") else: print("you're wrong!") print("game over")
3a39462a9c4099b5b78687e2a540edb6c09db3d8
Selvapeace/python-introduction-turtle-myNote
/课时4/1.py
455
3.953125
4
import random num = random.randint(1,10) temp=input("which number?") guess=int(temp) if guess == num: print("6666666666") print("but no prize") else: n=0 while guess != num and n < 3: if guess < num: temp=input("the true number is bigger") guess=int(temp) n=n...
83c29e2a98942839c0d93fa4cff8eb31d0b2b33e
Selvapeace/python-introduction-turtle-myNote
/课时4/课后题/3.py
206
3.96875
4
# method 1 num = int(input("please input a integer")) num1 = num+1 for i in range(1,num1): print(i) # method 2 num = int(input("please input a integer")) i = 1 while i <= num: print(i) i += 1
486e4a5d09b2215189b5c6792353481c0872fa5e
Shweta2013/InfyTQ-Exercises-And-Assignments
/PROGRAMMING FUNDAMENTALS USING PYTHON/Day 4/#PF-Assignment-29.py
391
3.703125
4
#PF-Assgn-29 def calculate(distance,no_of_passengers): #Remove pass and write your logic here mileage=10 amount=(no_of_passengers*80)-(distance/mileage)*70 if(amount<0): return -1 else: return amount #Provide different values for distance, no_of_passenger and test your program dis...
2b6aed474bfc332f735416248d756f5644c3c0a0
Shweta2013/InfyTQ-Exercises-And-Assignments
/PROGRAMMING FUNDAMENTALS USING PYTHON/Day 6/#PF-Assgn-42.py
1,271
4.0625
4
#PF-Assgn-42 sum_of_factors=0 def find_factors(num): #Accepts a number and returns the list of all the factors of a given number factors = [] for i in range(2,(num+1)): if(num%i==0 and is_prime(i,i/2)): factors.append(i) return factors def is_prime(num, i): #Accepts the number ...
4398095d64deec02713b69491bcbfca0ba821083
Shweta2013/InfyTQ-Exercises-And-Assignments
/PROGRAMMING FUNDAMENTALS USING PYTHON/Day 5/#PF-Assgn-39.py
1,064
3.90625
4
#PF-Assgn-39 #This verification is based on string match. #Global variables menu=("Veg Roll","Noodles","Fried Rice","Soup") quantity_available=[2,200,3,0] '''This method accepts the item followed by the quantity required by a customer in the format item1, quantity_required, item2, quantity_required etc.''' def ...
329c859953040eafe827832bb9379c5f8221af29
Shweta2013/InfyTQ-Exercises-And-Assignments
/PROGRAMMING FUNDAMENTALS USING PYTHON/Day 7/#PF-Assgn-48.py
1,034
3.65625
4
#PF-Assgn-48 def find_correct(word_dict): CORRECT=0 ALMOST_CORRECT=0 WRONG=0 list_of_answers=[0,0,0] #start writing your code here for key in word_dict: if(key==word_dict[key]): CORRECT+=1 list_of_answers[0]=CORRECT else: if(len(...
879ae809b1757ddc6aae8ef1ab0e14b7d63ddd37
Shweta2013/InfyTQ-Exercises-And-Assignments
/PROGRAMMING FUNDAMENTALS USING PYTHON/Day 7/#PF-Assgn-50.py
429
3.828125
4
#PF-Assgn-50 def sms_encoding(data): #start writing your code here splitted_data=data.split() consonents="" for word in splitted_data: if len(word)==1: consonents+=word for letter in word: if letter not in "aeiouAEIOU": consonents+=letter ...
fd11ccaec9568f53a832425525fda44041871f39
KookieMeister/Python-Challenges
/reverseString.py
652
4.53125
5
#!/usr/bin/python #by Kris Downs KookieMeister #Reverse a string the hard way inputstring=raw_input("Please enter a string to reverse: ") reversedstring = "" lettersInInput=[] reversedLetters=[] inputLength=len(inputstring) print inputLength for each in inputstring: lettersInInput.append(each) reversedLetter...
baef017e6c617b466390505a5009bd07e85eaf5c
kiritorl/demo20210802
/day10/demo06_matplotlib_multi.py
393
3.59375
4
import matplotlib.pyplot as plt import numpy as np x = np.arange(1, 13) y1 = np.random.randint(1, 100, size=(12,)) y2 = np.random.randint(1, 100, size=(12,)) y3 = np.random.randint(1, 100, size=(12,)) y4 = np.random.randint(1, 100, size=(12,)) plt.plot(x, y1, c="r", label="a") plt.plot(x, y2, c="b", label="b") plt.pl...
94cc23c4b7597aebdfdac4bf8cbed71c260de9d6
kiritorl/demo20210802
/day01/demo04_identifier.py
652
3.515625
4
class Person(object): def __init__(self): self.__name = None # NULL pass pass name = 'zhang' name1 = "zhang1" name2 = '''zhang nb nnn ! sdffad!''' ''' 三个单引号或三个双引号 多行注释 或者多行字符串定义 ''' print('1234', '12', '234', sep="-", end="***") print('1234', '12', '234', sep="-", end="\n") # sep分隔符end结束符默认...
962149a7afccf5f16aa355b6afd2b35b463cac39
iegorman/py-tabletext
/tabletext/gencolumndef.py
7,728
3.8125
4
#!/usr/bin/env python3 # Copy a column definition, replacing blanks by defaults. # Defaults to CSV format, can be used for other delinited text formats. """ Copy a column definition, replacing blanks by defaults. Can be used to create an initializer for table.Column(). Requires an object that reads lists of strings...
11a9b0daed570933f48c47bc80e5dca5d0da251d
iegorman/py-tabletext
/tabletext/gencode.py
9,444
3.71875
4
#!/usr/bin/env python3 # Create code template for application that uses table.Column. """ Create code template for application that uses table.Column. Input comes from an object with an iterator that provides a string upon each call to __next__. Output goes to an object with a writerow method that accepts a list of ...
a8c967fc88db629b62e2e72751873a32177931a5
Vaish-922/Python-ISTE-SMP
/Week 3_Assignment/Q4.py
118
3.796875
4
str =input("Enter a string: ") x=0; word = "are" for i in str.split(): if i == word: x+=1 print(x)
ceb171e7925ff85ad68fe677b75ab2d97a5dfb19
wi7a1ian/python-lab
/AI/multilayer_perceptron.py
6,413
3.8125
4
''' Created on 19-03-2012 @author: WZ ''' from neural.activation_functions import * import random import math class WeightInitializeMethod: """Enumeration type for weight initialization method.""" RANDOM_INIT = "RANDOM_INIT" ZERO_INIT = "ZERO_INIT" class MultilayerPerceptron(object): ''' Simple multilayer perc...
43fe0528217175a1741aa141abc5652145ea18fb
duarte28nm/SR1
/MMC/cliente.py
2,229
3.609375
4
# client.py import socket from tkinter import * def enviar(): # criar um objeto de soquete s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # obter o nome da máquina local host = socket.gethostname() port = 9999 # conexão com o nome do host na porta s.connect((host, port)) print...
71dc2c0fd173bfbb84fe84a5b6eb3143ce732593
timurgen/proteus-svg
/proteus_lib/color_utils.py
2,053
3.53125
4
""" utility functions to manipulate color values """ from typing import Tuple import math import xml.etree.ElementTree as XMLParse from operator import itemgetter from proteus_lib.proteus_utils import ensure_type def rgb_to_hex_string(red: int, green: int, blue: int) -> str: """ function to convert RGB values...
0ee0ce03ac83f6443b6decca6565151630c11c28
eriksandgren/AdventOfCode2015
/day02/day2.py
850
3.59375
4
#!/usr/bin/env python import sys def parseInput(): with open ("input.txt", "r") as myfile: myInput = myfile.read() myInput = myInput.split('\n') return myInput def part1(): my_input = parseInput() amount_of_paper = 0 for inpi in my_input: l, w, h = [int(x) for x in inpi.split(...
eb165a90ce0596ef09d8f7256351478849087b7e
jlcoto/der_die_das
/noun_game.py
5,186
3.5625
4
import pandas as pd import random import datetime import os.path import time import reporting import grapher_gen_results class Gender_guess: """"Implements the main game. A word in German is chosen and the user is asked for the gender.""" def __init__(self, csvfile): """Takes csv values that contains ...
e610b8e860bf45d2f8b66a937f67920ed9626ebb
Franktian/Algorithms
/mergeSort.py
974
3.984375
4
def mergeSort(alist): if len(alist)>1: mid = len(alist)//2 lefthalf = alist[:mid] righthalf = alist[mid:] mergeSort(lefthalf) mergeSort(righthalf) merge(lefthalf, righthalf, alist) def merge (x, y, merged): ''' Merge two integer list by d...
efac3052fd93857752843a1142a02659f002afd0
firer1946/firer1946
/py/string.strip.py
228
3.546875
4
a = raw_input() def splitspace(x): flat1 = 0 flat2 = 0 for i in a: if i == ' ': flat1+=1 else: break for i in a[-1:-1]: if i == ' ': flat2 += 1 else: break print a[flat1:len(a) - flat2] splitspace(a)
2c511d2a41233f4948e003da9d6428802a838f96
Vrynus/Currency_Converter-GUI-
/currencies.py
2,665
3.703125
4
import requests import json import tkinter from tkinter import Entry #request exchange rate info and convert strings into floats req = requests.get('https://api.exchangeratesapi.io/latest') rate_info = json.loads(req.text) rates = rate_info['rates'] rate_try, rate_usd = float(rates['TRY']), float(rates['USD']) #crea...
200a1e1bf55c770c562b46d2ba778c8619bbd156
zhangboz/learn-coding
/python/A2/del.py
469
3.65625
4
import sqlite3 database = sqlite3.connect("storage.db") print("What do you want to delete?") victim = input() result = database.execute("SELECT left, right FROM proofs;").fetchall() length_i = len(result) results = database.execute("DELETE FROM proofs WHERE left='"+ victim +"' OR right='"+ victim +"';") result = datab...
42f082518c7e2f9fe0c500908ffa1f7e9df6f27b
X-KG-X/summer2019
/Stack2_python/python_stack/python/fundamentals/20190805/Assignments/functionsIntermediate2/functionsIntermediate2.py
2,969
3.828125
4
# 1. Update Values in Dictionaries and Lists x = [ [5,2,3], [10,8,9] ] students = [ {'first_name': 'Michael', 'last_name' : 'Jordan'}, {'first_name' : 'John', 'last_name' : 'Rosales'} ] sports_directory = { 'basketball' : ['Kobe', 'Jordan', 'James', 'Curry'], 'soccer' : ['Messi', 'Ronaldo', 'Rooney'...
fed28d3e5102cddbae3121a0bf068a697e9b3bbe
carlos2020Lp/progra-utfsm
/guias/2014-1/mayo-28/metro/dibujar_red.py
2,025
3.5
4
from turtle import * from time import sleep from metro import coordenadas, estaciones, colores from figuras import * def lineas_a_las_que_pertenece(est): ls = set() for L in estaciones: if est in estaciones[L]: ls.add(L) return ls def es_estacion_terminal(est): for L in estaciones:...
a84ced570458cce317d72292dbfa04716394b0a0
carlos2020Lp/progra-utfsm
/certamenes/certamen-1-tipo/triangulos/pauta2.py
357
3.984375
4
a = float(raw_input('Ingrese a: ')) b = float(raw_input('Ingrese b: ')) c = float(raw_input('Ingrese c: ')) if a > b + c or b > a + c or c > a + b: print 'No es un triangulo valido' elif a == b == c: print 'El triangulo es equilatero' elif a == b or b == c or a == c: print 'El triangulo es isoceles' else: ...
dc9c94d65995a19093ad5e9c0516b40ce4f538db
carlos2020Lp/progra-utfsm
/guias/2014-1/marzo-19/tabla/pauta.py
97
3.578125
4
n = int(raw_input('Ingrese un numero: ')) for i in range(1, 11): print n, 'x', i, '=', n * i
66493a401c5e48c810d7eb9f152aea23eb685839
carlos2020Lp/progra-utfsm
/controles/2011-1-control-en-linea-3/c_pauta.py
263
3.515625
4
def cuenta_digito(d, n): c = 0 while n > 0: ultimo = n % 10 if ultimo == d: c += 1 n /= 10 return c def siguiente_con_digitos(d, c, m): n = m + 1 while cuenta_digito(d, n) < c: n += 1 return n
d4958f2b970c8446a3217c502f17ffc1ef0d59be
carlos2020Lp/progra-utfsm
/controles/2012-1-presencial-1/miercoles-3-4.py
447
3.765625
4
print 'Jugador A' a1 = int(raw_input('Carta 1: ')) a2 = int(raw_input('Carta 2: ')) print 'Jugador B' b1 = int(raw_input('Carta 1: ')) b2 = int(raw_input('Carta 2: ')) if abs(a1 - a2) == 1 and abs(b1 - b2) == 1: print 'Empate' elif abs(a1 - a2) == 1: print 'Gana A' elif abs(b1 - b2) == 1: print 'Gana B' e...
ad9ac7fc98b050121671dab471c8b4e75e1575eb
carlos2020Lp/progra-utfsm
/diapos/programas/parabola.py
407
3.671875
4
from numpy import * from numpy.linalg import solve print 'Ingrese coordenadas x y de tres puntos' m = zeros((3, 3)) ys = zeros(3) for i in range(3): linea = raw_input('P{0}: '.format(i + 1)) x, y = map(float, linea.split()) ys[i] = y for j in range(3): m[i, j] = x ** (2 - j) abc = solve(m, ys...
0e30679b4bbdb255c174f5d32fbfdb18978cd1be
carlos2020Lp/progra-utfsm
/tareas/2012-2/tarea-1/t1-facil.py
376
3.65625
4
from turtle import * title('Laberinto') shape('turtle') color('navy') width(2) speed('slowest') f = 30 raw_input() ruta = raw_input('Ruta: ') n = len(ruta) for i in range(n): d = ruta[i] if d == 'E': seth(0) elif d == 'N': seth(90) elif d == 'O': seth(180) elif d == 'S': seth(270) forward(f...
0a6699a2b60c382977b04a4f520e2db5dc960168
carlos2020Lp/progra-utfsm
/diapos/programas/promedio-aprobado.py
255
3.640625
4
n1 = int(raw_input('Nota 1: ')) n2 = int(raw_input('Nota 2: ')) n3 = int(raw_input('Nota 3: ')) suma = n1 + n2 + n3 promedio = int(round(suma / 3.0)) if promedio < 55: print 'Usted reprobo con', promedio else: print 'Usted aprobo con', promedio
cc143f1a531a9bd47ab915eae9c17e00be17e30e
carlos2020Lp/progra-utfsm
/guias/2012-2/octubre-8/soluciones.py
130
3.5625
4
def contar(valores): d = {} for x in valores: if x not in d: d[x] = 0 d[x] += 1 return d