blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
04e067fb7386348b192b8e2345e8ded4a7b3dc87 | marlberm2014/svn_user_extractor | /Source/FileReader.py | 1,379 | 3.59375 | 4 | import os
class FileReader():
def __init__(self):
self.lineList = []
def replace_lineList(self, currLineList):
newLineList = []
for line in currLineList:
lineArr = line.split()
newLineList.append(lineArr[1] + "," + lineArr[0])
self.lineList... |
93068ff9edb15358a8a9b7f133fd5abecb430c1a | tony89824396/Udacity-CS101 | /lesson3/Palindrome.py | 93 | 3.6875 | 4 | word="adc"
word1=word[::-1]
is_palindrome =word.find(word1)
# TESTING
print is_palindrome
|
f34267aa7da010710d60d18b712b67fc18f45524 | Zahidsqldba07/competitive-programming-1 | /Leetcode/Problems/p7.py | 1,344 | 3.734375 | 4 | # Given a 32-bit signed integer, reverse digits of an integer.
def reverse(x: int) -> int:
min_int = -2**31
max_int = 2**31 - 1
negative = True if x < 0 else False
if not negative:
result = int(str(x)[::-1])
else:
result = -1 * int(str(-x)[::-1])
if min_int <= result <= max_int... |
608b7e6a04fb2274545e6cf0e3e4f58b20224897 | lilyandcy/python3 | /leetcode/nextPermutation.py | 449 | 3.671875 | 4 | class Solution:
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
import itertools
permutations = sorted(set(itertools.permutations(nums)))
if tuple(nums) == permutations[-1]:
... |
c65501c5edf03d3a1ec87d3b354f146cfd2a8c73 | nlakritz/codingbat-python-solutions | /string-2/end_other.py | 131 | 3.65625 | 4 | def end_other(a, b):
a = a.lower()
b = b.lower()
if a[len(b)*-1:] == b or b[len(a)*-1:] == a:
return True
return False
|
d73baebf3de4278c93502f91a413462c9a0fdca6 | morita657/Algorithms | /Leetcode_solutions/intersection-of-two-arrays.py | 1,182 | 3.921875 | 4 | class Solution:
def set_intersection(self, set1, set2):
return [x for x in set1 if x in set2]
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
set1 = set(nums1)
set2 = set(nums2)
... |
1ceea47014d26bdddf95f31ee83db5383302618d | NielsHoogeveen1990/Customer-segmentation | /src/navara/preprocessing.py | 7,972 | 3.546875 | 4 | import pandas as pd
import numpy as np
from functools import reduce
from navara.utils import log_step
def read_data(data_path):
"""
Get data by specifying a datapath where the data is stored.
The different dataframes will be read first and subsequently, the duplicates will be dropped.
:param data_pat... |
f305e9a8b31d3d62bfb5dfd0729b81377de1030f | AlmazMardukhanov/Python | /less2/10.6.py | 194 | 3.828125 | 4 | sum=0
while True:
x=input('Введите число или "Стоп": ')
if str(x)=='Стоп':
break
else:
sum+=int(x)
print('Сумма чисел = ',sum) |
e4bd60fd564da459c510129f8de2ebdeecce7ea0 | snail15/AlgorithmPractice | /LeetCode/Python/SecondRound/121_bestTimeToBuyAndSellStock.py | 955 | 4.3125 | 4 | # Say you have an array for which the ith element is the price of a given stock on day i.
# If you were only permitted to complete at most one transaction(i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit.
# Note that you cannot sell a stock before you buy one.
# Example ... |
f4b568c05885db9cefc17876db371513fb30ae82 | 1473211439/autoTest | /tjd/wechat/test.py | 1,000 | 3.71875 | 4 | import math;
# 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if(i!=k and i!=j and j!=k):
# print("the number is %d%d%d" % (i,j,k))
print(i,j,k);
for i in range(10000):
#转化为整型值
x = int(math.sqrt(i... |
8e094e273d8b624d2bd3cfeaa99854bd0e22d6b0 | ShakibUddin/Scrapper-Web-Crawler-Projects | /BookLink.py | 1,375 | 3.546875 | 4 | from urllib.request import Request,urlopen
from bs4 import BeautifulSoup
from urllib.error import HTTPError
import re
def getData(url,tag=None,key=None,value=None):
try:
html = urlopen(url)
#incase of Forbidden HTTPError message use below code
#req = Request(url)
#html = urlopen(re... |
0c7e107bf53a2184d584ac2787d794e76f8cba46 | mfuentesg/problem-solving | /daily-coding-problem/problem_02.py | 550 | 3.953125 | 4 | """
Difficulty: Hard
Given an array of integers, return a new array such that each element at index i of the new array is the product of
all the numbers in the original array except the one at i.
For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our
input was [3, 2,... |
99dd00a9f509cda11514e3b03feb6971dc2c91ec | endar-firmansyah/learning | /multiplyall.py | 421 | 4.46875 | 4 | # Python program to multiply all values in the list using traversal
def multiplyList(myList) :
# Multiply elements one by one
result = 3
for x in myList:
result = result * x
return result
# Driver code
list1 = [1, 2, 3]
list2 = [3, 2, 4]
#list1 = float(input("Type for list1 number: "))
#list2... |
42fb2108f90af16f067f6f72bd3769ec969ce75f | Aasthaengg/IBMdataset | /Python_codes/p03289/s009570086.py | 442 | 3.5625 | 4 | import string
s=string.ascii_lowercase
s+="C"
S=input()
buttanA=False
buttanB=False
buttanC=True
for i in range(len(S)):
if S[0]=="A":
buttanA=True
if S[i]=="C" and 2<=i<len(S)-1:
if buttanB==False:
buttanB=True
else:
print("WA")
exit()
if S[i] n... |
84d46c0b7653070ec67ada1f57addb32cf5c26f4 | autumnalkitty/python_work | /Hello/test/Step08_Set.py | 1,275 | 3.59375 | 4 | # -*- coding:utf-8 -*-
'''
[set]
1. 순서가 부재
2. 중복 비허용
3. 집합(묶음)과 유사
'''
set1={10, 20, 30, 40, 50}
# 데이터 추가하기
set1.add(60)
set1.add(70)
# 중복된 데이터는 삽입 불가
set1.add(70)
set1.add(60)
set1.add(10)
# 저장된 개수는 len() 메소드를 이용
print "len(set1):", len(set1)
set2={60, 70, 80, 90, 100}
# set1 합집합 set2
re... |
867894bfff6a9941b1f0de19187c58be0f0613b1 | pranavraj101/python- | /list_user_input.py | 229 | 3.859375 | 4 | print('Input some values seprated by commas')
values=input()
list=values.split(',')
tuple=tuple(list)
for i in range(0,len(list)):
list[i]=int(list[i])
print("List:",list)
print("Tuple:",tuple)
l=[3,34,4,5,5,6]
print(list+l)
|
4a5077e5cdf94578d935f67f9fefd64e278313fd | sweeneyde/IndexedHeap | /indexedheap.py | 3,955 | 3.703125 | 4 | import pyheapq
from collections import defaultdict
class IndexedHeap:
"""A priority queue with the ability to modify existing priority.
>>> h = IndexedHeap(['1A', '0B', '5C', '2M'])
>>> h.pop()
'B'
>>> h.peek()
'A'
>>> h.change_weight('M', '6')
>>> h.pushpop('W', '7')
'A'
>>> ... |
d05f21c9ccacd773e1b5675a6bae2cc33057c0c6 | igorvalamiel/material-python | /Exercícios - Mundo 2/058.py | 329 | 3.78125 | 4 | from random import choice
print('')
print('Tente acertar o número escolhido pelo computador (de 0 a 10)!')
a = list(range(0, 11))
b = choice(a)
c = int(input('Seu palpite:'))
d = 1
while b != c:
c = int(input('Tente de novo:'))
d += 1
print(f'Parabéns! O número escolhido foi {b} e você acertou com {d} tentativa... |
9bf7189e0e0208671771a94f9f9cf0ea6c73b3d5 | jdh00127/movie_recommend | /movie_recommendation.py | 6,882 | 3.53125 | 4 | import re
import os
import math
import pandas as pd #✨중요 pandas 다운로드 받아야함 ✨중요
def main():
data = pd.read_csv("tmdb_5000_movies.csv", encoding = "CP949")
#data 갯수 4799개
print(data)
data = data.sort_values(["popularity"], ascending=[False])
print(data)
genres = data.pop("genres") #장르(여러... |
398dede051dfdcd9a524dd522dc677a8da565b84 | AloriumTechnology/AloriumTech_CircuitPython_EvoM51 | /examples/neo_blue.py | 530 | 3.546875 | 4 | """
`neo_blue`
========================================================
Copyright 2020 Alorium Technology
Contact: info@aloriumtech.com
Description:
This is a very simple CircuitPython program that turns the
Evo M51 NeoPixel blue.
"""
from aloriumtech import board, digitalio, neopixel
neo = neopixel.NeoPixel(board... |
9d37d6a56f50c96916cbaad8d782860cb373b59d | radhey24h/python | /learn-python/mapfilterreduce/filter_function.py | 202 | 3.78125 | 4 | def greater_then_two(n):
if n > 2:
return True
else:
return False
h1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
greater_numbers = filter(greater_then_two, h1)
print(list(greater_numbers))
|
887c979c663a05f973e5d445a770f723780cfa11 | SimonSlominski/Pybites_Exercises | /Pybites/272/strings.py | 752 | 4.09375 | 4 | from typing import List
def common_words(sentence1: List[str], sentence2: List[str]) -> List[str]:
"""
Input: Two sentences - each is a list of words in case insensitive ways.
Output: those common words appearing in both sentences. Capital and lowercase
words are treated as the same word.
... |
fdb2a4ca537356f43e3f5013701ba04abd3a30c9 | app-stack/l3codingpractice | /Demo_stopW.py | 2,978 | 3.8125 | 4 | from tkinter import *
# from tkinter import as Tkinter
import time
# Our GUI is defined here
root = Tk() # best to use root so you have menus!
root.title("Demo Stopwatch");
f = Frame(root); # f for frame!
f.pack(anchor = 'center', pady = 5);
root.minsize(width=260, height=80);
# root.geometry("200x300");
stop_start... |
064f96ea036c83e32f75ea45cf99541b62b6391d | Hironobu-Kawaguchi/atcoder | /atcoder/arc011_2.py | 476 | 3.828125 | 4 | # https://atcoder.jp/contests/arc011/tasks/arc011_2
N = input()
words = input().split()
rule = 'zrbcdwtjfqlvsxpmhkng'
d = {}
for i in range(10):
x,y = rule[2*i:2*i+2]
d[x] = str(i)
d[y] = str(i)
def convert(word):
res = ''
for char in word.lower():
if char not in d:
... |
b29f1be8ea90b476cbbd07ed50139a62b7ad9de9 | gautam-rangarajan/leetcode | /getIntersectionNode.py | 1,346 | 3.6875 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
len1, len2... |
4ff9d3fcc489a853114082f40280fc1df27426ac | slykid/Python3 | /Field Test Code/ex_200802.py | 311 | 3.75 | 4 | def add(x, y) :
number = 23
guess = 0
for i in range(1, 5):
if guess == number :
print("Yes")
break
if guess != number :
print("no")
guess += 1
else :
print("not number")
list_A = ["a", "b", "c"]
print(list_A[0])
|
2c04576a4a8cd5982b974bf8db2847be8ca49b6d | chanhuhu/side | /interview/codium/leapyear.py | 736 | 3.71875 | 4 | import unittest
import calendar
INPUT_SAMPLE = """\
1600 -> True
2000 -> True
1500 -> False
2004 -> True
2008 -> True
2010 -> False
"""
def isleap(year: int) -> bool:
if year % 400 == 0:
return True
if year % 400 != 0 and year % 100 != 0 and year % 4 == 0:
return True
return False
cla... |
6ea21be05c3dfb65e9bf0bc0505160a7a3c81d7a | ask902/AndrewStep | /2Nov.py | 252 | 3.796875 | 4 | import turtle
draw = turtle.Turtle()
draw.color('pink','blue')
draw.begin_fill()
draw.speed(6)
draw.shape("turtle")
while True:
draw.forward(350)
draw.left(170)
if abs(draw.pos()) < 1:
break
draw.end_fill()
turtle.done() |
182c2a04812180b77f9b6c4d142942cbf0e15c0e | tlee10/dataStructures | /bTree.py | 12,572 | 3.609375 | 4 | import random
"""
PROPERTIES OF B-TREE
1. Every node x has the following fields:
a. n[x], the number of keys currently stored in node x,
b. the n[x] keys themselves, stored in nondecreasing order, so that key1[x] ≤
key2[x] ≤ ··· ≤ keyn[x][x],
c. leaf [x], a boolean value that is TRUE if x is a leaf and ... |
c10ceb05f410dc3e76051b956e44a910906e8407 | vijayetar/dsa | /dsa/data_structures/linked_list/double_linked_list.py | 4,348 | 3.921875 | 4 |
#doubly linked list
class Node:
def __init__ (self,value, _next=None, _back=None):
self.value = value
self.next = _next
self.back = _back
def __str__(self):
return self.value
class DoubleLinkedList:
def __init__(self):
self.head = None
self.tail = None
... |
4259afe301d85a3214d4b024d30e3dd42d834be3 | 15110500442/pa- | /复习/pachong/教学代码/第六天/csv_01.py | 515 | 3.78125 | 4 | #是以逗号分割
import csv
#csv 文件读入
with open('zhiwei.csv','a') as csvfile:
#创建一个csv的文件操作句柄
fieldnames = ['title','job_type','need_pople','adress','publish']
writer = csv.DictWriter(csvfile,fieldnames=fieldnames)
#先写入头部信息
writer.writeheader()
#但行插入
writer.writerow(dict)
#csv 文件读取
with open('data.... |
a0db238bce249fc869f32fde4c20d7846c7777ce | fogugy/gb_algorithm | /#3_16.01/task3.py | 570 | 3.71875 | 4 | # В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
import random as rnd
ls = [rnd.randint(0, 100) for x in range(10)]
max_nmb = ls[0]
min_nmb = ls[0]
max_idx = 0
min_idx = 0
print(ls)
for idx, nmb in enumerate(ls):
if nmb > max_nmb:
max_nmb = nmb
max_idx = i... |
fc0d811125ff0d190ffbde21072c3892047a6175 | ams584/CS0008-f2016 | /ch3 examples/ch3-ex8.py | 858 | 3.921875 | 4 | # name : Alexander Shepard
# email : ams584@pitt.edu
# date :
# class : CS0008-f2016
# instructor : Max Novelli (man8@pitt.edu)
#
# Description:
# Starting with Python, Chapter 3, exercise 8
import math
people = int(input("Enter the number of people attending:")) #Recieves the number of people ... |
23ae35e077edd42d31c2aae912750a504814861d | vitoria/CompetitiveProgramming | /uri/1556.py | 360 | 3.71875 | 4 | while True:
try:
word = input()
new_words = set([])
for vowel in word:
for new_word in new_words.copy():
new_words.add(new_word + vowel)
new_words.add(vowel)
for new_word in sorted(new_words):
print(new_word)
print... |
43ab2ab643eb2218af0e74d384b3facdd1a10019 | semosso/lpthw | /old/old-hello.py | 361 | 3.859375 | 4 | # Simple print statement
print("hello world")
# Now testing multistrings in triple quotes
print(""""hello world", is what I'd say if I knew how to program.
Can I make multi string work?""")
# What about multistrings with normal quotes and \n (escape sequence)
print("\"hello world\", is what I'd say if I knew how to p... |
1b1fb49e8f46a429c1dfc2c7c367664d15a875eb | davidvela/MyFirstPythonProject | /zDataCamp/p1_IntroP4DS.py | 1,615 | 4.15625 | 4 | # *************************************************
# INTRO TO PYTHON FOR DATA SCIENCE
# *************************************************
# area variables (in square meters)
hall = 11.25
kit = 18.0
liv = 20.0
bed = 10.75
bath = 9.50
# house information as list of lists
house = [["hallway", hall],
["kitche... |
3e20489b796dd20344c8fc94e1a8391a7d8e6cae | outrageousaman/Python_study_marerial | /class_implimentation.py | 1,802 | 4.28125 | 4 | class Employee(object):
"""
base class for all employees
"""
empCount = 0
def __init__(self, name, salary):
"""
Constructor method
:param name: name of the employee
:param salary: salary of the employee
"""
self.name = name
self.salary = sal... |
8bdf42aff8314d342a2c020d09f5da2ca2bfe6cf | rubiruchi/nem-competition-model | /utils/nx-example.py | 894 | 3.90625 | 4 | import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
# Add a single node
G.add_node(1)
# Add a list of nodes
G.add_nodes_from([2,3])
# Add an edge between 1 and 2 and associate it with an object
G.add_edge(1,2, object={'number':2})
# You can do this for nodes and whole graphs also.
# Weight is a sp... |
310eda790c07da2cec5c9b5d566baf7f086646cb | akshay-s-022/APS-2020 | /Code Library/roots_of_QE.py | 212 | 3.953125 | 4 | from math import sqrt
a=1
b=2
c=1
d=b*b-4*a*c
if d<0:
print("Imaginary roots")
elif d>0:
s1=-b+sqrt(d)/(2*a)
s2=-b-sqrt(d)/(2*a)
print(s1,s2)
else:
print(-b//(2*a),-b//(2*a))
|
c1c6ea9b03b284948851e148e1a137d3b17d1096 | shravankumar0811/Coding_Ninjas | /Introduction to Python/2 Introduction to Python/Find Average Marks.py | 286 | 4 | 4 | ##Write a program to input marks of three tests of a student (all integers). Then calculate and print the average of all test marks.
# Read input as sepcified in the question
# Print output as specified in the question
a=int(input())
b=int(input())
c=int(input())
s=a+b+c
print(s/3)
|
e69218b1156cb349dec0b65c01e4b9f42eec9c3b | YMSPython/Degiskenler | /Lesson15/Ornek4.py | 1,439 | 3.875 | 4 | from abc import ABCMeta, abstractmethod
class BasePhone(metaclass=ABCMeta):
def __init__(self, marka, model, fiyat):
self.Marka = marka
self.Model = model
self.Fiyat = fiyat
@abstractmethod # abstract olarak işaretlenmiş bir nesnenin, gövdesi olamaz. zorunlu olarak overide edileceği... |
9e673dfb80ce076e10ba238939f9efb66dba35e2 | boss0703/AtCoder | /ABC192B.py | 195 | 3.578125 | 4 | s = list(input())
guu = s[0::2]
for m in guu:
if m.isupper():
print("No")
exit()
ki = s[1::2]
for m in ki:
if m.islower():
print("No")
exit()
print("Yes")
|
2a4b19d8d862fb51c39e5d43812f12aab1c8b3fa | Morelromain/OC_P4_chess_tournaments | /chess_tournaments/view/vmenu.py | 2,388 | 3.625 | 4 | """Menu view"""
class ViewMenu:
"""display menu"""
def menustart(self):
"""display menu start"""
print("\nTOURNOIS SUISSE\n\
1 : Voir précédants tournois\n\
2 : Voir liste joueur Base de donnée\n\
3 : Changer Elo d'un joueur\n\
4 : CREATION DU TOURNOI ET DES JOUEURS\n\
5 : Voir info round\n\
... |
9f672c89c86c618cc05cd59705df6715035d01e2 | AmitKulkarni23/Leet_HackerRank | /Google/Hard/128_longest_consecutive_sequence.py | 1,076 | 3.78125 | 4 | # Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
#
# Your algorithm should run in O(n) complexity.
#
# Example:
#
# Input: [100, 4, 200, 1, 3, 2]
# Output: 4
# Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
def long... |
ee1d728b08de294458247a524117f8e140856f26 | SeongHyeok/SoftwareDesign | /day05/day05.py | 1,332 | 3.5 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 16:46:03 2014
@author: sim
"""
def get_cumul_sum(l):
"""Exercise 10-3 (from Think Python)
"""
s = 0
r= []
for i in l:
s += i
r.append(s)
return r
print get_cumul_sum([1, 2, 3])
print get_cumul_sum([1, 2, 3, 4, 5, -15, 3])
def ... |
f197e3378ae741150c127d87fa77309fd31bc5e3 | manurp/Python_programs | /employee_class.py | 3,006 | 3.515625 | 4 | class Employee:
num_of_emps=0
raise_amt=1.04
def __init__(self,first,last,pay):
self.first=first
self.last=last
#self.email=first+"."+last+"@company.com"
self.pay=pay
Employee.num_of_emps+=1
#def fullname(self):
# return '{} {}'.format(self.first,self.last)
@property
def email(self):
return '{}.{... |
062c0eca341b07b075dfa1b73308de667eb11970 | Tebs-Lab/intro-to-programming | /exercises/writing-exercises/solutions/03-find-duplicates.py | 1,817 | 4.375 | 4 | """
Complete this function such that it returns a new list
which contains all values that appear more than once in
the list passed into the function. Each duplicated value
should appear exactly once in the output list regardless
of how many times it is duplicated.
If no items are duplicated, return an empty list.
Th... |
7902b4371b52d1ffa96ed2da740d137d6d02b95b | PhyzXeno/pythonScripts | /Practice/urllib2/url.py | 630 | 3.546875 | 4 | #发现一个文件目录可访问的地址
import urllib.request
import ssl
import os
file_o = open(os.getcwd() + '\\' + 'back.txt', 'wb+')
def main():
context = ssl._create_unverified_context()
command = '/bin/ls'
url = "https://124.198.30.200/js/../../../../../../../.." + command + "%00.css"
# url = "https://124.198.30.200/js/... |
c4f7184967025d840cde3c3f5f0de660b033d41f | saurabhceaseless/Python-Tkinter-Stuff | /calculator.py | 3,459 | 4.25 | 4 | ...
A simple Python Tkinter based calculator, for now it can only perform addition and subtraction
The code is very simple, the first Tkinter program I wrote to build a simple calculator
...
from tkinter import *
root = Tk()
root.title("Saurabh's Calculator")
e = Entry(width=30, borderwidth=5)
e.grid(ro... |
905a041413fcbd266637408bd76385875cfe8875 | MaratAG/GB_mains_of_python | /lesson_4_3.py | 358 | 4.125 | 4 | """
3. Для чисел в пределах от 20 до 240 найти числа, кратные 20 или 21. Необходимо решить задание в одну строку.
"""
start_number = 20
finish_number = 240
multiple = 20
output_list = [item for item in range(start_number, finish_number) if item % multiple == 0]
print(output_list)
|
4c900ee18ea3772db233776fff935eb34891eaa6 | arifinsugawa/CP1404Assignments_ArifinSugawa_jc261529 | /test_song.py | 552 | 4.25 | 4 | """This is to test for Song."""
from song import Song
# Default test for an empty song
song = Song()
songlist = []
print(song)
assert song.artist == ""
assert song.title == ""
assert song.year == 0
assert song.is_required
# To test the song's initial value
song2 = Song("Amazing Grace", "John Newton", 1779, True)
song... |
9b6eb723515e035ed512ee458bd5b660768d0cd2 | arleyribeiro/solving-problems-and-studies | /hackerrank/python_language_proficiency/tinta.py | 1,423 | 4.125 | 4 | import math
area_para_pintar = float(input("Insira o tamanho em m² da área a ser pintada: "))
# Constantes
COBERTURA_DA_TINTA_LITRO_POR_METRO_QUADRADO = 6
QUANTIDADE_TINTA_LATA = 18
PRECO_POR_LATA = 80
QUANTIDADE_TINTA_GALAO = 3.6
PRECO_POR_GALAO = 25
quantidade_necessaria_de_tinta = area_para_pintar / COBERTURA_DA... |
3fccfaadfec780de81ba5d82a162546f080465ff | NataljaRokina/Python_training_NR | /New_project_24_09/Python_new.py | 107 | 3.921875 | 4 | dinner = input(f"What will be for the dinner today?")
dinner = str(dinner)
print(f"we will eat {dinner}") |
863595669afcc7a2ebe6f652597bf2410bebdc45 | recardona/Coursera-AI-Planning | /week1/src/missionaries.py | 6,924 | 3.65625 | 4 | #!/usr/bin/python
'''
week1.missionaries.py
@author: recardona
'''
from search import tree_search
from search import SearchProblem
from action import Action
from state import State
from successor import SuccessorFunction
def main():
move_one_missionary = Action("Move One Missionary")
move_two_miss... |
907108b0eb4e7cb5f93d387457360e501e8a7aa2 | hoytchang/Programming-Bitcoin-Exercises | /ecc.py | 7,170 | 3.546875 | 4 | import math
import hashlib
import hmac
class FieldElement:
def __init__(self, num, prime):
if num < 0 or num >= prime:
error = 'Num {} not in field range 0 to {}'.format(num,prime-1)
raise ValueError(error)
self.num = num
self.prime = prime
def __eq__(self, other):
if other is None:
return False... |
c10a68a8e86bb80b72b02e92899556c93fab7360 | rtain/RM_ICS_Debugging_Challenge | /Debugging Challenge_2/02HW_Q3_ICS: Debugging Challenge #2 (Run Time errors).py | 2,150 | 3.796875 | 4 | from tkinter import *
print('henry')
# Base window - this is required in order for the program to run
win=Tk()
# Title setting for the program window
win.title("Get those frames to fit!")
# Mainframe that holds everything, the big bag!
mf=Frame(win)
mf.grid(row=0, column=0)
# Widget Holders - Frames
# These frames a... |
8546f9670bf8c79e26bf2f16510f709784670b33 | JoaoFelipe-AlvesOliveira/LearningPython | /Functions/exercicio_1.py | 339 | 3.765625 | 4 | def calcularAumentoSalario(salario):
if salario <1000:
aumento = salario*10/100
else:
aumento = salario*5/100
return aumento
salario = float(input("Digite o valor do salário"))
aumento = calcularAumentoSalario(salario)
novoSalario = salario+aumento
print ("O valor do salário com o aumento é... |
6fc6704596c446589ca71e66e11c015804cbd6e8 | josedom24/plataforma_pledin | /cursos/_python3/python3/curso/u18/ejercicio5.py | 146 | 3.921875 | 4 | #!/usr/bin/env python
for numero in range(1,6):
for cont in range(1,11):
print ("%2d * %d = %2d" % (cont, numero, cont * numero))
print()
|
a2f7075175719be6d3a7eba779a7edb55f8fb6bb | WingFung/Scripts-Tools | /test-port.py | 742 | 3.59375 | 4 | import socket
import sys
host = None
port = None
if len(sys.argv) == 2:
user_input = sys.argv[1]
elif len(sys.argv) > 2:
user_input = sys.argv[1] + ':' + sys.argv[2]
else:
user_input = input('Please input the host and port for connection test:\n')
user_input = user_input.strip().replace(' ', ':')
if ':' i... |
03c758a0438659420714f08f05f67503989244dd | BjaouiAya/Cours-Python | /Course/Web_course/Sam&Max/heritage_multiple.py | 3,221 | 4.125 | 4 | #! /usr/bin/env python
# -*- coding:Utf8 -*-
"""MULTIPLE INHERITANCE : I HAVE A LOT OF MOTHER """
"SAM AND MAX"
########################################
#### Classes and Methods imported : ####
########################################
#####################
#### Constants : ####
#####################
##############... |
8d3aed144a08fae5f6933e8cef601cf97951de72 | zepam/uw_nlt_ling570_shallow_nlp | /assignments/ling_570_h5_ngram_count/build_lm.py | 7,464 | 3.5 | 4 | #!/usr/bin/python3
"""#### LING 570: Homework #5 - Ryan Timbrook ############
Author: Ryan Timbrook
Date: 11/1/2018
Q2: Write build_lm
This shell script executes a python program that builds an LM using ngram counts:
Format: command line: build_lm.sh ngram_count_file lm_file
Input File: ngram_count_file (produced as ... |
a7a7dfc3d4e41a3ee5ff070516e1d3627c035898 | darksugar/pythonProjects | /day01/password.py | 332 | 3.78125 | 4 | #Author:Ivor
import getpass
_username = "Ivor"
_password = "abc123"
username = input("username:")
password = input("password:")
#password = getpass.getpass("password:")
if username == _username and password == _password:
print("Welcome user {name}".format(name=_username))
else:
print("Invalid username or passw... |
8342b7580411f32efb677dc31882938949405aa4 | wasimpinjari/python-codes | /Assinment 1.py | 4,094 | 3.90625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 17:13:16 2021
@author: admin
"""
#Q1. Print the following statements as a message in python interpreter.
st1= 'Charlie said “We have to buy dinner and I have only $10 with me.”'
print(st1)
st2= "Please get my pencil from Virendra’s bag."
print(st2)
print('Name\tAge \... |
9e51d00bffb0d756cdbc246a6cc7d126ff053601 | Wieschie/time_tracker | /sample/TimeAction.py | 1,260 | 3.640625 | 4 | from argparse import Action
from datetime import datetime
import pytz
from tzlocal import get_localzone
class TimeAction(Action):
""" Custom argparse action that validates a user-entered time and converts to a datetime object
with the current date.
"""
def __init__(self, option_strings, dest,... |
11469f7d6a3079419b2219fd8daa6ad672d80599 | Preshehi/reservoir-engineering | /Unit 7 Introduction to Well-Test Analysis/functions/regression.py | 520 | 4.03125 | 4 | def regression(x, y):
# x, y must be in NUMPY ARRAY
"Linear Regression"
import numpy as np
# number of observations/points
n = np.size(x)
# mean of x and y vector
m_x, m_y = np.mean(x), np.mean(y)
# calculating cross-deviation and deviation about x
SS_xy = np.sum(y*x) - n... |
ec072cda3f52962ce592060ebc2d58c1370a7c55 | blairg23/movie-file-fixer | /src/utils/utils.py | 5,823 | 3.78125 | 4 | # -*- coding: utf-8 -*-
"""
Description: A compilation of utility methods for testing or production purposes.
"""
import hashlib
import math
import os
import pathlib
import shutil
def listdir_fullpath(directory):
"""
:param str directory: The directory to search in.
:return list: A list of files and fo... |
dce4edf32b59245bbf03bdf5f5d68a69e49a2bd8 | ngvinay/python-projects | /PythonAdvanced/src/exercises/zip_fn.py | 380 | 3.5625 | 4 | #Print out in each line the sum of homologous items of the two sequences.
a = [1, 2, 3]
b = (4, 5, 6)
for i, j in zip(a, b): #zip combines two sequences
print i + j
#print
#ab
#cd
import string
with open("letters.txt", "w") as file:
for letter1, letter2 in zip(string.ascii_lowercase[0::2], string.ascii_lo... |
2f44d6d704cff9f3c9d08707a3eac38f5a228471 | dimdred/Lynda | /Learning python/variables.py | 330 | 4 | 4 | #declare a variable
f = 0;
f1 = 1;
print f
print f1
#re-declaring a variable
f = "abc"
print f
#error: different types combined
#print "string type " + 123
print "string type " + str(123)
#global vs local variables in functions
def SomeFunction():
global f
f = "def"
print f
SomeFunction()
print f
del f... |
5615afa3da9bf1d85bec7039a97ee9dd43646355 | algorithmrookie/Alan | /week5/[22]括号生成.py | 638 | 3.53125 | 4 | # 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。
#
#
#
# 示例 1:
#
#
# 输入:n = 3
# 输出:["((()))","(()())","(())()","()(())","()()()"]
#
#
# 示例 2:
#
#
# 输入:n = 1
# 输出:["()"]
#
#
#
#
# 提示:
#
#
# 1 <= n <= 8
#
# Related Topics 字符串 动态规划 回溯
# 👍 1854 👎 0
# leetcode submit region begin(Pro... |
8d23072e669a14e1c362c30c86e6a8f49d6dc9a1 | marythought/sea-c34-python | /students/KimNighelli/session02/series.py | 3,363 | 4.28125 | 4 | #############################################
# This is for Task 4- Mathematical Series
############################################
'''
Fibonacci Series
0, 1, 1, 2, 3, 5, 8, 13, ...
The function for a Fibonnaci series is F(n) = F(n-1) + F(n-2)
Where n is the nth number in the series.
What we know- F(0) = 0, F(1) = 1,... |
b5718afa4591960f9db7516b57e5d248a0b4361e | bishalkunwar/Random_practics_Python | /randomNumberGuessing.py | 1,252 | 3.984375 | 4 | #WAP in python to generate random number only three time if the guess numbr is equal to
# random number generatd then increase the counter by 1 and if not then decrease the counter by 1 if the
# total value reached maximum to 25 then Player win the matched if not then failed or loose the game.
#Solution
import ... |
81f5f7c37bc67740a6b776e3428886efbabd3d24 | kbergerstock/myProjects | /projects.python/hat/py_hat.py | 1,557 | 3.84375 | 4 |
#krb 1/17/2013 turtle exercise
from tkinter import *
import math
import datetime
import time
def calcCX(width):
return width / 2
def calcCY(hgt):
return int(((float(hgt)/2.0) * 9.0) / 10.0)
class mCanvas(Canvas):
def plot(self,sx,sy,color):
self.create_line(sx,sy,sx+1,sy,fill=color)
def drawHat(... |
c74e36cc42aa212f86b8333f18a27d0c10caa12f | HyoHee/Python_month01_all-code | /day08/homework/homework01.py | 342 | 3.546875 | 4 | """
定义函数,计算社保缴纳费用
"""
def calculate_insurance(money):
"""
计算社保费用
:param money: 税前薪资,float类型
:return: 计算后社保缴纳费用,float类型
"""
return money * (0.08 + 0.02 + 0.002 + 0.12) + 3
print(f"需要交纳社保:{calculate_insurance(10000)}元")
|
777c7db003b19331d9796744c07d9053021bd0e1 | MichelleMoran431/Muti-paradigm-programming-2021 | /week 8/Person.py | 1,109 | 3.9375 | 4 | class Person:
def __init__(self,n,a):
self.name = n
self.name = a
# property age = whatever the age is enter
def age (self):
return self._age
# this is the age setter - sets criteria for the age entered ,more than 1 and less than 120. controlling the data entered
def age ... |
70a332477067066a18fbd8577afb39c159f8ee02 | nimishmaheshwari/DataStructures_and_Algorithms | /Practice/Array Input.py | 273 | 4 | 4 | a=int(input("Enter the number of elements in the array"))
lst=[]
for i in range(0,a):
n=int(input("Enter the number of elements in array"))
lst1 = []
for j in range(0,n):
m=int(input( ))
lst1.append(m)
lst.append(lst1)
lst1=[]
print(lst) |
16f3061bc8dec9be60aaf36183ca7045b73234a4 | wearepal/fairness-comparison | /analysis/plot_helpers.py | 14,994 | 3.8125 | 4 | """
Functions that are helpful for plotting results
"""
from pathlib import Path
from collections import namedtuple
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
# data that will appear as one entry in the legend of a plot
DataEntry = namedtuple('DataEntry', ['label', 'values', 'do_fill... |
5ea867db6a67ecdd71927b94eb486710619e102b | stoicamirela/PythonScriptingLanguagesProjects | /Project1/Ex1.py | 330 | 3.984375 | 4 | #simple exercise of asignments of numbers, doubling the number, changing values, print them
number = 15
print(number)
number = 2 * 15
print(number)
my_string = "apples"
print(number, my_string)
# print(my_string)
numberSquared = number ** 2
my_string = "pears"
print(numberSquared, my_string)
# print(my... |
1f30fcfe4241203894da087849a737655530dd18 | waseemtannous/PathFinding | /main.py | 3,537 | 3.625 | 4 | from tkinter import *
from tkinter import filedialog
from AlgorithmType import *
from Maze import Maze
from Node import Node
def import_file(): # a function to read a text file and analyze it
global maze
# asks the user to input a valid file
file = filedialog.askopenfilename(initialdir="/", title="Selec... |
23134a8757ff7c9ddeb0ff619c2453be83ba9560 | RahulKachhap/python-files | /bifraction.py | 624 | 3.671875 | 4 | def possiblespilt(length):
options=[]
print(length)
for v in range(length):
options.append([v,length-v])
return options
number=[1,2,1,2,1]
spilt = possiblespilt(len(number))
result = []
print(spilt)
for option in spilt[2:3]:
res = []
for val in option:
add = 0
... |
ad74a7ee6aeb1e37160bfa960102ecee8e8c33ca | LuisClavero/bucleswhile | /mayork07.py | 478 | 3.953125 | 4 | #coding: utf-8
minimo=input("Escriba un mínimo:")
maximo=input("Escriba un máximo:")
suma=0
cont=0
while minimo>maximo:
minimo=input("Error, introduzca otro numero mínimo:")
maximo=input("Escriba otro numero máximo:")
while minimo<maximo and suma==0:
aux=input("Introduzca un numero:")
if aux<=maximo and aux>=minimo... |
f3ce6e92b6c36886d9556bba48268fa62d34a326 | utakatano/docker-python-template | /app/src/c2/bmi.py | 561 | 4.375 | 4 | # BMI calculation program
weight = float(input("weight(kg)? "))
height = float(input("height(cm)? "))
# BMI calculation
height = height / 100 # convert into meter
bmi = weight / (height * height)
# branch result by BMI value
result = ""
if bmi < 18.5:
result = "skinny type"
# if (18.5 <= bmi) and (bmi < 25):
if ... |
29ef293f6788b4d70189b5d61e759f6a8b064c68 | CaioHoly/Python-3-Mundo-1 | /ex0030.py | 179 | 3.921875 | 4 | num = int(input('Digite o número: '))
resto = (num % 2)
if resto == 1:
print('O número {} é ímpar'.format(num))
else:
print('O número {} é par'.format(num)) |
d9062415573b281be97ab7661df7c6417ba4f188 | ambition121/python | /three_changes.py | 385 | 4.25 | 4 | valid=False
count=3
passwordlist=('123','234','456','567')
while count>0:
password=raw_input("Enter your the num's password:")
for num in passwordlist:
if password == num:
valid=True
print 'right'
break
if not valid:
print "invalid password"
... |
f871db53373e6dbccfea841e108fcdf7fb0fd3ef | jacquelineawatts/Dicts_Restaurant_Ratings | /restaurant-ratings.py | 3,075 | 4.28125 | 4 | import sys
from random import choice
def convert_to_dictionary():
"""Read file and creates dictionary key and value pairs."""
filename = open(sys.argv[1])
restaurant_ratings = {}
for line in filename:
line = line.rstrip()
words = line.split(":")
restaurant_ratings[wor... |
c3ab8e8d2ea8052030302d866dfcef9e5d3f91a9 | luodanping/learn-python-by-coding | /design_pattern/21_state.py | 1,749 | 3.765625 | 4 | #state
class State:
"""Base state. This is to share functionality"""
def scan(self): #scan依次调台,会改变状态
"""Scan the dial to the next station"""
self.pos+=1
if self.pos==len(self.stations):
self.pos=0
print("Scaning ... Station is",self.stations[self.pos], sel... |
1f71c600c407201e515758e3368072ffb02228ea | Aasthaengg/IBMdataset | /Python_codes/p02694/s905995313.py | 195 | 3.625 | 4 | from decimal import Decimal
X = int(input())
n = 0
money = 100
while True:
money += int(money * Decimal("0.01"))
#print(money)
n += 1
if money >= X:
print(n)
break |
524ed49c8d55ad11e49ebfca72cce43e0c41f6c4 | yjioni/SSAC_3_Python_2 | /12_gender_graph_barh.py | 830 | 3.5 | 4 | import csv
import matplotlib.pyplot as plt
from tkinter import *
from tkinter import filedialog
root = Tk()
root.filename = filedialog.askopenfilename(
title='choose csv file',
initialdir='C:/Users/',
filetypes=(('csv files', '*.csv'),
... |
518a7b9d794e15f081cf4b21446bf8e14c82ca4a | anatoly-kor/yap-test | /task_1/precode.py | 438 | 3.9375 | 4 | def make_divider_of(divider):
def division_operation(divisible):
# Ваш код здесь
# Создали функцию
div2 = make_divider_of(2)
print(div2(10)) # Такой вызов должен вернуть 10/2, то есть 5.0
div5 = make_divider_of(5)
print(div5(20)) # Такой вызов должен вернуть 4.0
print(div5(div2(20))) # Такой вызов д... |
1af3a49c943312f43f2eefe9f50723b5a6e5f258 | Rajmanglam/tutorials | /tutorial 53 Single Inheritance.py | 2,205 | 4.4375 | 4 | class employee2():
no__of__leaves=10
def __init__(self,aname,arole,asalary):
self.name=aname
self.role=arole
self.salary=asalary
def info(self):
return f'the name is {self.name}. salary is {self.salary}'
# we know that all functions in a class takes self as default but... |
f91c9dd7ea1c66a0a757d32dc00c3e1f0adef7e7 | udhayprakash/PythonMaterial | /python3/06_Collections/03_Sets/a_sets_usage.py | 1,219 | 4.40625 | 4 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Purpose: Working with Sets
Properties of sets
- creating using {} or set()
- can't store duplicates
- sets are unordered
- can't be indexed
- Empty sets need to be represented using set()
- stores only immutable object - ... |
ddbf22dac485bbec96581cf1b52fc83641a86d6b | alejarojas19/programacion1 | /talleres/recopilatorioExamen2.py/punto1.py | 742 | 3.609375 | 4 | listaDolares = [20000, 30000, 4000, 2500, 1000, 7600 ]
preguntaMoneda = """
C- mostar lista en pesos
D- mostar lista original en dolares
E- mostar lista en euros
"""
listaPesos = []
for elemento in listaDolares:
listaPesos.append(elemento*3700 )
listaEuro... |
2badeb1d9cd832be27b926b7625b2c3de4728a27 | ziqingye0210/AI-with-Pyke | /src/tests/test2.py | 1,408 | 3.828125 | 4 | # -*- coding: utf-8 -*-
#####################################################################
# This program is free software. It comes without any warranty, to #
# the extent permitted by applicable law. You can redistribute it #
# and/or modify it under the terms of the Do What The Fuck You Want #
# To Public Lic... |
3abd3cc8f3ad048cd377eb81a0d96ff8ff397fab | mauriciozago/CursoPython3 | /Exercicios/ex103.py | 361 | 3.734375 | 4 | def ficha(nome='<desconhecido>', gols=0):
print(f'O jogador {nome} fez {gols} gol(s) no campeonato.')
jogador = str(input('Nome do Jogador: '))
gol = str(input('Número de Gols: '))
if jogador == '' and gol == '':
ficha()
elif jogador == '' and gol.isnumeric():
gol = int(gol)
ficha(gols=gol)
else:
... |
e0a66c7fd14b1b1a5f036475fd55f0ab5ab03a60 | Boris-Rusinov/BASICS_MODULE | /EXAMS/Practice/6 and 7 July 2019/Ex05-Football_Tournament.py | 991 | 4.0625 | 4 | football_team = input()
season_total_games = int(input())
if season_total_games < 1:
print(f"{football_team} hasn't played any games during this season.")
else:
season_total_points = 0
total_wins = 0
total_draws = 0
total_losses = 0
win_rate = 0.00
curr_game_end_result = ""
for curr_g... |
981b8601b65e873ed1550ad73fe454469ce1f2e8 | my-xh/cs-course-project | /homework/12_1_1.py | 1,083 | 3.546875 | 4 | """
通用的深度优先搜索
"""
from pythonds.graphs import Graph
class DFSGraph(Graph):
def __init__(self):
super().__init__()
self.time = 0 # 增加一个time 记录当前时间
def dfs(self):
for a_vertex in self: # 初始化所有点节点是白色
a_vertex.setColor('white')
a_vertex.setPred(-1)
for ... |
79bdd4a43c5eefd0a10d7b3c741d6630f362e913 | standrewscollege2018/2020-year-11-classwork-htw0835 | /list-sum.py | 685 | 3.96875 | 4 | """This is the list-sum exercise."""
#declare variables and list
int_input = 0
int_list = []
#intro message
print("While prompted to input, enter -1 to end program and print results.")
#begin while loop
while int_input != -1:
#recieve input
int_input = int(input("Enter a number.\n"))
#if the input is not -1... |
3e63aa4464698d9c254acbc385a426964835fadf | altarimig/week3-session3 | /conditional-sentences.py | 362 | 3.6875 | 4 | """palabras = ["gato", "perro", "ventana", "defenestrado"]
for val in palabras:
if val == "ventana":
break
print(val)
print("Final!!!")"""
##### RETO #####
lista = [1, 3, 20, 10, 50, 100, 31, 1000]
for val in lista:
if val == 3:
print(val)
if val % 2 == 0:
print(f"El valor {val... |
40d9e72c863bf1169156fe6d9b64928864da8a58 | KoeKuacho/projecteuler_solved_problems | /task_17.py | 1,967 | 3.984375 | 4 | """
Problem 17: Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19
letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count... |
5cb3b70a7ec7970145fa36df414fc5f0ef9ed5fd | Chatti5115/pythonProject2 | /queue_example.py | 1,148 | 4.03125 | 4 | import queue
# # Queue() 로 큐 만들기(가장 일반적인 큐, FIFO(First-In, First-Out)
# data_queue = queue.Queue()
#
# data_queue.put("funcoding")
# data_queue.put(1)
#
# print(data_queue.qsize())
# print(data_queue.get())
# print(data_queue.qsize())
# print(data_queue.get())
#
# print("----------------------")
# # Lifo Queue() 로 큐 만... |
d44f71bc7612f2a9f39cedadeb886dfeeca259de | karalyndewalt/number_game | /dictionary.py | 4,709 | 4.40625 | 4 | stores = {"target":["socks", "soap", "detergent", "sponges"],
"bi-rite": ["butter", "cake", "cookies", "bread"],
"safeway": ["oreos", "soda", "brownies"],
"berkeley bowl": ["apples", "oranges", "bananas", "milk"],}
def main_menu(): #0
print """
0 - Main Menu
1 - Show ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.