blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
0f1bba3378e36bd254cc54cd3c2385acd2f3bd93
MischaKD/05.08.21
/kap_17_6_pandas_tk.py
2,847
3.890625
4
import tkinter as tk from pandas import DataFrame # example of pandas dataframe in matplotlib, embedded in tkinter import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg plt.style.use('seaborn') # nice grid background 88 data1 = {'Country': ['US', 'CA', 'GER', 'UK', 'FR'], ...
538bd301562e008f90d58fb5ddc4041f361071c3
nchennoju/Unique-Coding-Problem-Solutions
/CodingProblem3.py
272
4.0625
4
#find all prime numbers #save to file def isPrime(n): if(n == 1): return True for i in range(2, int(n/2)+2): if(n%i == 0): return False return True i = 1 while True: if(isPrime(i)): print(i) i+=1
1806693428d861e136f3b734ec7b5c89608acf91
Disink/Treasure-hunt-game-with-Deep-Q-learning
/game.py
3,787
3.53125
4
import numpy as np import random import os GAME_SIZE = 8 START_POS = [1,1] END_POS = [GAME_SIZE - 1, GAME_SIZE - 1] def clear(): if os.name == "nt": _ = os.system("cls") else: _ = os.system("clear") class Game(): def __init__(self): self.map_array = np.zeros((G...
d6cb9371fb4ba08cefc8bfb589ca42ce56776860
jiaojianglong/cookBook_note
/1数据结构和算法/1.5实现优先级队列.py
634
3.65625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/9/24 13:59 # @Author : jiaojianglong import heapq #列表中实际存一个元组,(-priority,self._index,item) class PriorityQueue: def __init__(self): self._queue = [] self._index = 0 def push(self,item,priority): heapq.heappush(self._que...
713cde93e69aae1907a9366bdbd12bbdeb79061d
akhileshb13/showcase
/App_part2_Database.py
3,098
3.8125
4
import sqlite3 def connect(): try: conn=sqlite3.connect("bhisi.db") cur=conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS names (unique_id INTEGER NOT NULL UNIQUE, name TEXT NOT NULL PRIMARY KEY)") cur.execute("CREATE TABLE IF NOT EXISTS winners (name TEXT NOT NULL PRIMARY KEY, ...
511485514b1709cd2a51f6ea2b8b4a8e71cc84ac
eitrheim/Colorize-Black-and-White-Photos
/code/Colorization-Autoencoder.py
10,796
3.65625
4
# Deep Learning and Image Recognition - Colorization Autoencoder # The autoencoder is trained with grayscale images as input and colored images as output. # Colorization autoencoder can be treated like the opposite of denoising autoencoder. # Instead of removing noise, colorization adds noise (color) to the grayscale i...
79d6ac78dc3cb7440c9a19bbb5f77cf3867667ce
the-maunda/matplotlib
/scatter_plots.py
685
3.984375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 25 00:22:00 2020 @author: maundaalex use this plot to show correlations between two or more entities. """ import matplotlib.pyplot as plt import random test_scores = random.sample(range(10, 100), 40) time_spent = random.sample(range(10, 50), 4...
59afd11e15849cba88aac9364135c02c389f1ab2
the-maunda/matplotlib
/stack_plots.py
723
3.734375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 25 00:34:32 2020 @author: maundaalex Show how data stacks up. A way to visualize parts of a whole """ import matplotlib.pyplot as plt import random year = [x for x in range(1, 11)] print(year) taxes = random.sample(range(10, 30), 10) overhead...
25ec9564d30e1efa5115b8dd0094c6738ffc6071
theboi/competitive-programming
/solutions/PangHW/EOY2021/CODE_S301_25_Marked.py
790
3.5
4
vals = [] val = input("Input signal fragment: ") vals.append(val) while val != "!END": #Q11 1/11 val = input("Input signal fragment (or end with '!END'): ") #Q11 2/11 vals.append(val) #Q11 3/11 vals = vals[...
86587609525205a41d6ce8d3a079c48f8f7e1d40
brunohafonso95/python-introducao
/aula6.py
1,294
3.9375
4
# configurando cacarcteres especiais # -*- coding: UTF-8 -*- import re def cadastrar(nomes): print('Digite o nome') nome = input() nomes.append(nome) def listar_nomes_cadastrados(nomes): print('lista de nomes') for nome in nomes: print(nome) def filtrar_lista_nome(nomes): texto_filtro...
18f783c87e189b758faae4d0cbbc9c0d4aa83e6e
Omega97/PasGen-2020
/PasGen 2020.py
2,723
3.84375
4
""" 27/7/2019 PasGen 2020 - Generate password given "lock sequence" and key text - compile with Python, not PyCharm - print master password, then "string" or "string" + " " + "length" !note: works only in an external console """ from random import randrange, seed, shuffle import msvc...
51f870d4b65ab3099454eef994999ba36afc371f
rohinizade27/Program
/PycharmProjects/pythonprograms/HarmonicSeries.py
164
4.125
4
number = float(input("Enter the number:")) result=0.0 while number>0: result = float(result+1/number) number=number-1 print("Harmonic value:" ,str(result))
3480154d6e4bedf535d030757d9ea07b1d5d8284
Wesley-Wess/advent-of-code-2017
/AdventofCode2.py
349
3.578125
4
number = raw_input("number?") i = 0 res = 0 a = 0 gap = len(number) / 2 while i <= len(number): number1 = int(number[a]) if (i + gap) >= number: number2 = int(number[i + gap]) else: number2 = (i + gap) - len(number) if number1 == number2: res = res + number1 print res ...
2c0e1b71464d5068c771558800ac63ae55a18f11
rz2390/LeetCode
/110_Balanced_Binary_Tree.py
629
3.796875
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isBalanced(self, root): """ :type root: TreeNode :rtype: bool """ if not root...
7833ed2316db9ff9e07c55a001ddd40e753942cf
MStamatis/SigmoReLU
/SigmoReLU.py
897
3.828125
4
""" Python (Keras) implemenation of SigmoReLU activation function used in "SigmoReLU: An improvement activation function by combining Sigmoid and ReLU", https://www.preprints.org/manuscript/202106.0252/v1?utm_source=twitter&utm_medium=cpc&utm_campaign=from """ from tensorflow.keras import backend as K from tensorflow....
fff30ad774cb793bd20a0832cf45a1855e75a263
kacifer/leetcode-python
/problems/problem232.py
2,563
4.34375
4
# https://leetcode.com/problems/implement-queue-using-stacks/ # # Implement the following operations of a queue using stacks. # # push(x) -- Push element x to the back of queue. # pop() -- Removes the element from in front of queue. # peek() -- Get the front element. # empty() -- Return whether the queue is empty. # Ex...
063a8b23776980fd0c72140c01b01a8f393c6103
kacifer/leetcode-python
/problems/linked_list.py
1,012
3.890625
4
from typing import List class ListNode: def __init__(self, val): self.val = val self.next = None def build_linked_list(nums: List, loop_at: int = -1) -> ListNode: hook = p = ListNode(0) if len(nums) < 1: return hook.next # None if loop_at == -1: # no loop for n in...
456e754c6489f33af9f54f6265034d1f7c139988
kacifer/leetcode-python
/problems/problem20.py
1,770
4
4
# https://leetcode.com/problems/valid-parentheses/ # # Given a string containing just the characters '(', ')', '{', '}', # '[' and ']', determine if the input string is valid. # # An input string is valid if: # # Open brackets must be closed by the same type of brackets. # Open brackets must be closed in the correct or...
4557d041a35f38802a429f55c22289a6b2d099a8
zeenat19/if-else-
/medical_problem clasess.py
308
3.765625
4
# held=int(input("how many days claasess are held: ")) # attend=int(input ("attend clases:")) # medical_problem=(input("yes/no:")) # p=attend/held*100 # if p>=75: # print("you sit in class") # if medical_problem=="yes": # print("student allow to sit exam") # else: # print("student not allow to exam")
26e019ec0a367432aca530f8e50b09e9a94e0e47
zeenat19/if-else-
/grade_2.py
364
3.90625
4
# marks=int(input("enter any marks: ")) # if marks<25: # print("it is grade f") # elif marks<45: # if marks>25: # print("it is grade e") # elif marks<50: # if marks>45: # print("it is grade d") # elif marks < 60: # if marks >50: # print("it is grade c") # elif marks< 80: # if marks>60: # print("it is gra...
7de01271750d3ca77907ffde0d0471ea647007bf
zeenat19/if-else-
/comparing.py
147
3.84375
4
# num_1=int(input("enter any num: ")) # bum_2=int(input("enter any num: ")) # if num_1<num_2: # print("bada hai") # else: # print("chhota hai")
08dd2ac54f55be6dec901365e143be6f42e9f7f0
zeenat19/if-else-
/year.py
3,584
4.0625
4
# year=2016 # name="navgurukul" # print(name + " " + str(year) + " "+ "main start hua tha") # # # sub1=int(input("enter marks of chemistry: ")) # sub2=int(input("enter marks of physicks: ")) # sub3=int(input("enter marks of biology: ")) # sub4=int(input("enter marks of mathmatics: ")) # sub5=int(input("enter marks ...
f27e6c5de8d50afccc206c6ee76040a23b3b73c4
zeenat19/if-else-
/negative.py
2,515
4.09375
4
# number=int(input("enter any num: ")) # if number>0: # print("it is positive") # elif number==0: # print("it is zero") # elif number<0: # print("it is negative") # else: # print("nothing") # a=int(input("enter any a :")) # b=int(input("enter any b: ")) # c=int(input("enter any c: ")) # if a+b>b: # print("va...
7a3abfdec9aa049598560fa54663540bea1e085b
isaacmthacker/ProjectEuler
/primesBelowTwoMil.py
450
3.8125
4
""" The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ #need improvement import math primes = [2] below = 2000000 #below = 10 primeSum = 0 for x in range(3, below): if x % 100000 == 0: print x prime = True for p in primes: if x%p =...
a766bc2b1a7b037b5e63286a98356c790bd50769
glurbo/iti0102-2019
/tk2/exam.py
3,073
4.03125
4
"""Test 2 (R10).""" def middle_way(a: list, b: list) -> list: """ Given 2 int arrays, a and b, each length 3, return a new array length 2 containing their middle elements. middle_way([1, 2, 3], [4, 5, 6]) → [2, 5] middle_way([7, 7, 7], [3, 8, 0]) → [7, 8] middle_way([5, 2, 9], [1, 4, 5]) → [2, 4]...
b821eb98cb29f97bf3f2e78172a702910d221c8c
glurbo/iti0102-2019
/pr13_api/deck.py
3,592
3.765625
4
"""Deck.""" from typing import Optional, List import requests import random class Card: """Simple dataclass for holding card information..""" def __init__(self, value: str, suit: str, code: str): """Constructor.""" self.value = value self.suit = suit self.code = code s...
c39cd1edabd200f09935fe7ba9f5b2d3cc5739d3
glurbo/iti0102-2019
/pr03_rps/rps.py
4,716
4.46875
4
"""Simple version of rock paper and scissors.""" from random import choice def normalize_user_name(user_name: str) -> str: """ Simple function gets player name as input and capitalizes it. :param user_name: name of the player :return: A name that is capitalized. """ return str(user_name.capit...
8f8f99771062ef968b9c467f37f64515e54bed4d
glurbo/iti0102-2019
/pr14_exam/exam.py
10,311
4
4
"""PR14 Exam.""" def swap_items(dic: dict) -> dict: """ Given a dictionary return a new dictionary where keys and values are swapped. If duplicate keys in the new dictionary exist, leave the first one. {"a": 1, "b": 2, "c": 3} => {1: "a", 2: "b", 3: "c"} {"Morning": "Good", "Evening": "Good"} => ...
3cf13dede5b32e738094099f81cf9db535d29a24
glurbo/iti0102-2019
/ex06_schedule/schedule.py
2,375
3.671875
4
"""Create schedule from the given file.""" import re def create_schedule_file(input_filename: str, output_filename: str) -> None: """Create schedule file from the given input file.""" pass def create_schedule_string(input_string: str) -> str: """Create schedule string from the given input string.""" ...
95c0b9cc862fefce737f8801a88b3ff95f9257a3
minamorcos14/DockerCalculator
/Calculator/Calculator.py
447
3.515625
4
class Calculator: def __init__(self): pass def addition(self, a, b): return float(a) + float(b) def subtract(self, a, b): return float(a) - float(b) def multiplication(self, a, b): return float(a) * float(b) def division(self, a, b): return float(b) / floa...
1df86246166f4e186cada6a26df2558b9ae5c31b
amalko/Python-Project-Address-book
/GUI for Address book.py
9,272
3.8125
4
import tkinter as tk import sqlite3 from PIL import ImageTk, Image root= tk.Tk() root.title("GUI for Address Book") root.iconbitmap('G:\Python\Projects\Hopstarter-Sleek-Xp-Software-Windows-Messenger.ico') root.geometry("400x600") global show_label conn= sqlite3.connect("Address book.db") ...
b4dbad4aa782b1a1cf4f5893d95f45dc9785add1
maxcantsurf/comp-phys
/minimisation.py
19,126
3.5
4
import numpy as np import linear_algebra as la import uncertainty as uc import time def parabolic_1d(f, domain, params, n = 1000, accuracy = 1e-8, notify = False, error_estimate = False): '''Returns the minimum (x, f(x)) of a 1D function via the parabolic method. Keyword ...
87245f68d596a31c038e7179c7a1db68595da8f0
rishitha55/java-a1
/python assignment.py
240
3.953125
4
rows = int(input("Enter number of rows: ")) k = 0 gap=1 for i in range(1, rows+1): for j in range(1, (rows-i)+1): print(end=" ") num=gap k=1 while k<=i: print(" ",num," ", end="") k += 1 num+=1 k = 0 gap+=3 print()
9b25fa05834535113b22b2b21c06a2116d6b9457
xiongben/flaskDemo
/client.py
649
3.578125
4
# import socket # s = socket.socket() # host = socket.gethostname() # print host # port = 12345 # ip_port = ('127.0.0.1',9999) # s.connect(ip_port) # print s.recv(1024) # s.close() # a = [2,3,4,5] # b = [3,8,9,33] # print list(set(b).difference(set(a))); # print list(set(a).difference(set(b))); # x,y = 10, 20 # print...
1a1e25baa7c53b650f10b3cf89d5d60c0b9bab89
helbertsandoval/trabajo10_sandoval-sanchez-helbert_cesar_maira_paz
/menu06.py
887
4.0625
4
import libreria #1.implementacion del sub menu def navidad(): contenido=(input("¿Cual es la palabra clave navideña?:"))+ "\n" libreria.guardar_datos("caliente.txt", contenido, "a") def ano_n(): contenido=(input("Ingresa la palabra clave de año nuevo")) + "\n" libreria.guardar_datos("caliente....
09ef7be30d4d7122543e9cb34feb3d6e40589f28
helbertsandoval/trabajo10_sandoval-sanchez-helbert_cesar_maira_paz
/submenu4.py
1,050
3.9375
4
import libreria #1. Implementacion de submenu def agregarDistancia(): #1.pedir la velocidad #2.pedir el tiempo #3.calculando la distancia velocidad=libreria.pedir_numero("ingrese la velocidad",5,200) tiempo=libreria.pedir_numero("ingrese el tiempo",5, 100) print("la distancia", velocid...
f60852b23944b26381843f12bc7b5698e969d2a5
arnauze/dslr
/describe.py
5,227
3.546875
4
import sys import math def is_number(s): try: float(s) return True except ValueError: return False # ------------------------------------- # Describe math functions # ------------------------------------- def mean(dataset): total = 0 for data in dataset: total += data ...
4b22430c3c120bb067e8d29b55bcb405614648f8
AlessandroMion/Algorithm-Assignment-1
/main.py
4,068
4.375
4
#P1: Write a program that asks the user for a temperature in Fahrenheit and prints out the same temperature in Celsius. #Firstly, ask a question for tempF (temp if fahrenheit) tempF = int(input(" Input a number in Fahrenheit: ")) #then this below is the calculation for the tempF to tempC tempC = (tempF - 32) * (5 / 9)...
1776ca963ae8827ee5a3f07ab9c8eb049ad74633
webclinic017/ibkr-3
/Tutorials/OOP/OOP_in_one_article/5-Code_Reuse.py
343
3.578125
4
# OOP tutorial # 5 Code Reuse # https://towardsdatascience.com/understand-o-o-p-in-python-with-one-article-bfa76f3ba48c class MyTransports(): def __init__(self, color, brand): self.color = color self.brand = brand class Car(MyTransports): pass class Train(MyTransports): pass my_train = T...
6d0444878ed4da1e21e9e23e6ad243df779c0b31
webclinic017/ibkr-3
/Tutorials/OOP/Real_Python_OOP/Inheritance.py
520
3.90625
4
# https://realpython.com/python3-object-oriented-programming/ class Dog: species = "Canis familiaris" def __init__(self, name, age, breed): self.name = name self.age = age self.breed = breed # Another instance method def speak(self, sound): return f"{self.name} says {s...
f9d804a7a5cb09a1c87bba8b60f71a9adceaddfd
chr1sbest/decorator_presentation
/timed_algos.py
1,106
3.953125
4
from time import time as now def some_calculation(value): """Add one to a value.""" # Time the execution of the function. start_time = now() value = value + 1 end_time = now() # Calculate and print the execution time. exec_time = end_time - start_time print "Execution time was {0}ms".f...
e0f661318c426ada05871f8f919120dec3d2e166
MattPat1981/tidd
/examples/read_data.py
978
3.640625
4
""" In this file, we show how one can read data from a particular time period for use in modeling. """ # imports # import matplotlib.pyplot as plt import seaborn as sns from tidd.utils import Data, Transform if __name__ == '__main__': # try to read data from a specific location df = Data.read_data_from_file(...
86e9db7d7fa80a3b4edbe57241151fd8f016a742
pettarin/elzzur
/elzzur/mtdictionary.py
4,675
3.671875
4
#!/usr/bin/env python # coding=utf-8 """ A dictionary based on MARISA trie. This implementation requires the ``marisa-trie`` Python package (``pip install marisa-trie``). """ from __future__ import absolute_import from __future__ import print_function import io import marisa_trie import os import unicodedata __auth...
306790fa115a2d2cdad66c196a1aaf03e422bce9
Carvanlo/Python-Crash-Course
/Chapter 10/learning_python.py
419
3.984375
4
filename = 'learning_python.txt' # first version with open(filename) as file_object: contents = file_object.read() print(contents) # second version with open(filename) as file_object: for line in file_object: print(line.rstrip()) # third version with open(filename) as file_object: lines = file_object.re...
6bf59d96735d13f66a49a7cfd3d7dd06553df0ef
Carvanlo/Python-Crash-Course
/Chapter 3/greetings.py
146
3.5625
4
name = ['bar', 'carmelo', 'james'] message = 'Hi, ' print(message + name[0] + '!') print(message + name[1] + '!') print(message + name[2] + '!')
72a9a0d8cb903303c9522a5ab26621799c7ea6cf
Carvanlo/Python-Crash-Course
/Chapter 5/ordinal_numbers.py
191
4.09375
4
ordinal_numbers = list(range(1,10)) for num in ordinal_numbers: if num == 1: print("1st") elif num == 2: print("2nd") elif num == 3: print("3rd") else: print(str(num) + 'th')
48247766274cabc086cfa334c842eaaf4ebb8bf7
Carvanlo/Python-Crash-Course
/Chapter 10/silent_cats_and_dogs.py
254
3.8125
4
def print_file(filename): try: with open(filename) as file_object: contents = file_object.read() except FileNotFoundError: pass else: print(contents) filenames = ['cats.txt', 'dogs.txt'] for filename in filenames: print_file(filename)
44bd4d30acfddb690556faaf26174f6a6faee6fe
Carvanlo/Python-Crash-Course
/Chapter 8/album.py
412
4.15625
4
def make_album(artist_name, album_title, track=''): """Return a dictionary of information of an album.""" album = {'artist': artist_name, 'title': album_title} if track: album['track'] = track return album album_1 = make_album('Adam Levine', 'Begin Again', 3) print(album_1) album_2 = make_album('Emma Stevens...
73ede2cfa8917ca40a25d9ff020648a7c53b69cf
ellastewart/CISC453_Assn2
/QLearningModified.py
6,550
3.640625
4
''' Written by Ella Stewart on 2019-11-12 Implements QLearning for the Windy Grid World ''' import random import numpy ''' Sets up the grid to be used for Qlearning Initializes coordinates as start state Moves states given an action ''' class gridWorld: # Constructor that initializes start state and all possible ...
f63fd74411b5aee5a3f588adc33f839d2c433f8b
seddie95/python_thesaurus
/thesaurus_scripts/thesaurus.py
2,377
3.640625
4
from bs4 import BeautifulSoup as soup from urllib.request import Request, urlopen from urllib.error import HTTPError from spellchecker import SpellChecker import argparse def create_parser(): """Function to parse the user entered arguments""" parser = argparse.ArgumentParser(description='find synonyms for a w...
94d9bca02dd044b5574522ef5f3185f8223a74e0
kumk/python_code
/donuts.py
593
4.15625
4
#Strings Exercise 1: Donuts # # Given an int count of a number of donuts, return a string of the form 'Number # #of donuts: <count>', where <count> is the number passed in. However, if the # #count is 10 or more, then use the word 'many' instead of the actual count. # So #donuts(5) returns 'Number of donuts: 5' and don...
acdecff185e2912bcd498068a6a42e824da4567c
Elephant333/Project-Euler
/p5-SmallestMultiple.py
274
3.71875
4
#Nathan Li - 3/10/2021 - P5: Smallest Multiple num = 20 divideBy = range(1,21) found = False while found == False: for x in divideBy: if num % x == 0: pass else: num += 20 break else: found = True print(num)
e4f0aa27e5346606bd508832de02b6199002f2d1
MrChester/python_course
/tasks/lesson4_loops_and_conditions/week_days.py
321
4
4
days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] day_numbers = [1, 2, 3, 4, 5, 6, 7] day_dict = dict(zip(days, day_numbers)) for k, v in day_dict.items(): if v < 6: print(v, k, ' - Just another working day') else: print(v, k," - Yoo-Hoo! Day offs beginning! Let's get party")...
44dd3188650a95a2d80c73612b40d8dd931ae20e
AkankshaRakeshJain/CodeChef
/PALL01_theBlockGame.py
138
3.609375
4
for _ in range(int(input())): number = input() if number == number[::-1]: print('wins') else: print('losses')
05214d93ce5bfa0f9f4187114f405adfc293de58
AkankshaRakeshJain/CodeChef
/LUCKFOUR_LuckyFour.py
170
3.59375
4
user = int(input()) for _ in range(user): number = input() count = 0 for values in number: if values == '4': count += 1 print(count)
c2b42b618827594b8c57440965766759a9e8b41d
sunhao0520/Notes
/Python/new/other_test.py
417
3.78125
4
def sum_2_num(a,b): """"对两个数字的求和""" print("%d+%d" % (a, b),end="=") return a+b a=int(input("请输入加数1:")) b=int(input("请输入加数2:")) you =sum_2_num(a,b) print(you) def chenfabiao(): i=0 j=0 K=0 while i<=9: while j<=i: K=i*j print("%d×%d=%d"%(i,j,K),end=" ") ...
50a960a9bccaeca89060c9e03e7e992d7f7653ba
sunhao0520/Notes
/Python/new/hm_74_格式化输出.py
227
3.625
4
#定义字符串变量name, #name="dadadada小明" #print("我的名字叫 %s,请多多关照"%name) price=3.2 weight=2.3 money=price*weight print("苹果%.02f元/斤,买了%.02f斤,要花%.02f元"%(price,weight,money))
46ec9424836d2cdb31b863cd5b1cd56efd763f36
sunhao0520/Notes
/Python/new/hm_202_名片夹系统.py
1,145
3.59375
4
#! /usr/bin/python3 """ ************************************************** 欢迎使用【名片管理系统】V1.0 1. 新建名片 2. 显示全部 3. 查询名片 0. 退出系统 ************************************************** """ #无限循环 import hm_202_名片夹执行工具 while True: #功能菜单显示 hm_202_名片夹执行工具.show_menu() #下面是定义功能 action_str=input("请选择希望执行的操作:") pr...
7b418a8b46b44fe6913f808024e6c2ba683885d2
loknath0502/python-programs
/28_local_global_variable.py
374
4.25
4
a=8 # global variable def n(): a=10 print("The local variable value is:",a) # local variable n() print("The global variable value is:",a) '''Note: The value of the global variable can be used by local function variable containing print . But the value of the local variable cannot be used by the gl...
72de21ba5f050c5c7833597262008754e6b5f7b7
loknath0502/python-programs
/15_list _numbers.py
448
3.78125
4
# n=[5,10,15,20,25,30,35] # sum=1 # for i in n: # sum+=1 # print("No.of Elements present in side the list=",sum) #8 '''by math module''' # import math # print("the sum of the list",math.fsum(n)) #140.0 '''sum of number''' # import math # a,b,c,d=[float(x) for x in input("Enter the value of s val...
d68e6af24f5b59bcc2a3d685c2ec70bdf6da358f
loknath0502/python-programs
/1_employe details.py
387
4.09375
4
'''name id salary''' name=str(input("Enter ypor name:")) Id=int(input("Enter ypor id:")) salary=int(input("Enter ypor salary:")) print("your name is:{},your id is:{},and your salary is:{}".format(name,Id,salary)) print("your name is:{0},your id is:{1},and your salary is:{2}".format(name,Id,salary)) print(f"your...
b198045412af3347e127283dae0300de62963460
loknath0502/python-programs
/17_checking element list or not.py
191
4.125
4
m=[2,4,6,8] f=int(input("Whih Element you want to find?:")) for i in m: if f==i: print("the value is found") break else: print("the value is not found")
3ded690f154e9f374647aea7fe9be3e5265a8f21
vital1381/LC
/Cycle_sort/268_MissingNumber.py
908
4
4
# LC 268 array of n numbers from 0 to n. Return the only number which is missing from array def missing_number(nums): # iterate through array for i in range(0, len(nums)): # while number is not at correct position while nums[i] != i: # d - destination index where it should be place...
d19f9fac5d16037951771126366a46dad85ddb9b
michaelwooley/trumpTariffs
/code/py/scripts/puma_to_county_crosswalk_exploration.py
2,721
3.546875
4
"""This file explores the conversion from PUMA to counties. There are multiple cases for each PUMA/County: - 1 -> 1. One PUMA maps to one county (goldilocks) - 1 -> M. One PUMA maps to many counties (as in rural areas) - M -> 1. Multiple PUMAs map to one county (as in urban area) - M -> M. Multiple PUMAs map to multi...
db8502678f3b850ad743cc8464436efcc6e01b20
ryanfirst/NextGen
/problem_types_set2.py
799
4.15625
4
# first_num = input('enter first number') # second_num = input('enter second number') # third_num = input('enter third number') # print(int(first_num) * int(second_num)) # print(int(first_num) * int(second_num) / int(third_num)) # num = input('pick a number') # print(int(num) % 2 == 0) # money = input('how much money w...
1e7524e9184694ba084082fc98bf56871b757ddb
ryanfirst/NextGen
/loops_set2.py
629
4.0625
4
i = 1 while i == 1: password = input('Please create a password: ') correct_pass = input('Please re-enter password: ') while len(password) < 8 or password.lower() == password and i == 1 or correct_pass != password: print('password must contain at least 8 characters and have at least one uppercase let...
b670e2dab6d74e89952307e5bcd055ca77c22e5e
ryanfirst/NextGen
/problems_conitionals_set1.py
2,016
3.984375
4
# import random # win = random.randint(1, 5) # message = ('you win') # # guess = int(input('pick a number between 1 and 5')) # if guess == win: # print('Congratulations, you won!!') # elif guess < win: # print('Wow, you guessed too low') # elif guess > win: # print('you guessed too high get outta here') # p...
0040000eb4988ca2b37bcc1dc493a369a9057cb3
AncaGr/Acc1
/main.py
218
4.03125
4
for i in range(100, 0, -1): if i % 5 == 0 and i % 3 == 0: print("Testing"); elif i % 3 == 0: print("Software"); elif i % 5 == 0: print("Agile"); else: print(i);
5ce66e6cc5254761f9e660d7f92d4d90165adee5
brunodrd/book
/jupyter_execute/algo/recherche_dico_v2.py
2,679
3.546875
4
La recherche dichotomique --- # Principe On souhaite rechercher une valeur $x$ dans un tableau $t$ trié (*par ordre croissant pour se fixer les idées*). L'idée principale est de comparer $x$ avec la valeur située au milieu du tableau: * si elle est plus petite, il suffit de restreindre la recherche dans la partie ga...
2d7b0d2c2cca6e975e6d212ac961cfbd3773195e
Luciano-A-Vilete/Python_Codes
/BYU_codes/Vilete_009.py
1,865
4.25
4
#Python Code 009 #Starting: print('You buy a sea trip around the asia continent, but someday your trip is over … and you woke up on an isolated island, alone … ') print('When you look around, you see nothing and no one else with you … You see just 3 things:') #The GAME: print('The items that you see are: \n1. ...
3ed9396729043e3df3ea7d6d85ade347237c9240
j-suarezp/TallerDerivacionIntegracion
/1h.py
274
3.5
4
import math def derivada(f): def df(x, h=0.1e-5): return ( f(x+h/2) - f(x-h/2) )/h return df def g(x): return math.log(x) primeraDerivada = derivada( g ) segundaDerivada = derivada( primeraDerivada ) print ("f''(1.8) = ") print (segundaDerivada( 1.8 ))
c5dc90da66dd2efae656972c3c3e73a3eb3fb4c9
krishilderbrand/cs114
/volume.py
275
4.09375
4
print('Welcome to the Volume Converter!') print('Please tell me the volume in gallons, and I will let you know how many liters you have.') print('How many gallons do you have?') gallons = float(input()) liters = gallons * 3.7841 print('You have ' + str(liters) + ' liters.')
8bfe25f82abbc7c13c7d1c66b05daf246fe5fb7c
krishilderbrand/cs114
/dungeonCrawler2.py
3,090
4.0625
4
#import random print('') print('') print('==============Space Dungeon==============') print('') print('') print('Greetings warrior. Are youready to battle in Space Dungeon?') print('Answer yes or no, warrior!') choice = input() if(choice == 'no'): print('Then flee coward!') else: print('Welcome, please create you...
dbb9a4c79e6ddc42ea03ee9e0f807bbad5bcce1f
Dulce56/EjerciciosPython
/calculadora.py
698
3.71875
4
# Creando clase calculadora import math class Calculadora: def __init__(self): self.a=0 self.b=0 self.r=0 def suma(self): self.r= self.a+self.b def resta(self): self.r= self.a-self.b def multiplicacion(self): self.r= self.a*self.b def divi...
f6a0f90a650569fed8b2c38f22f5f172f4294cfc
4khil3sh/Assessments
/Q_13.py
177
3.9375
4
n = input('Enter the number n: ') if(n>0): while(n!=1): if(n%2==0): n = n/2 print(n) else: n = 3*n+1 print(n) else: print('Enter a positive N next time.')
7314103f593455d395aad11315d69d02fccb4b34
Arnomic/python_practice
/rename.py
1,145
3.5625
4
#! /usr/bin/python import os import re ''' 重命名视频文件 ''' class Rename: def __init__(self): pass def get_file_list(self): file_list = self.get_config() print(file_list) path = '/Users/dingzhu/Downloads/尚学堂高淇java300集第一季' for item in os.listdir(path): title =...
09c8da67245a500ea982344061b5d25dbc1d0a58
olive/college-fund
/module-001/Ex1-automated.py
1,456
4.25
4
# 1*.1.1) Rewrite the following function so that instead of printing strings, # the strings are returned. Each print statement should correspond to # a newline character '\n' in the functiono's output. def bar_print(a, b, c): if a == b: print("1") elif b == c: print("2") ...
3daea8e602def57a0fa24a94389ff1766e58f990
endersma/python_fundamentals
/for_loops_basic_2.py
4,694
4.4375
4
# Biggie Size - Given a list, write a function that changes all positive numbers in the list to "big". # Example: biggie_size([-1, 3, 5, -5]) returns that same list, but whose values are now [-1, "big", "big", -5] # def biggie_size(arr): # new_arr = [] # for num in range(0, len(arr), 1): # if arr[num] ...
241a9a87f7c9400c54ce8b121b2fbaecc8f8418d
ArthurMPassos/Snake-ThurMP
/training.py
7,331
3.5
4
import pygame from random import randint # Var de trainamento # Lista de saida [Esquerda, Cima, Direita, Baixo] listaOutput = [0,0,0,0] # Lista de entrada [n da rodada ,pontos obtidos # matriz do tabuleiro] (tabuleiro incluindo # paredes, corpo da cobra e maca) listaEntrada = [0]*3 # Nota: a matriz sera quase 4 ve...
64d00ddf6283cc0dcae7d0fac6b7b35ce3bc254b
iaortiz/fp-utpl-18-evaluaciones
/Evaluacion/Ejercicio9.py
936
3.71875
4
ang11=float(input("Ingrese el ángulo 1 del triángulo 1\n")) lad11=float(input("Ingrese el lado 1 del triángulo 1\n")) ang12=float(input("Ingrese el ángulo 2 del triángulo 1\n")) lad12=float(input("Ingrese el lado 2 del triángulo 1\n")) ang13=float(input("Ingrese el ángulo 3 del triángulo 1\n")) lad13=float(input("Ingre...
e8825718723cb62044926f1479163306ee1f18a8
AjayKumar2916/python-challenges
/050-task.py
292
3.921875
4
''' Define a class named American and its subclass NewYorker. Hints: Use class Subclass(ParentClass) to define a subclass. ''' class American(object): pass class NewYorker(American): pass if __name__ == '__main__': a = American() n = NewYorker() print(a) print(n)
707f32f5025b0d8458728577d7f2c54ddc361dbc
AjayKumar2916/python-challenges
/020-task.py
321
4.03125
4
''' Define a class with a generator which can iterate the numbers, which are divisible by 7, between a given range 0 and n. Hints: Consider use yield ''' def generator(): myList = range(100) for l in myList: if l % 7 == 0: yield l print(generator()) for g in generator(): print(g) ...
e1146f7a613892b9d79b70a5fdf218eafd812681
AjayKumar2916/python-challenges
/047-task.py
280
4.15625
4
''' Write a program which can filter() to make a list whose elements are even number between 1 and 20 (both included). Hints: Use filter() to filter elements of a list. Use lambda to define anonymous functions. ''' e = range(1, 21) a = filter(lambda x:x%2==0, e) print(list(a))
abe96a3eec57a0ccdc7d61b300cc4c3ccac08809
AjayKumar2916/python-challenges
/025-task.py
488
3.796875
4
''' Question: Define a class, which have a class parameter and have a same instance parameter. Hints: Define a instance parameter, need add it in __init__ method You can init a object with construct parameter or set the value later ''' class MyClass(object): name = 'Jerry' def __init__(self, name=...
f5915fca037c57ee71e24c43d6e18e2b176fc67a
Sripadalns/python-SmartFleet-Admin
/sort.py
332
3.515625
4
import csv import operator datafile =open('output-2015.csv',"rb") reader=csv.reader(datafile) sort = sorted(reader,key=operator.itemgetter(5)) for eachline in sort: print eachline output=open('output.csv',"wb") writer = csv.writer(output) for eachline in sort: writer.writerow(eachline) datafile.close() out...
6c486947facd7b6d370f5f0da4c37cfdba564971
czzstudy/python_programming
/Code_python_deeplearning/ch04/CH4_SimpleNet_study.py
7,356
3.734375
4
''' 基于数值微分法梯度下降的简单网络学习 ''' import sys sys.path.append("F:\study\python\python_programming\Code_python_deeplearning") from dataset.mnist import load_mnist import numpy as np from PIL import Image import matplotlib.pyplot as plt from common.functions import sigmoid, softmax # 显示图像 def img_show(img): pil_img = Image...
e7addf4f821327ca745f0d4e377b54f256dba4a9
kmhawkes/python-gis
/x.py
325
3.96875
4
# constructors: string = "foobar" # creates a string object list = [0, 1] # creates a list object hash = { "a": 42 } # creates a dict object hash2 = dict( b = 21 ) # creates a dict object, differently # method calls print string.capitalize() print list.pop() print hash.get('a') print hash2.get('...
a14520777faa7005e7c84f30d4012282b4a975af
basiledayanal/PROGRAM-LAB
/CO1.pg15.py
293
3.515625
4
n=int(input("Enter a limit:")) a=[] b=[] c[] print("Enter 1st and 2nd list:") for i in range(0,n): print("1st:",end="") a.append(input()) print("2nd:",end="") b.append(input()) for i in range(0,n): if a[i]==b[i]: continue else: print(a[i])
8d4f476c8a934829032e54a5bd01eaa189f1624b
basiledayanal/PROGRAM-LAB
/CO1.pg3c.py
105
3.625
4
vowels = "aeiuoAEIOU" word='Programming' print([letter for letter in word if letter in vowels])
44639ca7d75f1554855d9a5f4eede35baead258f
CONABIO-audio/axon
/axon/datatypes/pandas_dtypes.py
3,623
4.375
4
# -*- coding: utf-8 -*- """ Pandas dataframe DataTypes module. Pandas dataframes as DataTypes are defined in this module. """ import pandas as pd from axon.datatypes.base import DataType class DataFrame(DataType): """Pandas dataframe DataType. We create a class for pandasdataframes. At initialization the ...
ed08b421996fab5b1db393c23496aff72939db24
svukosav/crm
/database.py
1,603
4.375
4
import sqlite3 db = sqlite3.connect("database") cursor = db.cursor() # cursor.execute("""DROP TABLE users""") if db: # Create a table cursor.execute("""CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT, phone TEXT, email TEXT unique, password TEXT)""") db.commit() name1 = 'Andres' phone1 = '3366858' email1 = '...
665eeeaa8cfdb0ceca66c2ed9be0e96ab71a5744
Reethupriyanka/firstproject
/prject_euler14.py
144
3.5625
4
li=[] for i in range(1,1000000): for j in range(2,i+1): while(j!=1): if(j%2==0): j=j/2 else: j=3*j+1 li.append(j) print(li)
7c770b2adec3c9f24c8bfbbe8f4af2ef196187fe
ArnonGot/lab_python
/example13.py
1,253
3.890625
4
#เขียนโปรแกรมรับอินพุตเข้ามา 3 ค่า #ค่าแรก เป็น ตัวอักษรที่ต้องการให้แสดง #ค่าที่ 2 เป็นจำนวน Row (จำนวนเต็มมีค่า >= 1) #ค่าที่ 3 เป็นจำนวน Column (จำนวนเต็มมีค่า >= 1) #ให้แสดงในรูปแบบที่ตัวอย่าง Sample Input/Output โดยระหว่างตัวอักษรในบรรทัดเดียวกันให้คั่นด้วย Space และ ท้ายบรรทัดมี 1 Space #Sample Input 1: # 4 5 #Sa...
22e21d7606c4643ff8967fba8b997e35fa7e8aea
ArnonGot/lab_python
/menu_coffeeShop.py
881
3.671875
4
lt = [] paid = [] print('Anyonghaseoyo!!!') print('Welcome to Enough Cafe.\n') menu = {'americano' : 80, 'latte' : 90, 'cappuchino' : 100, 'chocolate' : 100} print('This is our drinks \n*****************') #for x in menu: #print(x + ' ' ,end=' ') #print(menu[x]) for x,y in menu.items(): print(x,y) prin...
f8edaf94f1a269fb8d69d3e5d364f96b2ba4d360
ArnonGot/lab_python
/birthdayParadox.py
843
3.609375
4
# try out the birthday paradox import random as rd day = [] month = [] birthDays = [] def people(numbers): for i in range(numbers): d = rd.randint(1,31) m = rd.randint(1,12) day.append(d) month.append(m) for j in range(numbers): dayMonth = str(f'{day[j]}{month[j]}') ...
9d18af78323498e730183f9e801ffd9cfeafbc44
ArnonGot/lab_python
/example10.py
738
3.515625
4
#ให้เขียนรับตัวเลขฐาน 2 จากผู้ใช้ จากนั้นแปลงให้เป็นเลขฐานสิบ #ตัวอย่างการทำงาน 1 #Enter binary number: 10110 #22 #ตัวอย่างการทำงาน 2 #Enter binary number: 110 #6 #**คำใบ้: อย่าลืมว่าเราสามารถพิจารณาสตริงเป็นรายการของตัวอักษรได้ x = str(input('Enter number: ')) li = [] for i in x: li.append(i) d = int(len(...
d7e482d15ecaf010f14de0fa1d1faeb271366f81
Sbk3824/Python-Projects
/GuessTheNumber.py
593
4
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Feb 13 13:45:58 2018 @author: sbk """ import random number = random.randint(1,100) guess = 0 guessCount = 0 while guess == 0: gNumber = input("Guess the Number between 1 and 100 : ") if (gNumber == number): print('Nice Work, You Guess...
eb51138ec5f44748e6f1abb84eeaa47154ea5892
claudia-sushicat/Gerador-de-senha
/gerarsenha.py
1,590
3.96875
4
import random import string import time print('Gerador de senhas') time.sleep(0.5) print("\nCarregando quantidade de senhas .") time.sleep(0.2) print("\nCarregando quantidade de senhas ..") def wordlist(): arquivo = open("rockyou.txt",encoding="utf8") leitura = arquivo.read().splitlines() print("\nA quant...
10af535640148ecb6a3de440f1b9a7d765b94b22
vedatk67/ADM-HW1
/hw1scripts/collections.py
3,108
3.75
4
# 1-)COLLECTIONS.COUNTER() # create counter which includes evey shoes and how many of them we have. # if the unit of shoes are not 0 the nwe can sold them and added to money.Also lower the unit of shoes by one from collections import Counter nofshoes = int(input()) listofshoes = (input().split()) listofshoes = [int(i...
ee9baf65eb1ee8f63cbaede20abdbdb03a050d3e
dippingconda/python_algorithm_interview
/number-of-islands.py
1,815
3.71875
4
""" https://leetcode.com/problems/number-of-islands """ from typing import List def number_of_islands(grid: List[List[str]]) -> int: count = 0 visited = [] dx = [1, -1] dy = [1, -1] def dfs(i: int, j: int): if i < 0 or i >= len(grid) or \ j < 0 or j >= len(grid[0]) or \ ...