blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
fdaa18489460a44819b1d5365b8db8358d12ba54 | nguyenmanhtrung/trungza1 | /nguyenmanhtrung_44617_ca18a1a-cp4/nguyenmanhtrung_44617_ca18a1a/excercise/page_109_exercise_01.py | 1,117 | 4.09375 | 4 | """
Author:Nguyễn Manh Trung
Date: 24/09/2021
Problem:
Write the encrypted text of each of the following words using a Caesar cipher with
a distance value of 3:
a. python
b. hacker
c. wow
Solution:
plainText = "python"
distance = 3
code = ""
for ch in plainText:
ordvalue = ord(ch)
cipherValue = o... |
162ec8acf6eb38eb8291d8d52221615428cc9c3a | afzalali27/Python | /task1/question1sol.py | 70 | 3.90625 | 4 | n = int(input('Enter an integer : '))
n = n+(n*n)+(n*n*n)
print(n)
|
09479ca5e30a6792cfafcb15e3057808f79cae44 | khelwood/advent-of-code | /2020/06_customs.py | 511 | 3.640625 | 4 | #!/usr/bin/env python3
import sys
def input_blocks(data):
return data.split('\n\n')
def block_intersection(block):
lines = block.splitlines()
return set.intersection(*map(set, lines))
def main():
blocks = input_blocks(sys.stdin.read().strip())
any_sum = sum(len(set(filter(str.isalpha, block))) f... |
346ee84938d0911846cd3ed3a4bd118a0b088f59 | sahasukanta/foosPong-repo | /foosPong.py | 13,756 | 3.671875 | 4 | import pygame
def main():
pygame.init()
# making the main window screen
size = (1280,720)
screen = pygame.display.set_mode(size)
# window title
title = "Pong"
pygame.display.set_caption(title)
# window icon
icon = pygame.image.load("pong_ball.png")
pygame.display.set_icon(icon... |
5311b343ff1fcc85e7273b35e67024e4e91d9abf | ssandyy/pythonpro | /printname.py | 84 | 3.734375 | 4 | name=input("please entre your name = ")
for i in range(1,11):
print(i,".",name)
|
605cbb2aa45f2c978b119e43e17e3e17dfee97ed | Aasthaengg/IBMdataset | /Python_codes/p03567/s712084045.py | 127 | 3.5 | 4 | S=input()
ans="No"
for i in range(len(S)):
if "AC" == S[i:i+2]:
ans="Yes"
break
print(ans)
|
f9fbddf7666f8a3faf7f8ea28a18a4594d2fe7e4 | jbothmann/test_man_0.8 | /tkSelectLabel/__init__.py | 2,951 | 4.03125 | 4 | import tkinter as tk
#SelectLabel, a tkinter widget that extends Text. This widget is meant to have similar functionality to a Label, but with highlightable text.
class SelectLabel(tk.Text):
def __init__(self, root, text="", justify=tk.CENTER, relief=tk.FLAT, wrap="none", shrink=True, **kwargs):
if 'state' in kwar... |
6b3b864e14104ee9a7ff64d79e4e48a7fc53e8c6 | syx200/blue_dark | /myclock.py | 577 | 3.734375 | 4 | class Clock(object):
def __init__(self, hour=0, minite=0, second=0):
self.__hour = hour
self.__minite = minite
self.__second = second
def run(self):
self.__second += 1
if self.__second == 60:
self.__second = 0
self.__minite += 1
if sel... |
e5053cafc19eb1d737033638ca5ec4016c97875c | ManikSharma001/2019-CCC-Senior-2-PrettyAveragePrimes | /2019CCC Problem S2 Pretty Average Primes.py | 1,487 | 3.84375 | 4 | numofInput = int(input())
primeSet = []
for i in range(numofInput):
line = int(input())
primeSet.append(line)
print("Starting...")
def findp(n):
global primes
primes = [2, 3] # seed with first two primes
while primes[-1]< n:
# Find next prime
# start with next odd numbe... |
957ad3b2af23abbbe8bdaf74a059d3cfe035b86b | flora5/py_simple | /class_2.py | 1,770 | 4.28125 | 4 |
# class method, static method, instance method
# inner working of instance method is the same as the calss method
# Actually ,python automatically maps an instance method call to a class
# method
#instance.method(args...)
#will be automatically converted to a class method function call like this
# class.method(in... |
584888a635c64492c9b6ce93c08de91228bd31e1 | ruozhizhang/leetcode | /problems/backtracking/Reconstruct_Itinerary.py | 2,060 | 4.34375 | 4 | '''
https://leetcode.com/problems/reconstruct-itinerary/
Given a list of airline tickets represented by pairs of departure and arrival airports
[from, to], reconstruct the itinerary in order. All of the tickets belong to a man who
departs from JFK. Thus, the itinerary must begin with JFK.
Note:
If there are multiple ... |
aa979546cfb91588d57b18c31049e0489a3303b1 | mlars84/oop_python | /helloworld.py | 196 | 4.0625 | 4 | five = 5
two = 2
if five < two:
print("Hello, World!")
else:
#My first variable
variable = 'Five is greater than two dummy!'
#Python comment
print(variable, 'cool beans man') |
dd5310676e939b420fa16f84a783c9d9008de752 | csknk/number-theory-notes | /code/python/fast-exp/main.py | 809 | 4.40625 | 4 | #!/usr/bin/env python3
def exponent_power_of_2(a, e_power2, mod):
count = 0
for i in range (0, e_power2):
a = (a * a) % mod
count += 1
return (a, count)
def rec(x, n, mod):
if n < 0:
return rec(1 / x, -n, mod)
if n == 0:
return 1
if n == 1:
return x
... |
8bba2948e916f49b9ed8e69e9e15ceba30d37a8e | SkewwG/Python_demo | /demo_class/demo_muke7.py | 997 | 3.765625 | 4 | #类的魔法方法
'''
转换为字符串
__str__(self) 转换给人看
__repr__(self) 转换给电脑看
__unicode__(self)
展现对象属性
__dir__ 展现属性
'''
class demo_Class():
def __init__(self,name,age):
self.name = name
if isinstance(age,int):
self.age = age
... |
0570301249b0e7511b0636b744e6c3bb8a5af53c | acgis-macl0468/gis4107-day12 | /ShapesUsingInit.py | 1,608 | 4.1875 | 4 | # -*- coding: UTF-8 -*-
# ------------------------------------------------------------------------------
# Name: exercise_template.py
#
# Purpose: Brief desciption of what module does
#
# Usage: Module name and required/optional command-line parameters (if any)
#
# Author: Your name(s)
#
# Created... |
8e392989c8637a1c0416947de2fa141eec822b29 | Blankit/leetcode- | /basic/merge1.py | 668 | 3.609375 | 4 | class Solution(object):
def merge(self, nums1, m, nums2, n):
i = 0
j = 0
r = []
while ((i < m) &(j<n)):
if nums1[i] < nums2[j]:
tmp = nums1[i]
i += 1
else:
tmp = nums2[j]
j += 1
r.ap... |
0f406dcb1dc99dbe39587f1edaa490bd233dc3c0 | manojakumarpanda/This-is-first | /sequence/string/removing the ch of s1 present in s2.py | 303 | 4.09375 | 4 | #remove the character from first string presnt in the second string
st=input('Enter the first string for compairision:')
st2=input('Enter the second string for the compairision:')
st3=str()
for ch in st2:
if ch in st:
st3+=ch
print('The characters in first string and second string ::',st3)
|
136131c9fb2bec1a7f6e29b5494fb1676b217028 | macabdul9/face-recongnition-with-knn-using-opencv | /src/face_detection.py | 3,488 | 3.65625 | 4 | import cv2
import numpy as np
# function to detect the face, eye and smile
def detect(frame):
# cascade classifiers
face_cascade = cv2.CascadeClassifier("./dataset/haarcascades/haarcascade_frontalface_alt.xml")
eye_cascade = cv2.CascadeClassifier("./dataset/haarcascades/haarcascade_eye_tree_eyeglasses.xml... |
1a56df0adc70809fda8a1b304c43135b58059778 | andrewmccullough/CS1111 | /exam-review/2016spring16.py | 325 | 3.546875 | 4 | def word_wrap (paragraph):
words = paragraph.split()
lines = []
current = ""
while words > 0:
if len(current + words[0]) <= 80:
current += words[0]
words.pop(0)
else:
lines.append(current)
current = ""
for line in lines:
print(l... |
a11e09bc2137a365506664cd476933baac2ec439 | yycc179/ml | /KNN/te.py | 388 | 3.703125 | 4 | import KNN
from numpy import *
dataSet, labels = KNN.createDataSet()
testX = array([1.2, 1.0])
k = 3
outputLabel = KNN.KNNClassify(testX, dataSet, labels, 3)
print 'Your input is:', testX, 'and classified to class: ', outputLabel
testX = array([0.1, 0.3])
outputLabel = KNN.KNNClassify(testX, dataSet, labels, 3)
prin... |
4c73479ce86e23d32f93325454e7f734f8cb86d8 | vemanand/pythonprograms | /general/sinwave_generators.py | 1,046 | 3.875 | 4 | ''' This program demonstrates the display of sine waves using a normal function and a generator function
You can notice that while the regular function returns all results at once, the generator returns one result at a time
'''
import numpy as np
from matplotlib import pyplot as plt
#This function will draw all 4 sin... |
60aa518cc9a93604c632916d47c124f4c8056f00 | ecarnold24/Antibiotics | /OpenPrescribingToolkit.py | 10,069 | 4.21875 | 4 | #step 1 import required packages
import pandas as pd # load pandas package for importing csv files in correct format
# import as defines the identifier you want to use for the function e.g in this case
# pd will call the pandas package
import matplotlib # load matplotlib package for plotting graphs
import os
import ma... |
471b2fd8c7663cff3d454b63a7976e4d4a3764f3 | CerJesus/CS221FinalProject | /baseline.py | 2,768 | 4.09375 | 4 | """Beating the Bubble: Baseline Predictor
Alexandre Bucquet, Jesus Cervantes, Alex Kim
Python 2.7
This module defines and trains a naive baseline predictor. It also evaluates the
predictor's mean squared error after training.
"""
import math
import random
from collections import defaultdict
import numpy as np
impor... |
6fbfb39037e4006d2322350b461f8af797bb7df8 | huilizhou/Leetcode-pyhton | /algorithms/201-300/234.palindrome-linked-list.py | 1,181 | 3.828125 | 4 | # 回文链表
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
if self:
return "{} -> {}".format(self.val, repr(self.next))
class Solution:
def isPalindrome(self, head):
"""
:type h... |
e03bf068aa84dc7b0471350100216fb33a033675 | djs21905/beginning_python | /Hangman/board.py | 1,057 | 3.703125 | 4 | # Class for drawing the Game Board
class Board():
board = []
initialize = True
def __init__(self, size):
self.board_size = size
def drawBoard(self, index_of_spaces):
Board.board
board_space = '_'
f... |
933bbe040b1885a742e8154e7be8e395a5c2d834 | prcopt/Python-Course-May2021 | /S11Q03.py | 1,871 | 4.3125 | 4 | """S11Q03
Write a Python script that takes a file name as its first argument.
Create a copy of the contents of this file satisfying the following conditions :
- If the file name is “file.txt”,
then the name of the new file should be “file-new.txt”
- Every even line of the first file, should be
repeated in the new fil... |
c1fc3c9c4338006b80785409f45ae3d8a16012d6 | kiskong/python-learn | /f.py | 863 | 4.09375 | 4 | # 文件操作
# doc : https://docs.python.org/zh-cn/3/tutorial/inputoutput.html#methods-of-file-objects
# 见7.2章节
# 内置函数open介绍 : https://docs.python.org/zh-cn/3/library/functions.html#open
file_path = './doc/test.txt'
print('----------------- write file start -----------------')
print(' write "Hello World!" to {}'.format(fi... |
13af5b70a5fd4f10e20fe802db607b295ebdeda4 | RobertoAbiud/HW2 | /hw2.py | 7,006 | 4.03125 | 4 | import random
from operator import itemgetter
def start():
opcion_seguir = True
while opcion_seguir == True:
while opcion_seguir == True:
try:
create_read = int(input("\n1.- Create a new file \n2.- Read an existing file\n3.-Random file name\n What action do you want ... |
17e6eb4cf161f99217868456a04cbf5f00fb0770 | datascience97/Datastructures | /Algorithm-Data-Structures-Python-master/Algorithms/Random_Select_InPlace.py | 3,124 | 3.671875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 28 12:30:03 2018
@author: Tirtha
"""
import random
def partition(A,p_idx):
p=A[p_idx]
#print("Input list to partition with pivot {}: {}".format(p,A))
# Swap/move pivot to leftmost
temp=A[0]
A[0]=A[p_idx]
A[p_idx]=temp
l=0
i=l+1
... |
e3a411be956d6aafb4b7d9fbb82c75d51192837f | Plofi/Tareas | /Clase 14/class_alumno.py | 1,071 | 3.75 | 4 | class Alumno:
def __init__(self, nombre, nota, resultado):
self.nombre = nombre
self.nota = nota
self.resultado = resultado
self.examenes = []
def agregar_examen(self, examen):
self.examenes.append(examen)
def get_examen(self):
retur... |
115d419e8d077bdeda25782a82ed47e0c19ab2a1 | Rex0070/Workspace | /Python/GCM LCM.py | 100 | 3.65625 | 4 | a=int(input())
b=int(input())
A=a
B=b
while(a!=b):
if(a>b) : a-=b
else : b-=a
print(A*B/a)
|
bd0252f4898a249fbd85d90943701646ddebd342 | cryy-bit/TurtleCrossingRoads | /scoreboard.py | 517 | 3.671875 | 4 | from turtle import Turtle
FONT = ("Courier", 24, "normal")
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.goto(x=-70,y=260)
self.number = 0
self.hideturtle()
self.write(f"Score:{self.number}",False, font=FONT)
def add_score(self):
self.number += ... |
21637d14cef341a32cf252a206cd7dad4948757a | bartoszmaleta/2nd-Self-instructed-week-exercises- | /fibonacci/fibonacci.py | 486 | 3.53125 | 4 | # i = 0
# j = 1
# k = 0
# fib = 0
# if i < 30:
# fib = j + k
# j = k
# k = fib
# i = i + 1
# else:
# print(fib)
# def printFibonnacciNumbers(n):
# f1 = 0
# f2 = 1
# if (n < 1):
# for x in range(0, n):
# print(f2, end = ' ')
# next = f1 + f2
# f1 = f2
# f2 = ... |
57105eb343f7e49d80b96fdc7ac917bba781db2e | cthulhu1988/OpenKattisSolutions | /PythonSolutions/SevenWonders.py | 897 | 3.6875 | 4 | def main():
# variables
limitingFactor = 500
tablet = 0
compass = 0
gear = 0
pointTotal = 0
# get input and check for chars
inputString = input()
for char in inputString:
if char.upper() == 'T':
tablet = tablet + 1
elif char.upper() == 'C':
com... |
a8f4268bd6f4a6f121deeb4a1acdfd8751ecb37f | DauletY/PyCode | /PythonExample/testpy.py | 112 | 3.90625 | 4 | #commint here
x = int(input())
y = int(input())
if x % y == 0:
print('even ',x)
else:
print('odd',y)
|
45b2639b58c47125be37d7fb5cafa9ddba7a1d3c | SystemicCypher/Useful-Code | /Algorithms/Minimax_AlphaBetaPruning.py | 1,440 | 3.65625 | 4 | #Enumerates all nodes and picks the best valued one
def minimax(node, depth, maximizing_y_or_n):
if(depth == 0 or node.terminal_node()):
return heuristic()
if(myPlayer):
bestValue = -infinity
for move in possibleMoves:
value = minimax(move_node, depth-1, False)
b... |
68d47a48fda9a410fe42f51b890a637b51fad718 | MarkHofstetter/python-20180423 | /lotto/test_lotto.py | 1,112 | 3.546875 | 4 | import lotto
from pprint import pprint
number_of_iterations = 10000
def collect_data(func):
distribution = {}
for i in range(number_of_iterations):
numbers = func()
check_unique = dict((k,1) for k in numbers)
assert len(check_unique) == 6
assert min(numbers) > 0
assert ... |
aa136061c99da98e4dcda529fb4835e1d727a827 | AkhileshNS/CNS-Lab | /7_Diffie_Hellman/diffie_hellman.py | 651 | 3.8125 | 4 | p = int(input("Enter the value of Prime modulus 'p' : "))
g = int(input("Enter the value of generator 'g' : "))
Xa = int(input("Enter the value of first secret number 'Xa': "))
Xb = int(input("Enter the value of second secret number 'Xb': "))
if Xa < p and Xb < p:
Ya = (g**Xa) % p
Yb = (g**Xb) % p
print("... |
b9c6261e485c3407c1fe4f59e762610688e34b3f | zackfactual/Python-Exercises | /calculateAge.py | 383 | 4.09375 | 4 | print("Let's see how long you've lived in days, hours, minutes, and seconds")
name = input("Name: ")
print("What's your age? ")
age = int(input("Age: "))
days = age * 365
hours = age * 8760
minutes = age * 525948
seconds = age * 31556926
print("{}, you've been alive for {} days, which is {} hours, which is {} minutes, ... |
26ef7a6840b86ece47015324e94342de0856d9d6 | madhav2712/Machine-Learning-with-Apache-Spark-QuickStart-Guide | /chapter07/chp07-02-convolutional-neural-network-transfer-learning.py | 2,782 | 3.5625 | 4 | #!/usr/bin/python
""" chp07-02-convolutional-neural-network-transfer-learning.py: Classify images using Transfer Learning from a pre-trained convolutional neural network """
# (1) Import the required PySpark and Spark Deep Learning libraries
from sparkdl import DeepImageFeaturizer
from pyspark.sql.functions import *
... |
786a76ce4255acf43404db29fd1cd578a3e5b662 | SaiSamyam/Lanchpad-Assignments | /password_verfication.py | 789 | 4.125 | 4 | import re
special_char=['@','#','$']
numbers=[1,2,3,4,5,6,7,8,9,0]
uppercase_letters=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
while True:
password=input('Enter a password:')
if len(password) < 8:
print('Make sure your password has a minimum of 8 cha... |
4094e2d535578ffd715cbef8ffd9c31c607a76e1 | meighanv/05-Python-Programming | /LABS/Socket/remoteip.py | 713 | 3.796875 | 4 | #!/usr/bin/env python
# This program is optimized for Python 2.7.12 and Python 3.5.2.
# It may run on any other version with/without modifications.
import socket
def get_remote_machine_info():
remote_host = 'www.dakjldksajkj.org'
try:
print ("IP address of %s: %s" %(remote_host, socket.gethostbyname(... |
fcc35a21c523d062ae356c2b7e42d1ef586803ff | dwdii/py-sandbox | /src/divide-conquer/kargermincut.py | 7,178 | 4.34375 | 4 | #
# Author: Daniel Dittenhafer
#
# Created: Mar 24, 2019
#
# Description: Coursera Algorithms Divide And Conquer Week 3
#
__author__ = 'Daniel Dittenhafer'
import random
"""
The file contains the adjacency list representation of a simple undirected graph.
There are 200 vertices labeled 1 to 200. The first column i... |
97c53cd05b4609800e5a9ec6d6c165926119faf1 | Renanvictordiascosta/EstudosDeUmCurso | /aula.py | 2,797 | 3.75 | 4 | # importar as bibliotecas
import pandas as pd
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plot
# no Google Colab, dê o comando: !pip install plotly --upgrade
import plotly.express as px
# chamar a base de crédito no programa
base_de_credito = pd.read_csv("credit_data.csv")
# mostrar os 5 prime... |
15be8775052e56a8bd25921a65f31256d748e619 | arivolispark/datastructuresandalgorithms | /leetcode/30_day_leetcoding_challenge/202004/20200410_min_stack/min_stack.py | 3,578 | 3.859375 | 4 | """
Title: Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.
Example:
MinStack minSt... |
bfebc9aac90ab0630be4269f71fdd52855121975 | Vergess/study | /pythoncode/5.py | 1,684 | 3.59375 | 4 | # 1
# s=input('please input a string')
# l=len(s)
# a=s.split()
# print('the length of the string is ',l)
# print('the word in the string is',len(a))
# 2
# i=0
# a=0;b=0;c=0;d=0;e=0
# while i<10:
# score=eval(input('please input score %d'%(i+1)))
# if score>=90:
# a=a+1
# elif score>=80:
# ... |
ee53a77339d712e65ffb5abfb2749612cb893e42 | wapor/euler | /40_champernownes_constant.py | 1,164 | 3.734375 | 4 | #!/usr/bin/python
# An irrational decimal fraction is created by concatenating the positive integers:
# 0.123456789101112131415161718192021...
# It can be seen that the 12th digit of the fractional part is 1.
# If dn represents the nth digit of the fractional part, find the value of the following expression.
# d1 * d1... |
27dfecec6858eb4c9476b526e70b662509af0735 | Harshal-Patil/python | /tip.py | 441 | 4.1875 | 4 | print("Welcome To Tip Calculator")
bill=float(input("What was the total bill $"))
percntage=int(input("what percntage tip would you like to give? 10,12 or 15="))
people=int(input("How many people to split the bill?"))
bill_percentage=percntage/ 100
total_tip_amount=bill * bill_percentage
total_bill=bill+total_tip_amoun... |
b7cf36f61dbc49063ec5ee78520b0a11407dff96 | Jigar710/Python_Programs | /Matplotlib/with_pandas/p3.py | 533 | 4.09375 | 4 | '''
we create stacked bar plot from a DataFrame
by passing stacked=True,resulting in the value in each
row being stacked together.
A useful receipt for bar plot is to visulize a Series's value
frequency using value_counts:
s.value_counts().plot.bar()
'''
from matplotlib import pyplot as plt
import pandas as pd
i... |
402621774ab999f1e38494091b75c4d977c91934 | xiaohai0520/Algorithm | /algorithms/994. Rotting Oranges.py | 1,172 | 3.5 | 4 | This is a BFS problem.
Each time add four direction node into the queue
Layer by layer. When queue is empty. check the grid has 1 if yes, return -1 else return the layer.
class Solution:
def orangesRotting(self, grid: List[List[int]]) -> int:
queue = collections.deque()
res = 0
for i in ... |
e58c9a043715a93e4169a2724a1de6b940d316a3 | DavTho1983/Classes | /circle.py | 295 | 3.890625 | 4 | class Circle() :
pi = 3.14
def __init__(self, radius) :
self.radius = radius
def area(self) :
return (self.radius**2)*Circle.pi
def set_radius(self, new_r) :
self.radius = new_r
myc = Circle(3)
myc.set_radius(999)
print(myc.radius)
print(myc.area())
|
5ec188fb38423e6f3b21c1d2055a2b7e5b13a79c | ZCW-Data1dot2/scicalc-group-tea | /menu.py | 5,964 | 3.671875 | 4 | #changing to main_app.py for import
import importlib
main_app = importlib.import_module("main-app")
import switch_mode
from calculator import Calculator
calc = Calculator()
path = []
def start_menu(path):
operation = input("Perform a \n [1] Basic Functionality \n "
"[2] Simple Operations \n... |
5cd9c7b06bd709a027f837dba1bf7730ffc3aa76 | shawnq8861/Python-Examples | /testable.py | 328 | 3.828125 | 4 | def testable(x):
r"""
The testable function returns the spuare root of it's argument or 3.0, whichever is larger
>>> testable(7)
3.0
>>> testable(16)
4.0
>>> testable(9)
3.0
>>> testable(10) == 10 ** .5
TRUE
"""
if x < 9:
return 3.0
return ... |
d45b34ff0341ce6881b8d257f7937a857bb03e0d | github-solar/pyworks-eduwill | /ch07/inherit_class/car_overriding.py | 471 | 3.765625 | 4 | #Car 클래스(부모) - 택시, 버스 는 자식 클래스 관계에서
# 특히 상속 기법에서 메소드 재정의가 이루어진다. 오버라이딩
class Car:
def drive(self):
print('차가 주행합니다.')
class Taxi(Car):
def drive(self):
print('택시가 주행합니다.')
class Bus(Car):
def drive(self):
print('버스가 주행합니다.')
c = Car()
c.drive()
taxi = Taxi()
taxi.drive()
bus = ... |
966a851bbfe9710f570f2bd3d3c1e3cd8d35458e | danelia1998/pycharm-projects | /loop.py | 61 | 3.640625 | 4 | list = [1, 2, 3, 4, 5, 6]
for each in list:
print(each)
|
a6e38584d892ca7b24ef3f369cabb366737354b1 | bbrecht02/aprendendo.py | /listafinal/questao1.py | 206 | 3.75 | 4 | print ("Calculo de aumento de salario")
s= float(input("Digite o salario: R$"))
p= float(input("Digite a porcentagem de aumento: "))
n= s*(p/100)+s
print(f"O valor com o acressimo do aumento será R${n}")
|
679575d0d76d66fcedd4f600e7a995f9384160b8 | Rajat986/Python-Learning | /Payroll.py | 1,453 | 3.8125 | 4 | class UI:
def input(self):
q=payroll()
n=int(input("Enter number of employees : "))
for i in range(n):
name=input("Enter name : ")
h_wage=float(input("Enter hourly wages : "))
emp = employee(name,h_wage)
q.add_employees(emp)
... |
73330117dfeacbd0dabd78b04e984da40fbc0577 | faterazer/LeetCode | /0586. Customer Placing the Largest Number of Orders/Solution.py | 237 | 3.515625 | 4 | import pandas as pd
def largest_orders(orders: pd.DataFrame) -> pd.DataFrame:
df = orders.groupby("customer_number").size().reset_index(name="count")
df = df[df["count"] == df["count"].max()]
return df[["customer_number"]]
|
f0fd6e3017a15c4cbb2a5838f037db4a1b5e2f49 | ivancete66/M01-2016-2017 | /M03/examen/ajedrez.py | 271 | 4.09375 | 4 | #coding:utf-8
for fil in range(1,9,1):
for col in range(1,9,1):
if (fil == 1) or (fil == 3) or (fil == 5) or (fil == 7):
if (col % 2 == 0):
print " ",
else:
print "X",
else:
if (col % 2 == 0):
print "X",
else:
print " ",
print ""
|
27f022cdbbabf8e1714031bdca42545e9dece2ac | bhammack/machine-learning | /random_optimization/ABAGAIL/jython/travelingsalesman.py | 5,685 | 3.578125 | 4 | # traveling salesman algorithm implementation in jython
# This also prints the index of the points of the shortest route.
# To make a plot of the route, write the points at these indexes
# to a file and plot them in your favorite tool.
import sys
import os
import time
sys.path.append('../ABAGAIL.jar')
import java.io.... |
20430bc92f60c21b96a4f104adb91cdc6a4c367d | aditya107/Nighttime_vehicleplate_detection_system_opencv | /nvd_src.py | 5,204 | 3.9375 | 4 | import cv2
# Importing the Opencv Library
import numpy as np
# Importing NumPy,which is the fundamental package for scientific computing with Python
# Reading Image
img = cv2.imread("71.jpg")
cv2.namedWindow("Original Image",cv2.WINDOW_NORMAL)
# Creating a Named window to display image
cv2.imshow("Original Imag... |
efb8cfc63d3a98b1c8b7f962aea9d9c4ecca53f9 | gary391/CWH-PythonBeginner | /16_1_Calculator.py | 445 | 4.21875 | 4 | # Write a program to create a basic calculator that perform operations on user inputed numbers
num1 = int(input("Enter your first number: "))
num2 = int(input("Enter your second number: "))
oper = input("What operation would you like on these numbers +,-, *, / ?")
if oper == '+':
ans = int(num1 + num2)
elif oper ... |
26ff003672a449d71fdd44677d1a206856a78904 | JavierGaonaR/Puzzle8-IA | /puzzle8.py | 6,704 | 3.671875 | 4 | import random
import copy
def crea_puzzle():
puzzle = [[0, 2, 3], [1, 4, 6], [7, 5, 8]]
random.shuffle(puzzle[0])
random.shuffle(puzzle[1])
random.shuffle(puzzle[2])
random.shuffle(puzzle[random.randint(0, 2)])
return puzzle
def movimientos(puzzle, predecesor):
hijos = []
if 0 in pu... |
ee04de1df25fb04012db80889343d7147fe990cb | grrtvnlw/python-functions | /longest.py | 177 | 3.828125 | 4 | def longest(lst):
longlong = ""
for string in lst:
if len(string) > len(longlong):
longlong = string
return longlong
print(longest(['Gerrit', 'Dave', 'Joe'])) |
259535aab3aee3741823ee89d869a9bf14c38903 | leetakhotsamit/CS2020 | /CS2020/a03/a03q2.py | 3,231 | 4.21875 | 4 | ##===============================================
## Leeta Khotsamit (20626249)
## CS 116 Winter 2020
## Assignment 03, Question 2
##===============================================
import check
## Question 2
def removal(s):
'''
Returns the lower case form the the string with the removal of spaces,
... |
2dc6fe67a821edc3f8aca33fab5319e5d9639def | Aanjansai/Python-Programs | /algorithms/binary_search.py | 517 | 4.21875 | 4 | """ Desc -> Read in a list of words from File. Then prompt the user to enter a word to search the list.
The program reports if the search word is found in the list.
I/P -> read in the list words comma separated from a File and then enter the word to be searched
Logic -> Use Arrays to sort the word list and ... |
5f2284bd207d4fb5636b02061ddc5f0ae78e87ea | aravindanath/MarvelAutomation | /Day4/DemoCls.py | 1,205 | 4 | 4 |
"""
class
methods
constructs / special methods
@classmethod
@Staticmethod
"""
class Methods():
# Global varibale
city = "Bangalore"
def __init__(self):
print("i am a constructor")
def __init__(self,name,age):
self.name = name
self.age = age
print("i am a constructo... |
bb76d17ed488e3fa2114859cefefa7a97dfc5587 | johnmee/codility | /L4_MaxCounters.py | 5,646 | 4.15625 | 4 | """
# MaxCounters
Calculate the values of counters after applying all alternating operations:
increase counter by 1; set value of all counters to current maximum.
You are given N counters, initially set to 0, and you have two possible
operations on them:
* increase(X) - counter X is increased by 1,
* max cou... |
622c21ae64b3f7630076bec4fa3df1f716f5fe8a | NeyBrito/Phyton | /Scripts-Python/pythontest/desafio10.py | 557 | 3.921875 | 4 | n1 = int(input('Digite um número para ver sua tabuada: '))
#t = n1*1, n1*2, n1*3, n1*4, n1*5, n1*6, n1*7, n1*8, n1*9, n1*10
print('{} x {} = {}'.format(n1,1, n1*1))
print('{} x {} = {}'.format(n1,2, n1*2))
print('{} x {} = {}'.format(n1,3, n1*3))
print('{} x {} = {}'.format(n1,4, n1*4))
print('{} x {} = {}'.format(n1,5... |
f2dc96ecc05ed6204133e8d151826c7bdfd0e665 | MythiliPriyaVL/PySelenium | /venv/ProgramCode/34.3-TimeitModule.py | 359 | 4 | 4 | """
Define two functions f1 and f2 such that,
f1 returns a list of squares of first 20 natural numbers using list comprehension.
f2 returns a generator that computes squares of first 20 natural numbers.
Determine the time taken by each function to get executed 100000 times. Print the time for each function in separate ... |
649268fb9de472194d79baa3ad484ccb3f76e116 | jjspetz/digitalcrafts | /py-exercises1/day_of_the_week.py | 261 | 4.3125 | 4 | '''
Prints day of the week based on user inputed number.
Follows the pattern of Sunday = 0, Monday = 1, etc.
'''
day = int(input('Day (0-6)? '))
days = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
print(days[day])
|
dd7664170842d17aed3087999019e2a6381b7acb | PhoenixPassenger/BatalhaNavalPython | /ship.py | 169 | 3.546875 | 4 | class Ship:
def __init__(self, size):
self.parts = []
if size == 1:
self.parts.insert(0,True)
else:
for x in range(size):
self.parts.append(True) |
56558b9cc31a883ed0b3a1ac675be439e28dede2 | mattkim8/CSI | /faces.py | 655 | 3.796875 | 4 | from Tkinter import *
window = Tk()
ps2_canvas = Canvas(window, width=500, height=500)
ps2_canvas.grid(row=0, column=0)
# These next four statements are the ones you should play with for your
# program. LEAVE EVERYTHING ELSE (apart from the comments) ALONE
# draw the face
ps2_canvas.create_oval(100, 100, 400, 40... |
5f319f9dc941b0d917cf65ea285e099d86fadadb | huangyuzhen/let | /15/15.py | 799 | 3.9375 | 4 | from typing import List
class Solution:
def sumBackTrack(self, t = 0, count = 0, currentSum = 0, xList = []):
if count == 3 and currentSum == 0:
xList.sort()
self.result.add(tuple(xList))
return
if count > 3 or t == self.length:
return
# 选择此元素... |
095da620bfc33f575e426b5d8051ac10f5ad8a6e | Janmajayamall/Interview-prep | /Word Search.py | 1,097 | 3.609375 | 4 | class Solution(object):
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:rtype: bool
"""
def dfs(grid, row, col, explored, w):
if len(w)==0:
return True
if row<0 ... |
0711cda75f4eb534eb58eae72fa49ec4fc7e8cf2 | vishal-chillal/assignments | /new_tasks_23_june/46_solutions/10_overlaping_lists.py | 847 | 4.15625 | 4 | # Define a function overlapping() that takes two lists and returns True if they have at least one member in common, False otherwise.
def over_laping_using_IN_fun(lst1, lst2):
result = False
for elt1 in lst1:
if elt1 in lst2:
result = True
break
return result
def over_laping_... |
04cdff90c36eeb7512e5ba2e18a348f52fbbca16 | srprioto/Ejercicios-en-python | /_programas/ejercicois_basicos/Aritmetica.py | 775 | 3.890625 | 4 | import os
os.system('cls')
class Aritmetica:
def __init__(self, nro1, operador, nro2):
self.nro1 = nro1
self.operador = operador
self.nro2 = nro2
def calcular(self):
if self.operador == "+":
return self.nro1 + self.nro2
elif self.operador == "-":
... |
1f78a240db54c7d25ea92ab9672e04e19be9ff8b | heechul90/study-python-basic-1 | /Python_coding_dojang/Unit 17/while2.py | 688 | 4 | 4 | ### Unit 17. while 반복문으로 Hello, world! 100번 출력하기
## 17.2 반복 횟수가 정해지지 않은 경우
## import 모듈
import random as rd # random 모듈을 가져옴
print(rd.random())
print(rd.random())
print(rd.random())
## random.randint(a, b)
print(rd.randint(1, 6))
print(rd.randint(1, 6))
print(rd.randint(1, 6))
import random as rd # random ... |
ba931602940cb7955f50403e7510a89cb1f836f5 | venkateshvsn/patterns | /package/symbols/pentagon.py | 774 | 4.25 | 4 |
def for_PENTAGON():
"""printing symbole 'PENTAGON' using for loop"""
for row in range(7):
for col in range(9):
if col==4 or col in(3,5) and row!=0 or col in(2,6) and row not in(0,1) or row==4 or row in(3,5) and col not in(0,8):
print("*",end=" ")
else:... |
27505bddc2f32a131dc25e99f3037f88243ab51d | mwoitek/python-coursera | /parte_2/semana_6/test_soma_lista_recursivo.py | 1,446 | 3.5 | 4 | #
#
#
# ██╗ ██╗ ██████╗ ██╗████████╗███████╗██╗ ██╗
# ██║ ██║██╔═══██╗██║╚══██╔══╝██╔════╝██║ ██╔╝
# ██║ █╗ ██║██║ ██║██║ ██║ █████╗ █████╔╝
# ██║███╗██║██║ ██║██║ ██║ ██╔══╝ ██╔═██╗
# ╚███╔███╔╝╚██████╔╝██║ ██║ ███████╗██║ ██╗
# ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
#
#
#
# ____ ... |
522ae9363edbb4c7e810e176644fa857d6487457 | chandramohank/Logical-Programes | /Python/powerset.py | 396 | 3.859375 | 4 | import math
def powerset(array):
powers=[]
total=int(math.pow(2,len(array)))
for i in range(0,total):
temp=[]
num="{0:b}".format(i)
while len(num)<len(array):
num='0'+num
for j in range(0,len(num)):
if num[j]=='1':
temp.append(array[j]... |
a4f4d1ee2a78ce0ad7b827643a098a580bd07d7f | ChengHsinHan/myOwnPrograms | /CodeWars/Python/8 kyu/#022 Regex count lowercase letters.py | 494 | 4.28125 | 4 | # Your task is simply to count the total number of lowercase letters in a
# string.
#
# Examples
# lowercaseCount("abc"); ===> 3
#
# lowercaseCount("abcABC123"); ===> 3
#
# lowercaseCount("abcABC123!@€£#$%^&*()_-+=}{[]|\':;?/>.<,~"); ===> 3
#
# lowercaseCount(""); ===> 0;
#
# lowercaseCount("ABC123!@€£#$%^&*()_-+=}{[]|... |
1f40d25c8dbbe9eecfd7a2a9621288d04d6afca4 | chriswood/eulerproject | /p21-40/prob33.py | 1,537 | 3.78125 | 4 |
# The fraction 49/98 is a curious fraction, as an inexperienced mathematician
# in attempting to simplify it may incorrectly believe that 49/98 = 4/8,
# which is correct, is obtained by cancelling the 9s.
#
# We shall consider fractions like, 30/50 = 3/5, to be trivial examples.
#
# There are exactly four non-trivial... |
c21e1c1ad79ff017539722212e1f1dc754f62f01 | praneesh12/Data-Structures-Algorithms | /DataStructures/BinarySearchTree/findKthMaxBST.py | 577 | 3.84375 | 4 | from Node import Node
from BinarySearchTree import BinarySearchTree
"""
Implement a function findKthMax(root,k)
which will take a BST and any number “k” as an input
and return kth maximum number from that tree.
"""
"""
We know the maximum value in a BST will be the right most leaf
So k-th Maximum... |
185559e114bb479185b4b72d75fa41c2837878c7 | Lehcs-py/guppe | /Seção_06/Exercício_53.py | 402 | 4.15625 | 4 | print("""
53. Escreva um programa que leia um número inteiro positivo n e em seguida imprima n linhas do chamado Triangulo de Floyd. Para n = 6, temos:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
""")
variavel = 0
numero = int(input('Quantas linhas: '))
for num in range(1, numero + 1):
for x in range(num... |
36a5c63933f7687f91624e7e1a343cc56c20f076 | sHongJung/python-challenge | /PyBank/main.py | 1,703 | 3.578125 | 4 | import os
import csv
TotalMon = 0
TotalRev = 0
init_Rev = 943690
RevChange = 0
AveRev_Change = 0
TotalRev_Change = 0
MaxIncRev = 0
MaxIncMonth = ""
MaxDecRev = 0
MaxDecRevMonth = ""
csvpath = os.path.join("budget_data_2.csv")
with open(csvpath, 'r', encoding='utf-8') as csvfile:
csvread = csv.reader(csvfile)
... |
fdf8ff1bad21ce8dbe5ccd57e0db263a4df99f9a | Libardo1/ballin-robot | /app/ex6.py | 432 | 3.5625 | 4 | import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
# PCA + Clustering example
iris = datasets.load_iris()
X = iris.data
pca = PCA(n_components=2)
pca.fit(X)
X_reduced = pca.transform(X)
k_means = KMeans(n_clusters=3, random_state=0)... |
507552dd315916676ea2bd99ff6f64caf7c93fbb | yyassif/codinginterviewquestions | /algorithms/sqrt.py | 525 | 3.84375 | 4 | #Myungho Sim
#sqrt problem from leetcode
#ideas taken from leetcode discussion
#solution using binary search
class Solution(object):
def mySqrt(self, x):
"""
:type x: int
:rtype: int
"""
if x==1 or x==0:
return x
h=x
l=0
ret=0
while... |
9ea6460690615106f57094301fe333a59e12df77 | goatley1/TTU-EDU-ISQS--6337-Scripting | /Assign6-1_Oatley.py | 725 | 4.28125 | 4 | #Creator: Aaron Oatley
#Date: 2020.06.13
#Assignment 6-1
#import cellphone class
import cellOATLEY as cp
#define main
def main():
#prompt user for cellphone manufacturer, model, and price
cont = 'y'
#use while loop so multiple phones can be entered at user request
while cont =='y':
... |
c0517ee2fe9a170354035597b587ca598b9aeb15 | Aasthaengg/IBMdataset | /Python_codes/p02786/s364727524.py | 135 | 3.6875 | 4 | def func(h):
if h == 1:
h = 0
return 1
else:
return 1 + 2 * func(h//2)
h = int(input())
print(func(h)) |
21cd7e22a3de182eb64cafb7b220c896f0f87da2 | fmitra/codility_brainteasers | /2/2.2_odd_occurances_in_array.py | 1,274 | 4.0625 | 4 | """
A zero-indexed array A consisting of N integers is given. Rotation
of the array means that each element is shifted right by one index,
and the last element of the array is also moved to the first place.
For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7].
The goal is to rotate array A K times... |
4a46c07b2958772ca127264ab88fc3f860bc2f93 | anhkhoa15062001/btpythonbu-i3 | /Buoi 3/bai5.py | 126 | 3.5 | 4 | a = int(input('Nhập a: '))
b = int(input('Nhập b: '))
c = int(input('nhập c: '))
print('So lon nhat la:', max(a,b,c)) |
a8a6d0561c64fb43142437035dd986ffc305e16f | xriva/coding-contest | /google/kickstart/2021/B/consec_prime/prime2.py | 1,008 | 3.5625 | 4 | import math
NN=1000000
def build_prime():
isprime = [True]*(NN+1)
i=2
while (i*i<=NN):
if isprime[i]:
for j in range(i*i,NN+1,i):
isprime[j]=False
i+=1
return isprime
isprime=build_prime()
def check_prime(N):
if N<NN:
return isprime[N]
if N%... |
a44343cbb6532402a555560e5e0371601844e527 | gotexis/harry-scrape | /selenium_test.py | 923 | 3.546875 | 4 | # https://selenium-python.readthedocs.io/getting-started.html
from pprint import pprint
from selenium import webdriver
import csv
browser = webdriver.Chrome(executable_path="./driver/chromedriver.exe")
b = browser
url = 'https://www.gtrading.com.au/live-rate'
b.get(url)
tbody = b.find_element_by_tag_name('tbody')... |
74bc3eafbb20732b244c5de7b533b1d569debd4c | MeazaEyakem1/Neural-Network-from-scratch-using-numpy | /Multi_Layer.py | 9,292 | 3.78125 | 4 |
import matplotlib
import numpy as np
from tensorflow.keras.datasets import mnist
import matplotlib.pyplot as plt
class LinearLayer:
#ll functions to be executed by a linear layerin a computational graph
def __init__(self, input_shape, n_out, ini_type="plain"):
self.m = input_shape[1] # number of e... |
e96ceace1b570df2985c545937945fcb016118fe | ganasn/LPTHW | /ex33-sd.py | 499 | 4.34375 | 4 | # Exercise 33 Study-Drill on While-Loops
# Execute append in a function
numbers = []
def append_elements(counter):
count = 0
while count < counter:
print "At the top count is %d" % count
numbers.append(count)
count += 1
print "List is", numbers
print "At the bottom, co... |
b023b03a151276717af4ed68578bdea4f6bbd337 | LuluFT/Checkyy | /Python/Kopfrechner.py | 3,387 | 3.75 | 4 | import random #das Modul Random wird importiert. Dort ist der Befehl "shuffle" vorhanden um eine Liste durchzuwürfeln.
import time # hier wird das Modul Time importiert um die Möglichkeit zu haben, mit der Zeit zu arbeiten.
leben = 3#Variabel, wie viele Versuche man hat bis man verloren hat
lstEins = [] #Leere Liste ... |
466e552265fb29d4745a93f54a1e1abe5e6a62f9 | arthurDz/algorithm-studies | /leetcode/restore_ip_address.py | 1,052 | 3.625 | 4 | # Given a string containing only digits, restore it by returning all possible valid IP address combinations.
# Example:
# Input: "25525511135"
# Output: ["255.255.11.135", "255.255.111.35"]
def restoreIpAddresses(s):
return restoreIpAddress(s, 4)
def restoreIpAddress(s, num):
if num == 1:
if len(s)... |
eace1861b4daa28ec69d416719a6f0cdfca8b8f2 | non117/yukari | /cutout.py | 882 | 3.640625 | 4 | # -*- coding: utf-8 -*-
import csv
import sys
'''
YANO SYSTEMの骨格データを指定された秒数の範囲に切り取るスクリプト。
Python 3.xの環境があれば動きます。
コマンドライン引数として、変換したいcsvファイルを取ります。
数値以外を入力した時の動作は未定義です。
'''
def main():
print('begin second')
a = float(input())
print('end second')
b = float(input())
filename = sys.argv[1]
data = cs... |
496902e47d1945f7e602faee1aeefab38cc5e4f6 | kuchunbk/PythonBasic | /8_function/Sample/functions_ex20.py | 290 | 3.78125 | 4 | '''Question:
Write a Python program to detect the number of local variables declared in a function.
'''
# Python code:
def abc():
x = 1
y = 2
str1= "w3resource"
print("Python Exercises")
print(abc.__code__.co_nlocals)
'''Output sample:
3
''' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.