blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
16536cf46489bf809059db5670363aa620bf66c9
cielliyuanpeng/learn_Python_in_hard_way
/ex3.py
198
3.5625
4
print("I m counting my chickens") print("hens",25) print("Rooster",100-75%4) print("Now i will count my eggs") print(3+2+1-5+4%2-1/4+6) print("Is that true?3+2<5-7") print(3+2<5-7) print(5+3*5%3)
9cd467c15625206ce18e3022ddb764aa191e2934
cielliyuanpeng/learn_Python_in_hard_way
/ex31.py
1,850
3.890625
4
while True: door = input(""" 你从黑暗中醒来 此时,你身处一个幽暗的房间之中,你的面前有两扇门。\n 一扇门上是白底黑字的生,另一扇门上是黑底白字的死\n 请问您选择进入哪一间?\n 1.生门 2.死门 """) if door == "1": print(""" 你推开生门,进入其中 发现是一片阳光明媚的草地 草地上鲜花盛开,阳光和煦,微风习习 不远处仿佛有一口水井,一位朴素打扮的妇人正在打水 此时,她也看到了你 请问要和他打招呼吗? 1. 打招呼 2.视而不见 ...
18fdc6a1c2bdfeab6324ac1652cfc87618a7f7a9
KamrulSumon/Python
/Academic/Python/Assignments/#4/Code/1.py
2,594
4.53125
5
#Classes are created by an executable compound statement, class. It consists of two parts: #1. a header that names the class to create, and (optionally) its superclasses #2. a body that specifies the class's initial content class Trivial: pass #as a class, Trivial has a unique (if uninteresting) id print('T...
db0980a9405c9c5efa2875e5ca484fa0d29942c5
KamrulSumon/Python
/Academic/Python/Random/16.py
2,790
3.71875
4
from abc import ABCMeta, abstractmethod class Pizza(object): def __init__(self, toppings): self.toppings = toppings for t in self.toppings: assert isinstance(t,Topping), "bogus" def show_topping_names(self): def get_name(t): return t.get_name() ...
d250fcc6d41d6d512a1c1813182b6222ebfa8c17
KamrulSumon/Python
/Academic/Python/Assignments/#4/Code/15.py
2,307
3.765625
4
import abc class Pizza(object): def __init__(self, toppings): self.toppings = toppings for t in self.toppings: assert isinstance(b,Topping), "This is a bogus topping choice, please choose another" def show_topping_names(self): def get_name(t): ...
eb16cf3d54202fff8bcf5217788f2f9cd4d0d158
Renan-Frota/Logicadeprogramacao
/prova2.py
952
4
4
#Exercicio 1 def exercicio_1(): list = [] soma = 0 while len(list) < 3: list.append(int(input ("Isira nota: ") )) for number in list: soma += number media = soma/3 return(f"A nédia do aluno sera: {media}") #Exercicio 2 def exercicio_2(n): lista = [] while len(lista) != ...
5de29e5ef50e7667e2cea83c88a2e3913a42a956
ryanlkraemer/RK-engineering-class
/Euler Problems/euler41.py
212
3.5
4
# question 41 #123456789 numbers = [] #numbers2 = [] for x in range(1234, 4321, 2): numbers.append(x) #for x in numbers: # if (x % y) == 0: # numbers2.append(x) print(numbers) #print(numbers2)
162a35035382273d11195750b69aa587aeb576d1
ryanlkraemer/RK-engineering-class
/LearningPythonTheHardWay/ex33.py
295
4.21875
4
numbers = [] def whilee(x, y, z): while x < y: print(f"At the top x is {x}.") numbers.append(x) x += z print(f"Numbers now: {numbers}") print(f"At the bottom x is {x}.") whilee(3, 10, 2) print("The numbers: ") for num in numbers: print(num)
df0c6ad6c806c499f91409b9db86f8e6057bd1d6
ryanlkraemer/RK-engineering-class
/LearningPythonTheHardWay/ex8.py
372
3.578125
4
formatter = "{} {} {} {}" print(formatter.format(2,1,4,3)) print(formatter.format("one", "two", "three", "four")) print(formatter.format(True, False, False, True)) print(formatter.format(formatter, formatter, formatter, formatter)) print(formatter.format( "And now I", "will let her go", "because she", "will nev...
f759ff5114cf635d00af9dc324d1aa8adc1a4bc6
riley-csp-2019-20/final-exam-semester-1-blake82866
/final_[BA].py
7,957
3.96875
4
#2019-20 Fall Computer Science Principles Final Exam #Ms. Haubold #Name # Blake Allison #Date # 12/19/19 #make instructions import turtle turtle.penup() turtle.ht() turtle.goto(-475, 375) turtle.write("up, down, left, and right move as expected.", font=("Arial", 25, "bold")) turtle.goto(-475, 350) turtle.write("Sp...
a65a5fe2737f2506964095d71631ff9e74b89d51
cjreynol/willsmith
/agents/displays/human_display.py
1,172
3.828125
4
from tkinter import Button, Entry, Label, END from willsmith.gui_display_controller import GUIDisplayController class HumanDisplay(GUIDisplayController): """ Creates a Tkinter GUI that allows the user to input their moves. """ WINDOW_TITLE = "Human Agent" LABEL_FONT = ("Courier New", 14) ...
3a852de075893374124e0409ae8284e3d6cce254
lohchness/time-calculator
/time-calculator.py
3,651
3.921875
4
start = "" duration = "" startingday = "" def day_of_week(x): return { "Monday": 1, "Tuesday": 2, "Wednesday": 3, "Thursday": 4, "Friday": 5, "Saturday": 6, "Sunday": 7, }[x] def day_of_week_numkey(x): return { 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "T...
f5f2b5857770d3897489dd4119a2a7832ebbfbae
A01747755/Mision-09
/Mision_09.py
2,778
3.90625
4
#Autor: Víctor Manuel Rodríguez Loyola #Misión 09 def extraerPares (lista): #Recibe una lista y crea una nueva extrayendo los valores pares de la lista original. listaPares=[] for pares in lista: if pares %2==0: listaPares.append(pares) print(listaPares) def extraerMayoresP...
fcf38b3dbf6eafda1ba4639b44ed38c3de81c185
lee-alexander/TowelRTP
/fta-client.py
6,057
3.71875
4
""" This is a client for the FTA Networking protocol assignment. This file should be run via command line with the following arguments: X: the port number at which the fta-client's UDP socket should bind to (even number) A: the IP address of NetEmu P: the UDP port number of NetEmu Example: python fta-server X A P "...
71171b4b65f0f3cbe3bb514296f4875612429a38
ozkanyildirim/IBM_AI_Workflow
/comparing-snowfall.py
385
3.796875
4
#!/usr/bin/env python import pandas as pd ## read in the data df = pd.read_csv("./snowfall.csv") ## subset the data to only the states of interest df1 = df[df['state'].isin(['CO','UT','VT'])] ## create a pivot that looks at the specific data we are interested in df1_pivot = pd.pivot_table(df1, values='snowfall', in...
63bd6cc2c3ff874db163be69c34e6845e970dd7b
andrenaq/Python
/Python_Classes/Weeks/w5/example02.py
415
3.734375
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 23 09:04:10 2017 @author: andre """ totalHours = float(input("How many hours do you work: ")) hourlyWage = float(input("What is your hourly wage: ")) if totalHours <= 40: totalWages = hourlyWage*totalHours else: overtime = totalHours - 40 totalWage...
e665189bf4cda276e04e3d428fab5099fb987c9c
andrenaq/Python
/Python_Classes/Weeks/w4/dict6.py
221
4.09375
4
list = {'Nabil':16,'Tanya':19} search = int(input('enter the age you search for')) print (list.items()) for name, age in list.items(): if age == search: print (name) break else: print ('key is not found')
bb3dfbea011f4ab2d192d0e1ccd1a5d4546d8298
andrenaq/Python
/Python_Classes/Weeks/w2/four.py
302
3.796875
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 25 09:49:15 2017 @author: andre """ instructor = input("Enter the prof's name: ") subject= input("Enter the subject name: ") term = input("Enter the term: ") format= '{} will teach {} in {} . ' print(format.format (instructor,subject,term))
c279d748a91e757f3cedb826c0061790975a4578
andrenaq/Python
/Python_Classes/Weeks/w6/example 01.py
325
3.9375
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 30 08:35:32 2017 @author: andre """ limit = 1000; interest = 0.1 balance = float(input('enter a balance: ')) while balance < limit: balance = balance +balance * interest print('the balance is now: ',balance) else: print('balance is greater then limi...
c82365d7fe197c6205e222186faed35666bf6b65
andrenaq/Python
/Python_Classes/Weeks/w3/examples05.py
765
4.09375
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 2 09:28:34 2017 @author: andre """ myTuple = ('hello', 'October', 2016, 'it', 'is', 'now, 21.5' ,'Celsius' ) mySubTuple = ('October', 2016, 21.5) print (myTuple) # Prints a complete tuple print (myTuple[2]) # Prints the first element of the tuple print (myTup...
1180aedf2813b5dbaf0b76da04485ba15d893f02
andrenaq/Python
/Python_Classes/Weeks/w4/tup1.py
588
3.71875
4
import math mytup= (8,'good','soccer', 37.5,'player',9,) mytup2= ('beginner', 7,'car', 44, 'driver',12) mytup3= (4, 5, 0, 9) mytup4= ('a','ab','c','cc') mytup5= (4, 5, 70, 9) mytup6= ('a','ab','c','cc','kk') mytup7=(99,) print(mytup7) print (mytup[1:3]) print (mytup2[2:]) print (len(mytup)) print (mytup + m...
770af538777f4f15fa9ec45900daf8e8170842aa
andrenaq/Python
/Python_Classes/Weeks/w2/simpleFormat.py
185
3.734375
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 25 10:22:06 2017 @author: andre """ student = input('Enter our name: ') greeting = 'Hello, {}!'.format(student) print(greeting)
f8ba2846d159db3d638b41d33a0755edf5696885
andrenaq/Python
/LabTests/Labtest01-AndreQueiroz/Question02 -AndreQueiroz.py
309
3.8125
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 16 09:49:00 2017 @author: andre """ a = "andre" b = "bruno" c = "carlos" d = "debora" e = "eduardo" friends = [a,b,c] friends.append(d) friends.append(e) friends.remove(friends[3]) friends.remove("bruno") friends.pop() friends.append([b,d,e])
fc08135bf2df3cb170da1134590d65ad1e52ac0a
dhikanime2/learningpython
/Cargame.py
725
3.96875
4
print('Type "help" for how to play') command = "" started = False while True: command = input('>').lower() if command == "start": if started: print('car already started!') else: started = True print('car started..') elif command == "stop": if not...
aa77a20f681424fc4aba7e5b012b415f9d7e8490
ucodehackathon/noname-ucode19
/Proyect/graficos.py
2,309
3.53125
4
# Importamos los módulos necesarios import math import numpy as np from matplotlib import pyplot as plt import sys #Comprobamos los argumentos if(len(sys.argv) > 3): print ("El nombre del programa es: " + sys.argv[0]) print ("El fichero de Acciones se llama: " + sys.argv[1]) print ("El fichero de Clicks se...
242b9bbad9c2f93dc2042eaf9ff531b6441ffe81
oliang2000/cmsc122group
/ui/Stats.py
6,359
3.53125
4
# statistical correlation scores #https://github.com/pushshift/api #https://github.com/dmarx/psaw #https://campus.datacamp.com/courses/visualizing-time-series-data\ #-in-python/work-with-multiple-time-series?ex=9 import datetime as dt import pandas as pd from datetime import date, timedelta from scipy.stats.stats ...
695ad78a117067c96e4c81721363f4d9386b3d2b
namntran/modern_python3_bootcamp
/Loops/while.py
276
3.96875
4
# msg = input("what's the secret password? ") # while msg != "bananas": # print("guess again") # msg = input("what's the secret password? ") # print("that's correct!") # for num in range(1,11): # print(num) num = 1 while num <= 10: print(num) num += 1
53ce2d2262d5587a39cd6266968987f11fe3d78f
namntran/modern_python3_bootcamp
/VariablesandStrings/concatenation_format_strings.py
208
4.25
4
#Python3 => F-Strings (formatting strings to interpolate variables) guess = 8 print(f"your guess of {guess} was incorrect") name = "Pebbles" print(f"nice try, {name} but your guess of {guess} is incorrect")
545a3bad558e3b220e24a64d99c98a0035d86eb1
namntran/modern_python3_bootcamp
/BooleanandConditionalLogic/logicalNot.py
465
4.125
4
age = int(input("What is your age?")) # age 2-8 years is $2 tickets # age 65 years + is $5 tickets # everyone else is $10 tickets if not ((age >= 2 and age <= 8) or age >= 65 or age <2): print("you pay $10 dollars and not entitled to discount") elif age >= 65: print("you pay $5 and are entiled to senior discou...
7b7245e22295f9ee7a0a68587712ac7b3dcaf13d
bingely/PythonLearning
/函数/递归函数.py
183
3.59375
4
#!/usr/bin/env python # -*- coding:utf-8 -*- def fact(n): if n == 1: return 1 return n * fact(n - 1) print(fact(1)) print(fact(2)) print(fact(100)) print(fact(199))
84b3d6555ac2ac5381ae2caef10922ebb72ffa56
bingely/PythonLearning
/面向对象/访问限制.py
431
4.03125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # 如何做到可以访问另外一个文件里面的类 class Student(object): def __init__(self, name, age): self.__name = name self.__age = age def get_name(self): print("this is age"+self.__name) def get_age(self): print(self.__age) # 为啥不能添加str st = Stud...
771fafc6ace9d474689d73ef48d4a89a67e8a64e
DarkCron/PythonBvP
/Oefenzitting 7/Ex9B.py
1,043
3.84375
4
def count_paths_amount(x,y): if x == 0 and y == 0 : return 1 if x > 0: if y > 0: return count_paths_amount(x-1,y) + count_paths_amount(x,y-1) else: return count_paths_amount(x - 1, y) else: return count_paths_amount(x,y-1) path = [] def count_paths(...
461aa4f8f58ab82389e524870703f67abe6f21f2
DarkCron/PythonBvP
/Oefenzitting2/LeapYear (P3-27).py
554
4.0625
4
year = int(input("Enter the year you wish to check: ")) bIsLeap = False bIsDivisableBy4 = year % 4 == 0 bIsDivisableBy100 = year % 100 == 0 bIsDivisableBy400 = year % 400 == 0 bIsYearAfter1582 = year >= 1582 if bIsDivisableBy4: if bIsDivisableBy100: if bIsDivisableBy400: bIsLeap = True ...
05d6dcd6481401c467d8883619d9258688366aa6
DarkCron/PythonBvP
/Oefenzitting 7/Ex9A.py
280
3.703125
4
def count_paths(x,y): if x == 0 and y == 0 : return 1 if x > 0: if y > 0: return count_paths(x-1,y) + count_paths(x,y-1) else: return count_paths(x - 1, y) else: return count_paths(x,y-1) print(count_paths(2,1))
a898e4e887c2866a6c2aa17e2f5b42fa76b370be
DarkCron/PythonBvP
/Oefenzitting1/6-5OmzettingVanSeconden.py
426
4.15625
4
seconds = int(input("Time in seconds: ")) SECONDS_IN_MINUTES = 60 SECONDS_IN_HOUR = 60*60 SECONDS_IN_DAYS = 24 * 60 * 60 days = int(seconds // SECONDS_IN_DAYS) seconds %= SECONDS_IN_DAYS hours = int(seconds // SECONDS_IN_HOUR) seconds %= SECONDS_IN_HOUR minutes = int(seconds // SECONDS_IN_MINUTES) seconds %= SECO...
71a49efacd41108e6aea73862d7c2096f292f8a1
DarkCron/PythonBvP
/Oefenzitting1/6-6Cartesische.py
240
4.3125
4
import math x = float(input("Enter the x-coordinate: ")) y = float(input("Enter the y-coordinate: ")) r = math.sqrt(math.pow(x,2)+math.pow(y,2)) theta = math.degrees(math.atan(x/y)) print("The radius is: ",r) print("Theta is: ",theta)
778c7c84f5792a85d075531b80cde6d4a5173c8a
DarkCron/PythonBvP
/Oefenzitting 6/Q3.py
1,746
4.15625
4
# Use the function in Question 2 to write a program that builds word vocabulary from a se- # quence of texts. The program should have a loop allowing the user to type texts. The loop # finishes when user types “QQQ". Whenever the program reads a text, it updates the vocabu- # lary, then prints the new vocabulary size...
304dd6887206b0ed8b34f2708cd5fd060cc947a4
DarkCron/PythonBvP
/Oefenzitting1/Extra/P2-8p81.py
330
4.21875
4
import math w = int(input("Rectangle width: ")) h = int(input("Rectangle height: ")) rect_area = w * h; rect_perimeter = w*2 + h*2; rect_diagonal = math.sqrt(math.pow(w, 2) + math.pow(h, 2)) print("Rectangle area: %.2f, Rectangle perimeter: %.2f" % (rect_area,rect_perimeter)) print("Rectangle diagonal: %.2f" % rect...
19d470cbc16fbf19f6c18eea963555234a9e075d
abhishekbiswas47/DSA-Solution
/Day1/Permutation.py
864
3.515625
4
import os def permutation(permi): if len(permi) == 0: return [] if len(permi) == 1: return [permi] l = [] for i in range(len(permi)): m = permi[i] rempermi = permi[:i] + permi[i+1:] for p in permutation(rempermi): l.append(...
91c60baa6997ccedda2c06c3d7c23c174e82358c
finaclemence15/PasswordLocker
/credential_test.py
3,489
3.796875
4
import unittest from credential import Credential class TestCredential(unittest.TestCase): ''' Test class that defines test cases for the Credential class behaviours. Args: unittest.TestCase: TestCase class that helps in creating test cases ''' def setUp(self): ''' ...
651dabd7291dbc156abd3afc4c5324e88d19eda5
mengi/pro-lang
/pro-lang/Piton/yarilari_topla.py
406
3.765625
4
#!-*- coding:utf-8 -*- def yarilari_topla(sayi): toplam = 0 sayac = 0 if type(sayi) == int: if sayi == 0: print "lütfen bir tamsayi giriniz" elif sayi < 0: print "lütfen bir tamsayi giriniz" elif sayi > 0: x = sayi while sayi >= 0.1 and sayac != x: sayi /= 2.0 toplam += sayi sayac += 1...
af543e6d2b15076ee1c4e2347ed68da51d95c952
mengi/pro-lang
/pro-lang/Piton/tc_sorgulama.py
603
3.640625
4
#!-*- coding:utf-8 -*- def tc_sorgulama(tc): tc = str(tc) if type(tc) != str or len(tc) != 11 or tc < 0: print "Lütfen 11 basamaklı bir tamsayı giriniz" else: tc_list = list(str(tc)) tek ,cift = 0, 0 for indeks in range(0, len(tc_list) - 2): if indeks % 2 == 0: tek += int(tc_list[indeks]) else: ...
c4a3635bc179cdbbd62a52f75a0c4f750a9740a1
mengi/pro-lang
/pro-lang/Piton/hizli_fibonacci.py
419
3.78125
4
#!-*- coding:utf-8 -*- def hizli_fibonacci(sayi): sayilar = {0 : 0, 1 : 1, 2 : 1, 3 : 2, 4 : 3, 5 : 5, 6 : 8, 7 : 13, 8 : 21, 9 : 34, 10 : 55} if type(sayi) == float: return "Lutfen pozitif bir tamsayi giriniz." elif sayi < 0: return "Lutfen pozitif bir tamsayi giriniz." else: if 0 <= sayi and sayi <= 10: ...
505f1f80786c47901ff2f8f20b571637483c2435
Ritwik-Alexander-Rudra/Classwork
/Python/PlottingGraphs/MatPlotLib/Scatterplot.py
230
3.6875
4
import matplotlib.pyplot as plt x = [1,2,3,4,5,6,7,8] y = [1,4,3,6,3,7,3,6] plt.scatter(x,y, label = "SkitScat", color = "k", marker = "*", s =3) plt.xlabel("X") plt.ylabel("Y") plt.title("Scatterplot") plt.legend() plt.show()
e22922e0014328a88c78d95eb20f12dc7c83f806
Ritwik-Alexander-Rudra/Classwork
/Python/Fundamentals/Global vs Local Variables.py
373
3.875
4
#Local can only be accessed within its environment #You can turn local variables into a local variable x = 6 def example(): #globe x print(x) print(x + 5) #x += 2 would cause an error if you didn't have 'global x' in the beginning def example2(): globx = x print(globx) globx += 5 prin...
50faca427335d2fd323ddfe23e881041ca33c2a1
LiisMarie/Programming-Exercises
/HackerRank/summing-pieces/Solution.py
551
3.671875
4
#!/bin/python3 def summingPieces(integer_array): mod = 10 ** 9 + 7 total_value = q = t = 0 t_2 = z = 1 for integer in integer_array: total_value = (2 * total_value + t_2 * integer + q) % mod q = (q + z * integer) % mod t = 1 if t == 0 else (t * 2) % mod z = (z + t) % m...
1e07eb6c0985654995c2e9885334231c168b707e
saroshfarhan/PythonGames-CUI-
/tic_tac_toe.py
5,381
4.15625
4
#Tic-tac-toe #Sarosh Farhan #19/03/2015 #global constants X="X" O="O" TIE="TIE" num_square=9 EMPTY=" " def display_instruct(): """Displays game instructions.""" print \ """ Welcome to the greatest intellectual challengeof all time:Tic-Tac-Toe. This will be a showdown between your human...
c586a4f12bf5b919c44b1126719c614c27b1f851
mateusz-kleszcz/Algorithms-and-Data-Structures
/zajęcia 5/optimal game.py
634
3.546875
4
def optimal(T): n = len(T) F = [[0] * n for _ in range(n)] sum = 0 for el in T: sum += el for gap in range(n): for j in range(gap, n): i = j - gap x = 0 if i + 2 <= j: x = F[i + 2][j] y = 0 if i + 1 <= j -...
310c636e79dbe5ab7ca34f9333784142e39b286f
mateusz-kleszcz/Algorithms-and-Data-Structures
/zajęcia 2/merge k lists.py
1,250
3.703125
4
class Node: def __init__(self): self.value = None self.next = None def tab2list(T): H = Node() C = H for i in range(len(T)): X = Node() X.value = T[i] C.next = X C = X return H.next def printList(L): while L is not None: print(L.value, ...
0d02a5e16ebc654996a99e4a1880ee264efe3a69
mateusz-kleszcz/Algorithms-and-Data-Structures
/list/counting sort.py
962
3.578125
4
from random import randint class Node: def __init__(self): self.value = None self.next = None def printList(L): while L is not None: print(L.value, '->', end=' ') L = L.next print('|') def tab2list(T): H = Node() C = H for i in range(len(T)): X = Node...
a6de31c679a4c8ed247de72ac1575cb0c98f9116
mateusz-kleszcz/Algorithms-and-Data-Structures
/zajęcia 2/merge_sort_list_by_falisz.py
1,558
3.71875
4
class Node: def __init__(self): self.value = None self.next = None def tab2list(T): H = Node() C = H for i in range(len(T)): X = Node() X.value = T[i] C.next = X C = X return H.next def printList(L): while L is not None: print(L.value, ...
f2a117e7a683ec1557e9ae0cc88a8da1842b309d
mateusz-kleszcz/Algorithms-and-Data-Structures
/kolosy/kolokwium II/20 I zad3.py
1,129
3.671875
4
def binary_search(tab, x): left = 0 right = len(tab) - 1 while left <= right: mid = (left + right) // 2 if tab[mid] > x: right = mid - 1 elif tab[mid] < x: left = mid + 1 else: return mid return -1 def longest_incomplete(A, k): n ...
ba95cb451f6d7d194850b8d15095b2d438a534e4
mateusz-kleszcz/Algorithms-and-Data-Structures
/zajęcia 8/isDirected.py
496
3.625
4
def isDirected(G): n = len(G) matrix = [[0] * n for _ in range(n)] for u in range(n): for v in G[u]: matrix[u][v] = 1 for i in range(n): print(matrix[i]) for i in range(n): for j in range(n): if G[i][j] != G[j][i]: return False ...
a0f6acf6a96b3dd1a6b9203d94858fe9496b3d08
mateusz-kleszcz/Algorithms-and-Data-Structures
/egzamin/20 I zad3.py
671
3.671875
4
def insertion(tab): n = len(tab) for i in range(1, n): key = tab[i] j = i - 1 while j >= 0 and tab[j] > key: tab[j + 1] = tab[j] j -= 1 tab[j + 1] = key def fast_sort(tab, a): n = len(tab) delta = (a - 1) / n buckets = [[] for _ in range(n)] ...
919ded74423d93d740e98b6a66cb82cd51fd2991
Sweetwish/My
/Hello.py
1,370
4.1875
4
#int переменная целочисленная integer number=5 age=20 #float Вещественная (дробная) переменная fnumber=5.7 #string Текст переменная str name="Tanya" #bool status=True #вывод на экран print("Что вывести на экран?") #Экранирование если нужны именно кавычки print("Он \"плохой\" человек") #перевод...
092860c77fca2fff69ccb28d29de0b5120e90591
mjshuff23/python_algorithms
/python/insertion_sort.py
1,068
4.21875
4
# Insertion sort is an in-place comparison-based sorting algorithm. A sorted sub-list is maintained (It is still in the same array) # --- Big O: O(n²) # --- Visualization: https://www.hackerearth.com/practice/algorithms/sorting/insertion-sort/visualize/ --- def insertion_sort(array): # Traverse through 1 to leng...
b50dd6b16281dc33bca3fa5eaf1f08fdf95369e4
nishaarya/Sorting
/src/recursive_sorting/recursive_sorting.py
2,025
4.25
4
# TO-DO: complete the helpe function below to merge 2 sorted arrays # We are only comparing the first elements of the arrays, as they are already sorted def merge( arrA, arrB ): elements = len( arrA ) + len( arrB ) merged_arr = [0] * elements # TO-DO # Initialise pointers for the front of Arrays A & B ...
38ce732affe989f918644083829439151d12beb9
hendrikmeersseman/informatica5
/06 - condities/2 - trolleyprobleem perfect.py
281
3.75
4
hendel_trekken = input('trek aan de hendel van de wissel? (ja/nee)') man_duwen = input('Man van brug duwen? (ja/nee)') if hendel_trekken == 'ja' and man_duwen == 'ja': doden = 2 if hendel_trekken == 'nee' and man_duwen == 'nee': doden = 5 else: doden = 1 print(doden)
24293a097754328ce4c4b7db0e37159ae3bdb2ed
hendrikmeersseman/informatica5
/04 - variabelen/2020/4. Transformaties.py
144
3.6875
4
a = 3 + int(input('geef a: ')) b = 4 + int(input('geef b: ')) print('f(x) = 2(x - 3)^2 + 4') print('f(x) = 2(x - '+ str(a) + ')^2 + ' + str(b))
924906cb9d751cae3a96529d08b0bcd81e8bddef
hendrikmeersseman/informatica5
/07b - iteraties -while - lus/2 - BlackJack.py
282
3.5625
4
getal = int(input('eerste kaart: ')) som = getal while som < 21 and getal: getal = int(input('kaart: ')) som += getal if som == 21: mes = 'Gewonnen!' elif som > 21: mes = 'Verbrand ({})'.format(som) else: mes = 'Voorzichtig gespeeld ({})'.format(som) print(mes)
22b63a0bffcf904ad8407437cbf271c4d2a26194
hendrikmeersseman/informatica5
/Toets2/3 - vouwen.py
296
3.65625
4
#invoer dikte = int(input('Geef dikte van het papier: ')) afst = int(input('Geef afstand tot hemellichaam: ')) aantal = 0 #berekening while dikte < afst: dikte *= 2 aantal += 1 uitv = 'Na {} keer vouwen bedraagt de dikte van het papier {} mm.'.format(aantal, dikte) #uitvoer print(uitv)
c849d345f829a3fd32b47f2c094242fd85e06efd
hendrikmeersseman/informatica5
/09+ - Kerstvertier/06 - De drie musketiers.py
272
3.5625
4
rijen = int(input('Geef grootte van het rooster: ')) rooster = str(input("geef rooster: ")) nieuw = '' kolommen = len(rooster) // rijen for i in range(len(rooster)): pass if rooster[i - kolommen] == 1: pass print('\n') print(len(rooster)) print(kolommen)
0e348da8f3c9f7169aa6d659d85a1b6d112de158
hendrikmeersseman/informatica5
/07a - iteraties-Forlus/5 - De rij van Fibonacci (perfect).py
163
3.734375
4
n = int(input('Hoeveelste getal van Fibonacci: ')) vorige, huidige = 1, 1 for i in range(n - 2): vorige, huidige = huidige, huidige + vorige print(huidige)
f28ddd7c3ea67cdf573ec9071c456801ab21de2f
hendrikmeersseman/informatica5
/07b - iteraties -while - lus/4 - Priemgetallen.py
362
3.625
4
getal = int(input('Welk getal wilt u onderzoeken? ')) n = 2 i = 1 gevonden = 1 while gevonden and n < getal: if (getal % n) == 0: mes = '{} is geen priemgetal'.format(getal) i = 0 gevonden = 0 n += 1 if i and getal != 1: mes = '{} is een priemgetal'.format(getal) elif getal == 1: ...
a4bf5e230010a71edabd072d483444d7a2af2c31
hendrikmeersseman/informatica5
/07a - iteraties-Forlus/2 - omkeren.py
173
3.53125
4
#invoer woord = input('geef woord: ') omgekeerd_woord = '' #berekening for letter in woord: omgekeerd_woord = letter + omgekeerd_woord #uitvoer print(omgekeerd_woord)
075c3abd77cead11df004ca7b5e73967f9352a83
sotojcr/100DaysOfCode
/PythonLearningStep1/05function.py
1,002
3.953125
4
#function # def helloFun(): # # print('Hello Function!') # # print('Hi') # return 'Hello Funciton' # def fun2(greeting, name ='You'): # return '{}, {}'.format(greeting, name) # print(helloFun()) # print(fun2('Hi')) #allowing us to accept an arbitary number of positional keyword arguments # def fun3(*args, **kwa...
eb218e9342708c4a0304354b3d07accdf8fa61c4
sotojcr/100DaysOfCode
/some cool python codes/BaskteballRasterProgram.py
1,230
3.578125
4
#Basketball ROster Program print("Welcome to the Basketball Raster Program") point = input("Who is your point guard: ").title() shooting = input("Who is your shooting guard: ").title() small = input("Who is you small forward: ").title() power = input("Who is your power forward: ").title() center = input("Who is your ...
d972241e86ae078a2491b4dc4ddd7566437ffdae
sotojcr/100DaysOfCode
/PythonLearningStep1/03tuple.py
331
4.46875
4
#tuple tuple1 = ('History','Math','Physics') tuple2 = tuple1 #tuple is emutable that is we can change the value of tuple #we can append, not remove and not change print(tuple1) print(tuple2) #sets set1 = {'history', 'Math','Math', 'Physics'} #sets avoid duplicates #order doesnt matter here print(set1) print('Mat...
ed6e4a9cc0ac75a9926f4752c7bd45882971e537
sotojcr/100DaysOfCode
/PythonLearningStep1/sqldatabase/28SqliteInPython.py
499
3.828125
4
#python sqlite import sqlite3 #create a db file if not exits and conect wwith it con = sqlite3.connect('employee.db') #create cursor c = con.cursor() #create employee table """first name, last name, pay """ # c.execute("""CREATE TABLE employees( # first text, # last text, # pay integer # )""") # c.e...
424bb9323af0ff9b81e65223c3534a550975fe41
AndFroSwe/johan
/firsttest/helloworld.py
274
3.828125
4
def user_name(name,surname): #outname = surname+", "+ name outname = "Lord " + name+ " of "+ surname + " III" return outname def main(): name = input("give name: ") surname = input("give surname: ") fullname = user_name(name,surname) print(fullname) main()
2934c741d5c5f0ebc0bdeaf32ad8b63411cadffe
sanjaysanjel/assignment_II
/python assignment(sanjay Sanjel Rol no 732)/Q#3.py
108
4.0625
4
str1=input("Enter your first string:") str2=input("ENter your second string:") final=str2+str1 print(final)
3f160a98e5a950e3742df611dae1c0e8b3adbb03
aliduysheev/test_repo
/main.py
5,422
3.90625
4
# dict_= {'TImur':{'h':90, 'm':95, 'l': 91}, 'Vlad': {'m':93, 'v':95, 'l':98}} # dict_ = {k1:v1 for k1, v1 in dict_.items() for k2,v2 in v1.item() if max(v1.values()) == v2} # print(dict_) # dict_ = {'first':{'a':1}, 'second': {'b:2'}} # dict_ = {k1:v1 for k1, v1 in dict_.items() for k2,v2 in v1.items()} # print(dict_...
1d6e99aa9e182ae0af7477d0ea5945fa4c803dde
NikonPatel/Assignment1-2
/as12.py
184
3.828125
4
#ASANSWER12 a={} x = int(raw_input('enter the number till you want a dictionary of each numbers squre')) def output(x): for i in range(1,x+1): a[i]=i*i print(a) x = output(x)
8702224ecf5a971bfe32bf7f43866c85bccd2f47
NikonPatel/Assignment1-2
/as20.py
636
3.875
4
What is the difference between range and xrange function? range() and xrange() are two functions that could be used to iterate a certain number of times in for loops in Python. In Python 3, there is no xrange , but the range function behaves like xrange in Python 2. If you want to write code that will run on both Pyt...
0448a2abf100de4b1eaafad86c83de5343b268b9
GIS29/dataconstruction
/ConSort.py
2,272
4.28125
4
""" 合并排序:两个已经有顺序的数组进行合并排序 """ list1 = [21,6,4,3,999] list2 = [71,2,3,2,999] list3=[] """ 选择排序,先将数组进行排序 """ def select_sort(data,size): #第一次遍历,从第一个元素开始,逐个向后比较 for base in range(len(data)): small = base #和第一层循环的元素逐个比较 for next in range(base,size): if data[small] > data[next]: ...
ee9bf38fadf02de079ea826e639a5c9032a14f2d
reneafranco/Course
/01-Ejercicio/05-ejercicios.py
238
4.09375
4
print("#######Sistema para printear rango#####") num_uno = int(input("cual es el primer numero: ")) num_uno += 1 num_dos = int(input("cual es el segundo numero:")) contador = 0 for contador in range(num_uno,num_dos): print(contador)
25faed6b0728f5a3ee76498ddfcf7e4de7425b64
reneafranco/Course
/01-Ejercicio/02-Ejercicio.py
118
3.5625
4
numeros = 0 pares = 0 for numeros in range(1,121): pares = numeros % 2 if pares == 0: print(numeros)
fdd202529f3b0ac42f455e4f45e861133664e8a4
reneafranco/Course
/tkinter/03-texto.py
1,766
3.765625
4
from tkinter import * ventana = Tk() ventana.title("Textos") ventana.geometry("720x480") texto = Label(ventana, text='Bienvenido a mi programa' ) texto.pack() texto = Label(ventana, text='Soy Rene Franco' ) #tambine puedo configurar el texto a mi antojo #Puedo usar la funcion config y pasarle key_argument q son pa...
075d18bbb52b443ff00cd6ac56b7ecd486677374
reneafranco/Course
/01-Ejercicio/07-ejercicio.py
375
3.984375
4
num_uno = int(input("Ingrese el primer numero: ")) num_dos = int(input("Ingrese el segundo numero: ")) num_dos += 1 contador = 0 if num_uno < num_dos: for contador in range(num_uno,num_dos): resultado = contador % 2 if resultado != 0: print(f"el numero {contador} es impar") else: p...
c751bc0e280953d37d6911d2c81cf9202c568e67
reneafranco/Course
/PROYECTO-PYTHON/usuarios/acciones.py
3,063
4.09375
4
""" Aqui puedes crear una clase donde agrupes todas las funciones para que sea mas facil llamarlas""" import notas.acciones import usuarios.usuario as modelo #AS es para cambiarle el nombre en esta pagina y te sea mas facil invocarlo class Acciones: #ya aqui puedes definirte los diferentes metodos def registro...
94891c9449baa8ba5206a1b3fbf33217cd761592
Begimai2/Day-11
/LogoTask5.py
236
3.765625
4
user1 = int(input()) user2 = int(input()) if user1 + user2 > 5: print("Сумма больше 5") else: print("Сумма меньше 5") print("Введите 1 значение") print("Введите 2 значение")
76773dced65c1ce679b2599a723de3cdf0aa0dc1
songdajun/ljtest201911
/SeleniumTest/demo1.py
1,302
3.921875
4
# 导入selenium:固定的 from selenium import webdriver # 实例化浏览器对象:打开浏览器并获得浏览器的对象 driver = webdriver.Chrome(executable_path="chromedriver.exe") driver.maximize_window() # 浏览器全屏 # 打开百度的网址 driver.get("https://www.baidu.com/") # xpath:非常方便 # e = driver.find_element_by_xpath('//*[@id="kw"]') # e.send_keys("小姐姐") # e1 = drive...
0aa315d8cd7ac08c6f3f0552457f5c523c47098d
gaurabganguly1989/axes_rotation
/axes_rotation.py
4,518
4.4375
4
#!/usr/bin/env python # A basic rotation: # The following three basic rotation matrices rotate vectors by an angle θ about # the x-, y-, or z-axis, in three dimensions, using the right-hand rule import os import re import numpy as np from math import sin, cos, pi def deg_to_rad(theta): return theta*(pi/180.0) ...
c5b0222dd56624121cb36033afce7a0334175d6d
matiasurra/devolver-las-palabras-intro-python-alphadx
/main.py
556
3.828125
4
def main(): #La variable palabras es una lista con cada palabra del archivo de entrada palabras = list() #["hola", "persona", "soy", "yo", "el", "profe"] with open("./listado-general-filtrado.txt", "r") as entrada: for i in entrada: palabras.append(i[0:-1]) #La variable listaLetras es una lista donde...
29b583302c41d2ec3b7375613e0e087ef13c91fe
yeonhole/Algorithm-Test
/백준 알고리즘/구현/1924 2007년.py
449
3.828125
4
# 1924번 : 2007년 day = 0 month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] week = ["SUN", "MON","TUE", "WED", "THU", "FRI", "SAT"] x, y = map(int, input().split()) for i in range(x - 1): day += month[i] day = (day + y) % 7 print(week[day]) # calender module 사용하기 import calendar week = ["MON","TUE", "WED...
cbd5b9853b1eef580edd8f1f11fb5c171f2fac47
Jivaldo-Cruz/Trabalho-da-Intep-1-trabalho
/16_desafio.py
156
3.921875
4
__autor__ = "Jivaldo Da Cruz" tamanho = float(input("Informe a área a ser pintada em metro quadrado: ")) total = 0 for x in range(tamanho**2): total += x
c6a94a8071f8307108f8007a47559f9b5ead6d4b
Jivaldo-Cruz/Trabalho-da-Intep-1-trabalho
/7_desafio.py
205
4.03125
4
__autor__ = "Jivaldo Da Cruz" areaQuadrado = float(input("Digite a área do quadrado: ")) areaQuadrado **= 4 dobro = areaQuadrado ** 2 print(f"A área de um quadrado é {areaQuadrado} e o seu dobro é {dobro}")
845550754000945794a8c2ddfe3f8a88348e6b5a
hugolribeiro/Python_Projects
/cnpj_validator/auto_test.py
1,574
3.640625
4
# Testes automatizados para sabermos se o algoritmo está funcionando corretamente import verificador_cnpj_0_0_2 from time import sleep def test(): corrects_cnpjs = ['45.997.418/0001-53', '58.123.035-0001-06', '60.316.817/0001-03', '15.436.940/0001-...
c2328d3d4019a3d46d1707d572c8c4e08e21ea23
Eduardo-cod/CalificacionAlumnos
/CalificacionAlumnos.py
1,913
3.9375
4
#Autor: Eduardo Esparza #Version 1.1 #Clase materia class Materia: #Constructor vacio de la clase Materia def __init__(self): self #Metodo que pide el total de alumnos a calificar def totalAlumnos(self): alumnos = int(input("Ingresa el total de alumnos: ")) self.ingresarCalifi...
5019356fb758b93b4c56c143f879efec7a746efa
Bulgakoff/python_tricks
/python_triks.py
15,836
3.671875
4
# 1. обединение листов без циклов. так СМОТРИ intertools и collections тут оперрациии над последовательностями lst = [[1, 2], [4, 'bob', 5], [6, 7, 8]] lst2 = sum(lst, []) print(lst2) # [1, 2, 4, 4, 5, 6, 7, 8] # 2.обмен местами a, s = 1, 3 a, s = s, a print(a, s) # 3. обмен местами при помощи кортежей for ((q, w),...
9c64eaccac871ed53f902673d1b15d8159e479b8
Bulgakoff/python_tricks
/oop_6/magicOOP/oop_8.py
968
3.9375
4
class Person: # def __init__(self, name, surname): self.name = name self.surname = surname def __str__(self): return self.name + ' ' + self.surname class Teacher(Person):# склад def to_teach(self, subj, *pupils): for pupil in pupils: pupil.to_take(subj) class...
bfeb3d92bbbfa094fda6567dac46626308a922ae
Bulgakoff/python_tricks
/oop_6/magicOOP/mag.py
541
4.15625
4
# # class MyClass: # def __init__(self, param): # self.param = param # # # mc = MyClass("text") # print(mc.param) # print(mc.param) # __del__ # В Python разработчик может участвовать как в создании, так и в удалении объекта. class MyClass: def __init__(self, param): self.param = param de...
64808ef721cf17ba978e86487a77068b857df29d
Cabottega/python_exercises
/overview_ranges.py
677
3.734375
4
tags = ['pyton', 'development', 'tutorials', 'code'] tag_range = tags[:-1] print(tag_range) # instructor notes # #RANGES # # takes in 2 arguments where to start and where to end # tags = ['python', 'development', 'tutorials', 'code'] #list of tags with 4 elemnts stored in variable # tag_range = tags[1:2]#the range...
1364066538f66e1f1b78bc6c7fc26d3cb255bba9
Cabottega/python_exercises
/python_string_case_functions.py
657
4.25
4
sentence = 'The quick brown fox jumped' sentence_two = sentence.upper() print(sentence) print(sentence_two) sentence_three = 'The quick brown fox jumped'.title() print(sentence_three) # instructor notes # uppercase. Note that s.upper().isupper() might be False > if s contains uncased characters or if the Unicode c...
01c2097bf49b74b478db36418019bdc61764a6de
Cabottega/python_exercises
/tuples_intro.py
861
4.21875
4
# List: [] # Dictionary: {} # Tuple: () # Tuple: immutable # List: mutable post = ('Python Basics', 'Intro guide to python', 'Some cool python content') # Tuple unpacking title, sub_heading, content = post # Equivalent to Tuple unpacking # title = post[0] # sub_heading = post[1] # content = post[2] print(title) p...
029f24a9851f2cbf51fb2e91b5bd75ba7e60bb9a
Cabottega/python_exercises
/tuples_slices.py
658
4.15625
4
post = ('Python Basics', 'Intro guide to Python', 'Some cool python content', 'published') print(post[1::2]) # instructor notes # post = ('Python Basics', 'Intro guide to Python', 'Some cool python content', 'published') # print(post[:2]) # print(post[1::2]) # #created a print statement called post # #grab firtst e...
a6c74f2ccd323b6f89cbe06f1f8ce6434843f993
sosma/ot-harjoitustyo
/src/logic/hangman.py
1,908
3.6875
4
""" Hangman logic engine """ import re import operator # -*- coding: utf-8 -*- class Hangman: """ Hangman game object """ def __init__(self, words): self.words = words self.alphabet = set([c for word in words for c in word if c != " "]) self.missed="" def findWords(self, l...
8e155deba1d60a02ad1ee9cc41df6ef0c9e8c449
cal284/stock
/email_stock_alerts.py
2,133
3.609375
4
#!/usr/bin/env python # coding: utf-8 # # Stock tracker sending email alerts #https://medium.com/illumination/how-to-build-a-stock-price-alert-using-python-d7d61ec12f2https://docs.python.org/3/library/email.examples.html #How to Create and use app passwords for gmail #Go to your Google Account. #On the left naviga...
602ae32ca9758cb0a353010dd24b512451835571
doaafathy115/Mastering-Python
/Assignment 01.py
386
4.28125
4
# ----------------------------- # --- This Is The First Task -- # --- From Lesson 1 To 10 ----- # ----------------------------- # Type String name = "Doaa" # Type Number age = 29 # Type String country = "German" print(type(name)) print(type(age)) print(type(country)) result = ("Hello " + name + " Your Age Is " + ...
eb7900d041ff67385b29776d511cc2b3218d708d
Guscode/cds-language-exam
/assignment_2/extract_collocations.py
5,891
3.9375
4
''' Use the function get_collocations to extract how many times words occur together in a corpus, both in raw frequency, and In terms of a mutual information score. The function takes the following arguments: data: path to your dataframe in csv format column: specify which column includes text, default = text Word: t...