blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
f4bbf42f6d17445031b0ccc6ab15e30d86fd82da | chromium/chromium | /third_party/zxcvbn-cpp/data-scripts/count_wiktionary.py | 2,670 | 3.65625 | 4 | #!/usr/bin/python
import os
import sys
import codecs
import operator
from unidecode import unidecode
def usage():
return '''
This script extracts words and counts from a 2006 wiktionary word frequency study over American
television and movies. To use, first visit the study and download, as .html files, all 26 of... |
73a887d8a2dc3857dca875ba0a801ae36851596c | chromium/chromium | /third_party/xcbproto/src/xcbgen/align.py | 6,473 | 3.515625 | 4 | '''
This module contains helper classes for alignment arithmetic and checks
'''
from sys import version_info
if version_info[:2] >= (3, 5):
from math import gcd
else:
from fractions import gcd
class Alignment(object):
def __init__(self, align=4, offset=0):
self.align = align
# normalize ... |
43ba40c4623d14231fa1e5d95b909cda599b16c7 | uditarora1/uditarora1 | /oddeven.py | 144 | 4.125 | 4 | number=int(input())
if(number%2==0 and number>0):
print("even")
elif(number%2!=0 and number>0):
print("odd")
else:
print("invalid")
|
15b2905e64102befd173ccb38499a62ea29a96bc | Flimars/Python3-for-beginner | /_curso_em_video/codes-python-intellij/_exemplos_aulas/initial.py | 1,303 | 4.1875 | 4 | ''' Curso em Vídeo: Aula 04 Trabalhando Primeiros comandos com variáveis
Curso de Programação em Python
The Python language created in 1991 by Guido Van Rossum.
Aiming at productivity and readability.
'''
print('Estou aprendendo Python!!!')
print(" # Concatenando(unindo) duas Strings(texto e/ou caracteres)... |
c0841887954d9b301b92b9a67ed389584c03756c | Flimars/Python3-for-beginner | /_curso_em_video/codes-python-intellij/_exemplos_aulas/soma.py | 747 | 4.03125 | 4 | ''' Curso em Vídeo: Aula 04 Usando Input em Python - Desafio 03
Curso de Programação em Python
The Python language created in 1991 by Guido Van Rossum.
Aiming at productivity and readability.
'''
print('****************************************************************************')
print('******************... |
73c81de5d3f5a7805ef8c4ad0aa3c32764d01e92 | Flimars/Python3-for-beginner | /_listas_execicios/list1_ex3.py | 303 | 4.28125 | 4 | # 3. Desenvolva o algoritmo de um programa onde o usuário irá informar um número
# inteiro e o programa deve calcular e exibir quadrado do número informado pelo
#usuário.
num = int(input('Digite um número interiro: '))
quadrado = num * num
print('o quadrado de {} é'.format(num), '=',quadrado)
|
ee075b4310944f2d4ca61615e065c28fff8aa7b3 | marskar/biof309_fall2018 | /2018-11-29/debug_recur.py | 252 | 3.859375 | 4 | from recur import recur
if __name__ == '__main__':
while True:
start = int(input("start: "))
end = int(input("end: "))
weekdays = int(input("weekdays: "))
result = recur(start, end, weekdays)
print(result)
|
c0bf4a9eccf7222d3bb29fcbe294783ba18c0ba4 | marskar/biof309_fall2018 | /scripts/person.py | 516 | 3.9375 | 4 | from datetime import date
from dataclasses import dataclass
@dataclass
class Person:
first_name: str
last_name: str
birth_date: datetime
def age(self):
today = date.today()
age = today.year - self.birth_date.year
if today < date(today.year,
self.birth_d... |
cbf46d6c160cb654af76f1a8a9400cecb0688c33 | marskar/biof309_fall2018 | /scripts/magic8.py | 2,757 | 4 | 4 | import random
# Using conditional statements
def magic_eight_cond_stat(x):
"""Magic 8 ball accepting a string and returning some postulations"""
if x == 1:
return "Straight up, nope"
elif x == 2:
return "I wouldn't put money on it"
elif x == 3:
return "YASS"
elif x == 4:
... |
f3199ce4fb90e75758d55e2ca055a6b9ac2a74fd | ialtikat/gaih-students-repo-example | /Homeworks/HW2.py | 1,743 | 3.796875 | 4 | i=0
average=[]
ogrenci=[]
info={}
while i<5:
name=input("Öğrenci adını giriniz: ")
surname=input("Öğrenci soyadını giriniz: ")
if name != "" and surname != "":
vize=float(input("Vize notunu giriniz: "))
final=float(input("Final notunu giriniz: "))
proje=float(input("Proje n... |
bf12df3700f071cfa9405301208a1a095c250e28 | pythonshiva/Pandas-Ex | /Lesson4/lesson4.py | 1,223 | 4.96875 | 5 | #In this chapter we will work on some basics
import pandas as pd
#Create some data
some_list = list(range(0,10))
#Lets add this list to the DF
df = pd.DataFrame(some_list)
#We can change the name of the column
df.columns = ['Numbers']
#If we wanted to add some extra columns to the df
#This will add a column named "f... |
abdd881c52cbe196cafe5e10caee46ddde72c330 | sudheermanday/dummy1 | /Q4.py | 577 | 3.71875 | 4 | class Node:
def __init__(self, dataval=None):
self.dataval = dataval
self.nextval = None
class SLinkedList:
def __init__(self):
self.headval = None
def listlength(self):
printval = self.headval
c=0
while printval is not None:
c+=1
pri... |
5d379e2d4f130773b5cd2b334c09fb526f8e83ba | makaires77/Grafos-2021 | /testes/tkinter_test3-long-data.py | 3,117 | 3.921875 | 4 | import tkinter as tk
# import os
# from random import choice, randrange
class Window:
def __init__(self):
self.root = tk.Tk()
self.mem = {}
def label(self, text, r, c):
"Creates a label with a text and row and column as arguments"
self.label = tk.Label(
self.root,
... |
28d4cce43d882c0a48a09002d40c161060a3ccb4 | makaires77/Grafos-2021 | /testes/entrada_dados.py | 8,542 | 3.640625 | 4 | # Program to make a simple entry screen
import tkinter as tk
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk)
from math import factorial
from PIL import ImageTk, Image
from tkinter import filedialog
from core import *
window=tk.Tk()
# setting... |
86174c7ace627a0b8a18c8c5ef294b43d45c5960 | makaires77/Grafos-2021 | /testes/distances.py | 2,209 | 3.625 | 4 | import collections
import itertools
import math
Point = collections.namedtuple('Point', ['id', 'x', 'y'])
Distance = collections.namedtuple('Distance', ['id1', 'id2', 'distance'])
def get_distance(p1, p2, distances):
for d in distances:
if d.id1 == p1 and d.id2 == p2:
return d.distance
re... |
79f0fa75d7148ddb333e540f2b7cc0ce185c39f8 | adrianoventura/GitHub | /matriz4x4.py | 378 | 3.671875 | 4 | def main():
matriz=[]
somatorio=0
for i in range(4):
linha=[]
for j in range(4):
linha.append(int(input("Digite um numero da Linha "+str(i+1)+" Coluna "+str(j+1)+" ")))
somatorio=somatorio+linha[i]
matriz.append(linha)
for i in range(4):
print matriz[i... |
3a2bc956c45cbd15d758a70ab9a2ce9943451dcb | khanshoab/BASIC-OF-HTML | /python project/exp101.py | 348 | 3.59375 | 4 | ''' write the python program to implement comments ,data type,expression,input and out put function,
theory
@auther: khan shoab akhtar vakil ahmad (Roll no 19co33)
'''
i=10
f=15.5
s='shoab khan'
print("i=",i,"f=",f,"s=",s)
print("type of ",i,"is",type(i),"type of",f,"is",type(f),"type of",s,"is",type(s))
print(i,"is at... |
4c9fefef70bef43b17e2cc646eee41b8e0ff74ac | anggapw/latihan-python-hackerrank | /soal1.py | 742 | 3.84375 | 4 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'sockMerchant' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER n
# 2. INTEGER_ARRAY ar
#
def sockMerchant(n, ar):
socks={}
count=0
f... |
ccf722cee9d425c427e75a09718cdf9dbfb2a692 | bc-maia/udacity_python_language | /B - Scripting/2_error-handling.py | 1,828 | 4.46875 | 4 | """
Try Statement
We can use try statements to handle exceptions. There are four clauses you can use (one more in addition to those shown in the video).
# TODO: try = This is the only mandatory clause in a try statement. The code in this block is the first thing that Python runs in a try statement.
# TODO: except = If... |
102d0faa22cfdbe9317354d2b1ea51e159afd931 | bc-maia/udacity_python_language | /A - Basics/7 - Functions.py | 1,114 | 4.59375 | 5 | # Defining Functions
# Example of a function definition:
def cylinder_volume_function(height, radius):
pi = 3.14159
return height * pi * radius ** 2
# After defining the cylinder_volume function, we can call the function like this.
cylinder_volume_function(10, 3)
# Return or Not?
# this prints something, bu... |
64a2c2df02c1ffd00d693347159d5c7fb4ae1b1b | bc-maia/udacity_python_language | /A - Basics/3 - ListAndDict.py | 2,640 | 4.1875 | 4 | # You would like to count the number of fruits in your basket.
# In order to do this, you have the following dictionary and list of
# fruits. Use the dictionary and list to count the total number
# of fruits, but you do not want to count the other items in your basket.
result = 0
basket_items = {'apples': 4, 'oranges... |
bb4c66c88bf426db1aaca238abad801963832d71 | PulkitSingla/Business_Analyst | /Functions_basics.py | 3,466 | 4.25 | 4 |
integer = -20
abs(integer)
print('Absolute value of -20 is:', abs(integer))
# floating number
floating = -20.83
print('Absolute value of -20.83 is:', abs(floating))
# all(): It returns true if all items passed in iterable object are true.
# Otherwise, it returns False.
# This fxn accepts an iterable obje... |
aa0e9e6943c601785a058b60113ad7307713ae70 | prowrestler215/python-2020-09-28 | /week1/day1/intro.py | 1,702 | 3.703125 | 4 | # Python
# [x] Virtual Environment
# [x] Version
# [x] Print
print('Hello, World!')
# [x] Data Types
# [x] Primitive
# strings
var_name = 'Ace'
# integers
some_int = 1
# floats
some_float = 1.1
# boolean
some_boolean = False
# [x] Composite
var_tuple = (1, 'name') # immutable
# 0 1 2
var_list = [12... |
ba9bed9c0f34338bfceec776faaf6e89c3018c54 | prowrestler215/python-2020-09-28 | /week1/day1/afternoon/for_loop_basic1.py | 1,440 | 3.953125 | 4 | # Basic - Print all integers from 0 to 150.
# for indexx in range(151):
# for indexx in range(0, 151, 1):
# print(indexx)
# Multiples of Five - Print all the multiples of 5 from 5 to 1,000
# for num in range(5, 1001, 1):
# # multiple of 5
# # 10 % 5 -> 0
# # 10 % 6 -> 4
# if num % 5 == 0:
# print(num)
#... |
2929557b634c63e00d01297e78e5a9c04abce0ef | anhpham311/PhamNgocAnh-Fundamentals-C4E22 | /Lab3/Homework/turtle6.py | 354 | 4.09375 | 4 | import turtle
def draw_star(x,y,length):
for i in range(50):
turtle.goto(x,y)
turtle.left(144)
turtle.forward(length)
turtle.speed(0)
turtle.color('blue')
for i in range(100):
import random
x = random.randint(-300, 300)
y = random.randint(-300, 300)
length = random.randint(... |
3e15f89bb9a397e5f1fed03108ce1e7b3ea9c1c4 | anhpham311/PhamNgocAnh-Fundamentals-C4E22 | /Lab3/Homework/serious9.py | 179 | 3.75 | 4 | l = [1,2,5,-10,9,6]
def get_even_list(l):
for i in l:
if i % 2 == 0:
pass
else:
l.remove(i)
return l
print(get_even_list(l))
|
b02886c82ad2fb835137c10858ea9be4157834d6 | anhpham311/PhamNgocAnh-Fundamentals-C4E22 | /Session4/Homework/bt20_8_1.py | 251 | 3.796875 | 4 | getint = str(input("Enter a string: "))
getint = getint.lower()
letter_counts = {}
for letter in getint:
letter_counts[letter] = letter_counts.get(letter,0) + 1
letter_items = list(letter_counts.items())
letter_items.sort()
print(letter_items) |
b240092a86d54efc41a232a9b8d137c86b9660a3 | elizabeth-reji/LPTHW | /stack.py | 581 | 3.890625 | 4 | stack = []
while True:
choice = input("> ")
if choice == "exit":
exit()
choice = choice.split()
if choice[0] == "push":
if len(choice) != 2:
print("invaild input")
else:
stack.insert(0,choice[1])
elif choice[0] == "show":
for i in range(len... |
6266cb8d1383e6ee3edf17b5705da9690aed28bc | zethblue/smartninja | /hw/VehicleManager/VehicleM.py | 1,479 | 3.90625 | 4 | ##This is it! After so many tries, here comes: the Vehicle Manager 1.0.A
class Vehicle(object):
def __init__(self, brand_f, model_f, km_f, GNS_f):
self.brand_f = brand_f
self.model_f = model_f
self.km_f = km_f
self.GNS_f = GNS_f
LVehicle = []
if __name__ == '__main__':
print "... |
d958f94bd7e669d21d2b17fa3469aa51479bf907 | zethblue/smartninja | /10/VehicleManager.py | 1,843 | 4.09375 | 4 | """Vehicle Manager"""
# Version 0.3A Testing Phase #
LVehicle = []
class Vehicle(object):
def __init__(self, brand_f, model_f, km_f, GNS_f):
self.brand_f = brand_f
self.model_f = model_f
self.km_f = km_f
self.GNS_f = GNS_f
def adding_car(a ,b ,c ,d):
LVehicle.append(Vehicle(a, b... |
a881d05459d9981057624d5600e5e7212304eb8a | zethblue/smartninja | /10/VehicleManagerKurs.py | 1,396 | 4.09375 | 4 |
class Vehicle(object):
def __init__(self, brand, model, km, service_date):
self.brand = brand
self.model = model
self.km = km
self.service_date = service_date
def show(self):
print "{} {} {} {}".format(self.brand, self.model, self.km, self.service_date)
if __name__ == ... |
50a64f870e1bb05cc8d32d5f6b53f455386a281f | zethblue/smartninja | /7/Class7/homeworkpeter.py | 1,010 | 4.25 | 4 | # Guess a number game with random number
import random
secret = random.randint(1, 20) # To generate a random number
if __name__ == '__main__':
print "Hello! What is your name?"
user = raw_input("Please enter your Name:\n")
print "Welcome to my Secret Number Game, " + user+'!'
print "Well, I am th... |
4133bef5f867ebb038ab23f4e8a38066ea09491c | danny237/Python-Assignment2 | /is_prime.py | 850 | 4.0625 | 4 | """ Program to check the given number is prime or not """
def is_prime(n):
"""
Function to check prime number
Parameter:
n(int): integer
Return:
bool: True or False
"""
if n < 2:
return False
if n == 2:
return True
else:
for i in ... |
d51fd35de2ef85d3fd67535c39efd6302b0ebf3d | danny237/Python-Assignment2 | /triplet_zero_sum.py | 1,348 | 3.96875 | 4 | """ Program to find three elements that sum to zero from given list """
class Triplet:
"""
Class for calculation the three elements sum to zero
"""
def __init__(self, list1):
"""constructor"""
self.list1 = list1
def three_sum(self):
"""function to return the result list"... |
45a3fbb160a9a12ba2769a1eff500b704f7fb66a | IceJackal/Project-Euler-Solutions | /Python-2.7/problem 2.py | 664 | 3.78125 | 4 | def fibonacciGenerator(max):
first = 1
second = 2
fibonacci.append(first)
fibonacci.append(second)
while True:
first = first + second
if first <= max:
fibonacci.append(first)
else:
break
second = second + first
if second <= max:
... |
5aebfb1eed92568cc168a796d240fe6522ef1f62 | tahheel/repo_test | /if_else.py | 292 | 4 | 4 |
# print("....congrats you are signed in.!")
# a = 27
# b = 78
# if a > b:
# print("yes")
# print("a is the larger number")
# else:
# print("no")
taxcode = input("taxcode:")
price = input("price:")
taxrate = input("taxrate:")
taxcode = price + taxrate
print("taxcode")
|
bd769bdafef5a66af352b26d31d0385e13873be8 | y09esh/play_youtube_using_python | /youtube.py | 1,934 | 3.578125 | 4 | """ channels """
from pafy.pafy import new
from vlc import MediaPlayer
channels = {"dd news":"https://www.youtube.com/watch?v=EaOsJRru-YQ",
"dd india": "https://www.youtube.com/watch?v=JeJrQNWgeV4",
"dd spots": "https://www.youtube.com/watch?v=BJOGi1Wa-Pc",
}
class Channel():
"... |
c12c2d110ae194bd4df5b926910716e1c411cd21 | HenrikSamuelsson/exercism-python-track | /python/high-scores/high_scores.py | 586 | 3.984375 | 4 | def latest(scores):
"""For retrieving the latest score added to the list."""
return scores[-1]
def personal_best(scores):
"""For getting the best score in a list of scorers."""
return max(scores, default=None)
def personal_top_three(scores):
"""Gets the three best scores from a list of scores.""... |
34dc37625b55494b87762da998f761552b7f6cfc | mjn798/sudoku | /backtracking.py | 2,332 | 4.15625 | 4 | class Backtracking:
# track the number of iterations / numbers set as a performance indicator
tracks = 0
# is it allowed to set a certain value at a certain index in the sudoku?
def isAllowed(self, sudoku, index, value):
# create a set of indices of neighbour cells to identify where the... |
dd206d6ae56d393164420fbcc6ea2ba79e465873 | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1012.py | 348 | 3.765625 | 4 | a, b, c = input().split()
a = float(a)
b = float(b)
c = float(c)
triangle = .5 * a * c
circle = 3.14159 * c * c
trapezium = .5 * (a + b) * c
square = b*b
rectangle = a*b
print("TRIANGULO: %.3f" % triangle)
print("CIRCULO: %.3f" % circle)
print("TRAPEZIO: %.3f" % trapezium)
print("QUADRADO: %.3f" % square)
print("RET... |
5f4e504efc08234e27805b4febf66ff02ed0e2e3 | shuvo14051/python-data-algo | /Problem Solving with Algorithms and Data Structures Using Python/Fraction.py | 262 | 3.734375 | 4 | class Fraction:
def __init__(self, numerator, denominator):
self.numerator = numerator
self.denominator = denominator
def __str__(self):
return str(self.numerator) + "/" + str(self.denominator)
mt_f = Fraction(3,5)
print(mt_f)
|
591d784942bcd2cd54288c041a6f661066e93dcf | shuvo14051/python-data-algo | /Udemy best seller course/Array/Array pari sum.py | 388 | 3.71875 | 4 | def pair_sum(li, k):
if len(li) < 2:
print("There is no pair.")
# sets for tracking
seen = set()
output = set()
for num in li:
target = k - num
if num not in seen:
seen.add(num)
else:
output.add(((min(num, target)), max(num, target)))
p... |
f7c6e90a73c98a8c459d02d4b03ed1b002bc2ba4 | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1049.py | 708 | 4 | 4 | c1 = input().lower()
c2 = input().lower()
c3 = input().lower()
if (c1 == "vertebrado"):
if (c2 == "ave"):
if (c3 == "carnivoro"):
print("aguia")
elif (c3 == "onivoro"):
print("pomba")
elif (c2 == "mamifero"):
if (c3 == "onivoro"):
print("homem")
... |
8e671d8963eb68b66874c6873f5e76c855399037 | shuvo14051/python-data-algo | /Problem-solving/HackerRank/Day 6 Let's Review.py | 337 | 3.75 | 4 | test = int(input())
for i in range(test):
word = input()
odd = ''
even = ''
li_word = []
for i in word:
li_word.append(i)
length = len(li_word)
for j in range(0, length, 2):
even += li_word[j]
for k in range(1, length, 2):
odd += li_word[k]
print("{} {}".fo... |
9f029b3916eb096d64078ccd9e677a71445d7533 | shuvo14051/python-data-algo | /Sohoj Vasay Python 3/decorator3.py | 336 | 3.8125 | 4 | class Name:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
@property
def full_name(self):
return self.fname + " " + self.lname
if __name__ == "__main__":
name = Name('Younus', 'Ahamed')
print(name.full_name)
name.full_name = "Shuvo Mia"
pri... |
31e2d27c99af6638d71031c5c521b97a67d7d3e1 | shuvo14051/python-data-algo | /Udemy best seller course/Searching/unordered_seq_search.py | 241 | 3.625 | 4 | def seq_search(arr, item):
pos = 0
found = False
while pos < len(arr) and not found:
if arr[pos] == item:
found = True
else:
pos = pos + 1
return found
arr = [1,23,4,5,6]
result = seq_search(arr, 75)
print(result) |
16a0d25cd27911ba579c480148ef0a5fb3095fd8 | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1153.py | 146 | 3.90625 | 4 | n = int(input())
factorial = 1
if n == 0:
print(1)
else:
for i in range(1, n + 1):
factorial = factorial * i
print(factorial) |
68f85dd890dffc94a210ce4fae47d53d3778d027 | shuvo14051/python-data-algo | /Udemy best seller course/Sorting/bubble_sort.py | 253 | 4.09375 | 4 | def bubble_sort(arr):
for n in range(len(arr)-1, 0, -1):
for k in range(n):
if arr[k] > arr[k+1]:
#its a python style swaping
arr[k], arr[k+1] = arr[k+1],arr[k]
return arr
arr = [4,6,1,3,0]
result = bubble_sort(arr)
print(result) |
b8a9c47c77245bd9d34dbc55f7569ddba934de33 | shuvo14051/python-data-algo | /Googler/even number.py | 213 | 4.03125 | 4 | def is_even(num):
if num %2 == 0:
return True
return False
user_input = int(input("Enter a number:"))
li = []
for i in range(2,user_input+1,2):
if is_even(i):
li.append(i)
print(li)
|
e2b069d950247529beb1d70d6df3d5570397887b | shuvo14051/python-data-algo | /OOP/Geeks/multiple inheritance.py | 424 | 3.84375 | 4 | class Base1:
def __init__(self):
self.name = "Base Class 1"
print(self.name)
class Base2:
def __init__(self):
self.age = "Base Class 2"
print(self.age)
class Derived(Base1):
def __init__(self):
Base2.__init__(self)
Base1.__init__(self)
print("Derived... |
9e7706f163c7f84962fe036157cbe32971f261a8 | shuvo14051/python-data-algo | /Problem-solving/HackerRank/Project Euler 1 Multiples of 3 and 5.py | 215 | 3.703125 | 4 | #two test case gave time limit
test = int(input())
for i in range(test):
result = 0
n = int(input())
for j in range(2, n):
if j % 3 == 0 or j % 5 == 0:
result += j
print(result)
|
d713a181dce59504c0dcda47ef95f18110f61d8b | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1037.py | 326 | 3.78125 | 4 | N = float(input())
if ((N>=0.0) and (N<=25.0)):
print("Intervalo [0,25]")
elif((N>25.0) and (N<=50.0)):
print("Intervalo (25,50]")
elif((N>50.0) and (N<=75.0)):
print("Intervalo (50,75]")
elif((N>75.0) and (N<=100.0)):
print("Intervalo (75,100]")
elif((N<0.0) or (N>100.0)):
print("Fora de inter... |
89f47ade11e26ad4b3d7cc8a5a9efd991d31aa6b | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1151.py | 201 | 3.578125 | 4 | n = int(input())
a = 0
b = 1
result = ' '
for i in range(n):
result = result + str(a) + ' '
# print(a,end=' ')
# print(result)
temp = a+b
a = b
b = temp
print(result.strip())
|
977ceed45df9a09c46c41f8225dedc5c61f733b3 | shuvo14051/python-data-algo | /Udemy/multiplication table.py | 134 | 3.75 | 4 | for i in range(1, 11):
for j in range(1, 11):
print("{1:2} * {0} = {2:4}".format(i, j, i * j))
print("=============")
|
a42ac81d5198f873504327e5bfcf1f7118136a83 | shuvo14051/python-data-algo | /Problem-solving/URI/URI-1020.py | 225 | 3.734375 | 4 | days = int(input())
years = days // 365
remaining_days = days % 365
days = remaining_days // 30
remaining_days2 = remaining_days % 30
print("%d ano(s)" %years)
print("%d mes(es)" %days)
print("%d dia(s)" %remaining_days2)
|
17fc9f451c8674901a597bedba32cb181ea5e06b | Johirul-Islam-JiJ/FullStack-SkillJobs | /fourth class/Dictionary.py | 850 | 3.65625 | 4 |
# Key value pairs
d = {"key":"value",'1':'100','2':'200'}
data = {"name":"Joy","age":25,"dept":"swe"}
print(d)
print(d["key"])
print(d['2'])
print('*'*30)
# for loop in dictionary
for i, j in data.items():
print(i,":",j)
print('*'*30)
print(data.keys())
print(data.values())
print(d.get("key"))
v = d.get("k... |
21729681ba139e8c685c6c8be210979462baf9b3 | myMZeeshanMeo/PythonAssignmetn1 | /ASSIGNMENT_1 (1).py | 5,904 | 4.5625 | 5 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Write a Python program which accepts the radius of a circle from the user and compute the area
r=float (input("Enter radius"))
A=3.142*(pow(r,2))
print("Area of circle = ")
print(A)
# In[2]:
# Write a Python program to check if a number is positive, negative or z... |
ef92ad1187d1ed54cef140d87884835fd793ec90 | WanderAtDusk6/python- | /shootball.py | 601 | 3.703125 | 4 | from random import choice
score_you=0
score_keeper=0
direction=['left','center','right']
for i in range(0,5):
print('=====Round %d-you kick!====='%(i+1))
print('choose one side to shoot?')
print('left,center,right')
you=input()
print('you kicked '+you)
print()
keep... |
24205f13f03d32ef9a1f1ae0de4e739ffa036f4f | WanderAtDusk6/python- | /面向对象3(pycharm版).py | 380 | 4.125 | 4 | # method1
'''
speed = 60
distance = 100.0
time=distance/speed
print(time)
'''
class Car:
speed = 0
def drive(self,distance):
time = distance/self.speed
print(time)
car1 = Car()
car1.speed = 60.0
print('car1 cost time: %.6f'%int(car1.drive(100.0)))
car1.drive(200.0)
car2 = Car()... |
c5a760482d3eb93c5b692019ec75ac5af151fa7c | WanderAtDusk6/python- | /multiplication.py | 352 | 3.65625 | 4 | # -*- coding: gb2312 -*-
# ˷multiplication
'''
# version1
print()
for x in range(1,10):
for y in range(1,10):
print(x*y,end = '\t')
print()
'''
# version2
m = 1
while m <= 9:
n = 1
while n <= m:
print(m*n,end = '\t')
n = n+1
m += 1
print()
... |
9ee457a0347c614c61d11d556aa813ced10d44bb | WanderAtDusk6/python- | /面向对象2.py | 163 | 3.703125 | 4 | class Myclass:
name='sam'
def sayHi(self):
print('hello %s'%self.name)
mc = Myclass()
print(mc.name)
mc.name='lily'
mc.sayHi()
|
31389b4838f573e647ae58212616db13667ee2f6 | castillogo/dashboard_project | /testing/words.py | 1,527 | 4.21875 | 4 |
"""
Example: function for scraping lyrics
def scrape_lyrics(artist):
...
return songs
assert len(scrape_lyrics("Ed Sheeran")) > 0
assert len(scrape_lyrics("false")) == 0
Assumption that our program is correct:
We see that all assertions pass:
Code OK, tests OK
Code wrong, tests incomplete
Code wro... |
71725f3d82af6ebb000085b91b8dbd58cf22c894 | Miladrzh/project-euler | /046.py | 369 | 3.8125 | 4 | # in the name of God
import math
from utils.prime import is_prime
def check(num):
x = int(math.sqrt(num // 2)) # x is the bound for square number
for i in range(1, x + 1):
if is_prime(num - 2 * i * i):
return True
return False
for i in range(3, 10000000, 2):
if not is_prime(i) ... |
f20ebc32d9ea9d4b29d48eaa6467136e0149ee8b | Miladrzh/project-euler | /034.py | 241 | 3.828125 | 4 | import math
def factorial_sum(num):
ret = 0
while num > 0:
ret += math.factorial(num % 10)
num //= 10
return ret
ans = 0
for i in range(10, 10 ** 7):
if i == factorial_sum(i):
ans += i
print(ans)
|
c0b3377aefd268cfec12fbfc98a51bba0a166151 | pwcarney/Goldilocks | /goldilocks.py | 568 | 3.703125 | 4 |
def choose_chairs(input):
with open(input) as file:
input_text = file.read().splitlines()
goldi_weight, goldi_temp = map(int, input_text[0].split(' '))
input_text.pop(0)
good_chairs = []
for ind, input in enumerate(input_text):
input_weight, input_temp = map(int,... |
1c5f6e01262edd8d2fc0fd0d1625b8fed7987d74 | bobhob314/valencer | /valencer.py | 2,246 | 3.828125 | 4 | from random import randrange
elements = ["Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ag", "Cd", "Sn", "Au", "Hg", "Pb"]
valences = [[3, 2], [2, 4], [3, 2], [2, 3], [2, 3], [2, 1], [2], [1], [2], [4, 2], [3, 1], [2, 1], [2, 4]]
print("*Hint*: Type \"QUIT\" and press enter to quit when prompted for an answer.")
print("*Hi... |
8055e7506d3ec2d135bf9e8612d8c0f8f8224834 | morrisunix/python | /projects/rolling.py | 815 | 4.09375 | 4 | from random import randint
def rolling_dice(number_of_dices):
""" Return random integers based on the numeber of dices
Parameters
----------
number_of_dices: int
Number of dices
Returns
-------
list
Random integers on a list
"""
random_integers = []
for tries i... |
a3edb3f7fb6f1f181c2e0275f9bdd21dec24813a | morrisunix/python | /projects/hangman.py | 2,007 | 3.953125 | 4 | import csv
from random import randint
def read_data(data):
try:
with open(data, 'r') as f:
data = [row for row in csv.reader(f.read().splitlines())]
return data
except NoneType:
print("Wrong file")
def compare_answer(random_color, answer):
""" Compare the random color v... |
19bcc76ad9aa9f76160b8833520559b483e3c572 | Jackson-Pike/Examples-Python4th-5th | /oldEnoughDrive.py | 148 | 4.21875 | 4 | age = input("how old are you")
if age<="70" and age>="16":
print("You are old enough to drive!")
else:
print("You should not be driving")
|
5650c818176c0a2280a139efb6f9661b5a0cc4f9 | Jackson-Pike/Examples-Python4th-5th | /Allergy Check.py | 575 | 3.546875 | 4 | #Allergy Check | Practice 1b Jupyter | Sept 2018 | Jackson Pike
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
# Warning, This code is made #
# Custom By Jack Pike. And is more #
# complex than Needed. #
# #
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
#Define Usr Input
input_te... |
b54c924c1e519fb32195e04fcdca28183e8feb83 | MateusAvilla/Meus-Projetos-Tecnico | /Udemy - Curso em Video/Phyton/Exercícios/ex018 - Seno, Cosseno e Tangente.py | 377 | 3.9375 | 4 | from math import radians, sin, cos, tan
angulo = float(input('Digite o ângulo que você deseja: '))
seno = sin(radians(angulo))
print(f'O ângulo de {angulo} tem o SENO de {seno:.2f}')
cosseno = cos(radians(angulo))
print(f'O ângulo de {angulo} tem o COSSENO de {cosseno:.2f}')
tangente = tan(radians(angulo))
print(f'... |
6cf5a60376c87ccf29453dbfa5eb19b9b30785ee | MateusAvilla/Meus-Projetos-Tecnico | /Udemy - Curso em Video/Phyton/Exercícios/ex007 - Média Aritmética.py | 176 | 3.71875 | 4 | n1 = float(input('Digite a primeira nota do aluno: '))
n2 = float(input('Digite a segunda nota do aluno: '))
media = (n1 + n2) / 2
print(f'A média deste aluno é {media:.2}') |
bbd47086f6b8699a089ace80f1e0a3afbdd8f14f | aErgani/Homeworks | /Ahmet Ergani 161044011/CSE321 Introduction to Algorithm Design/HW3/p2.py | 499 | 3.875 | 4 | def NIM():
chipCount = int(input("How many chips are in the game? "))
type(chipCount)
m = int(input("max takeable amount is ? "))
while 1:
print("type how many chips would you like to take (at max", m ,"chips). type '0' to exit")
taken = int(input())
if taken > m:
print("INVALID INPUT")
continu... |
994b57ba71500a3a6148a6376f84c5e5fb7f0cd6 | rontwo/early_projects | /wordcount.py | 1,110 | 4.28125 | 4 | ####Rudimentary program that parses a text file and tallies up the wordcount for each word
#filepath stored in variable 'file'
file = '<<filename>>'
#open file, store each string as separate elements in a list called 'words'
with open(file, 'r') as read_file:
text = read_file.read()
words = text.split()
#delete al... |
9b201586d3096c9740cc9836f453b72fde432949 | csummers77/text_rpg | /human.py | 298 | 3.5 | 4 | class human(object):
def __init__(self,name,power = 5):
self.name = name
self.health = 100
self.power = power
thehuman = human('Link's)
print thehuman.power
print thehuman.name
print thehuman.health
# class Player(object):
# species = "human"
# puljos.Player()
# puljos.species = "Robot"
|
4aa2fa2fae0a6987d4aa9cdd17b6a29a6d978ed4 | ailyanlu/ACM-ICPC-7 | /python/test.py | 267 | 3.59375 | 4 | #!/usr/bin/env python
#coding:utf-8
# Author: cijianzy
# Created Time: 2015年06月16日 星期二 00时01分20秒
import os
for i in range(0,101):
file = str(i)
if os.path.exists(file):
os.remove(file)
else:
print 'no such file:%s'%file
|
cdd60bdbef96976f6952bfb1649e3e7918eb6c71 | HelixAngler/Assignment-1-Driving-Simulation | /Acceleration Simulation.py | 1,109 | 4.0625 | 4 | # This Function is used for calculating the distance,S=V0T+(A*T^2)/2. V0=0m/s^2, so it become S=(A*T^2)/2)
def g(a, t):
s=(a*(t**2))/2
return s
#This Function is used for calculating final velocity and, for optional, velocity during process
def l(a, t):
v=a*t
return v
#This function is used for generati... |
48ce8b7e9403e0ac8aea3c18768b171cf613fd28 | hackeziah/PYTHON-Beginner-Practice- | /lists.py | 178 | 3.75 | 4 | hairs = ['brown', 'blond', 'red','B']
# hairs.append('blacks')
# hairs.insert(1,'violet')
# hairs.remove('brown')
# hairs.sort()
# hairs.reverse()
# hairs.pop()
print(hairs)
|
9a3495537a85a3ec1b7cac089b8512d9728a40f6 | camilafernandez10/programast-par-edad-palabra- | /numeroPar_Impar.py | 465 | 3.9375 | 4 | ### Introducir un numero por teclado y decir si es par o impar
import unittest
def operacion():
num = int(input('Introduzca un numero: '))
if num % 2 == 0:
print('Par')
return 1
else:
print('Impar')
return 0
def es_par(a): return 1 if a%2 == 0 else 0
class PruebasFunciones... |
93f5ce977da6a0b0e4b5543e53f217b5ef4a1633 | fursuli/ITEA | /05.03.2020/task_1.py | 4,475 | 3.96875 | 4 | """
Create class Person with AbcMethods (personal_info, personal_age).
Create child classes: Entrant(last_name, birth_date, faculty),
Student(last_name, birth_date, faculty, year_of_studying),
Teacher(last_name, birth_date, faculty, position, experience).
Create list of n persons, display full info from base AND m... |
6869155052d07b46c812940b6f6984077ede9074 | Bhatsumair/Deploy-Machine-learning-ML-model-in-Docker-container. | /model.py | 551 | 3.78125 | 4 | # loading dataset
import pandas as pd
data=pd.read_csv("salary.csv")
print("Dataset has been loaded ..")
# Creating features and target.
feature=data["YearsExperience"].values.reshape(30,1)
target=data["Salary"]
# loading LinearRegression
from sklearn.linear_model import LinearRegression
model=LinearRegression()
mode... |
240986fa7107e9776564ee2ec86ff5f241c25c6a | antonpriyanka/RobotNavigation-2DMaze-BehavioralCloning | /base.py | 1,451 | 3.875 | 4 | import abc
class RobotPolicy(abc.ABC):
@abc.abstractmethod
def train(self, data):
"""
Abstract method for training a policy.
Args:
data: a dictionary that contains X (observations) and y (actions).
Returns:
This method does not retu... |
bc5560680a55f9e8394570f6b15c695692a84d9b | jenshentan/personality-assessment-DISC | /testpandas.py | 251 | 3.625 | 4 | import pandas as pd
raw_data = {
"name" : ["John", "Mike", "Melvin", "Suresh"],
"python" : [45,100,100,45],
"java" : [95,32,14,100],
"c++" : [23,11,10,0],
"asm" : [0,0,0,0]
}
student = pd.DataFrame(raw_data)
print(student)
|
9007e72cd16c67ab1a1ffabbc410b3ca5a686e3b | arnoengineering/pdf | /PDF_Mods.py | 479 | 3.71875 | 4 | import PyPDF2
def read_pdf(file):
with open(file, 'rb') as pdf:
pdf_obj = PyPDF2.PdfFileReader(pdf)
# creating a pdf reader object
# printing number of pages in pdf file
page_cnt = pdf_obj.numPages
print(page_cnt)
return page_cnt
def reverse(file):
out_pdf = PyPDF2.PdfFileWriter(... |
c878f54b8cb2d9c7c24f8246eaad58878dddd61b | kekmeee/Quantori | /hw/hw10.py | 517 | 3.890625 | 4 | def countKollatza(number):
count = int()
while number != 1:
if number % 2 == 0 and number != 1:
number //= 2
count += 1
else:
number = number * 3 + 1
count += 1
return count
print(f"Count for 11: {countKollatza(11)}")
print(f"Count for 12: {co... |
715e131993ea1846c0e50312fa89377c7870553c | Favi0/python-scripts | /MIT/ps1/ps1a.py | 642 | 4.25 | 4 |
portion_down_payment = 0.25
current_savings = 0
investment_return = 0.04
months = 0
annual_salary = float(input("Enter your annual salary: "))
portion_saved = float(input("Enter the percent of your salary to save, as a decimal: "))
total_cost = float(input("Enter the cost of your dream home: "))
monthly_salary... |
be07eb10c534c41176729d60880e38cc2a43e04b | Ashleshk/Computer-Vision-with-Python-Udemy | /01-Image-Basics-with-OpenCV/03-Direct-Drawing-with-Mouse.py | 4,530 | 3.75 | 4 | ##################################
### SCRIPT ONE: SIMPLE CIRCLES ###
##################################
# You can un/comment all at once with Ctrl+/ (forward slash)
import cv2
import numpy as np
################
### FUNCTION ###
################
# Create a function based on a CV2 Event (Left button DOUBLE click)
d... |
c932f0b42f6129277a68293ca3baf809175b9adf | ohmarchitect/random_data_prediction | /src/moving_average.py | 1,149 | 3.84375 | 4 | import numpy
import matplotlib.pyplot as plt
def RandomWalk(N=1000, d=2):
"""
Use numpy.cumsum and numpy.random.uniform to generate
a 2D random walk of length N, each of which has a random DeltaX and
DeltaY between -1/2 and 1/2. You'll want to generate an array of
shape (N,d), using (for example)... |
bf7de5e120408d3198a0f3457d491d3eafa03fbb | AngeStan/github-list-commits | /start.py | 1,377 | 3.578125 | 4 | from features.html_parser import *
from features.api_processor import *
from features.output import *
author = "freeCodeCamp"
repo = "freeCodeCamp"
main_url = f"https://github.com/{author}/{repo}"
print(f'''Welcome to the Git List Retriever Tool\n\
This program lets you retrieve a number (of your choice) \
of commits... |
252ea635a5b1c951a08ab1a04f144b3b6c264ee1 | srmcnutt/100DaysOfCode | /d22-pong/scoreboard.py | 709 | 3.546875 | 4 | from turtle import Turtle
import random
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.l_score = 0
self.r_score = 0
self.hideturtle()
self.penup()
self.color("yellow")
self.speed("fastest")
self.refresh()
def refresh(self)... |
cdeb419b1327af60ebff776f718d10437b867201 | srmcnutt/100DaysOfCode | /d10-calculator.py | 1,424 | 4.40625 | 4 |
#100daysofcode day 10: calculator. 2021 Steven McNutt
#calling dictionaries from functions
#recursion
def add(n1,n2):
return n1 + n2
def sub(n1,n2):
return n1 - n2
def mult(n1,n2):
return n1 * n2
def div(n1,n2):
return n1 / n2
operations = {
"+": add,
"-": sub,
"*": mult,
"/": div
}
def calculato... |
89741b1830ca240468de35bbc5709166386b9ae7 | sachinwani10/Coding_Practice | /CTCI_1.1.py | 299 | 3.53125 | 4 | def is_unique(testString):
myDict = {}
for c in testString:
if c in myDict:
myDict[c] += 1
else:
myDict[c] = 1
for k in myDict:
if myDict[k] > 1:
return False
return True
myString = "defglcab"
print(is_unique(myString))
|
fd49e33da4fd839e6e970c5f136f096b4eebb5e8 | sangyy/Algorithm_Python | /Python.py | 795 | 3.546875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 30 15:05:20 2019
@author: sangyy
"""
print ("学校操场的400米跑道中套着300米小跑道,大跑道与小跑道有200米路程相重,甲以每秒6米的速度沿大跑道逆时针方向跑,乙以每秒4米的速度沿小跑道顺时针方向跑,两人同时从两跑道的交点A处出发,当他们第二次在跑道上相遇时,甲共跑了多少米?")
n = int(input("请输入第几次相遇:"))
#甲乙走过的总里程
d = 0
for i in range(1,n+1):
if i%9 == 1:... |
80a50b3c800d8b00ff21c2847159c7c1006e4884 | JushuangQiao/MyCodes | /leetcode/python/206.py | 562 | 3.8125 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
return he... |
b26312d99feb4ad163a593a0d5c2e8312ebf787f | JushuangQiao/MyCodes | /leetcode/python/35.py | 316 | 3.578125 | 4 | class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
tmp = 0
for k, v in enumerate(nums):
if v >= target:
return k
tmp = k
return tmp + 1
|
9c8d6830223ca928bb3473255af7fb3c984edb16 | vinay1017/useful-python-programs | /Visualizer.py | 3,060 | 4 | 4 | # A way to toggle a created object's color in Tkinter. Green to red, red to green.
# This is extracted from a school project. Thought it was an interesting and useful piece of code
# that took me a moment to create and understand logically.
import tkinter as tk
from tkinter import *
class room_visualizer():
senso... |
8ff52da8c27895549bf3133bc938c716418e8e79 | GetHubHubVS/pythonintask | /PINp/2015/SOPIN_V_E/3_9.py | 159 | 4 | 4 | name="Доменико Теотокопули"
nick=input("Кто такой Доменико Теотокопули? Это: ")
print("Да! "+name+" - "+nick)
input("Нажмите ENTER для продолжения")
|
5ab48b2ba3d02fe8968702cccbd9ade41b063ab5 | sayyafw/Programming-Projects | /Gaming_Social_Network.py | 5,569 | 3.515625 | 4 | def split_string(source,splitlist):
split = True
output = []
for item in source:
if item in splitlist:
split = True
else:
if split:
output.append(item)
split = False
else:
output[-1] = output[-1] + item
... |
9cca277d91e87e9a8311b50f7a3bba668f3133c7 | xiaoxue11/Statistical_learning_method | /AdaBoost/test.py | 200 | 3.53125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue May 28 23:46:52 2019
@author: 29132
"""
import numpy as np
retarray=np.ones([2,1])
data=np.array([[1,2,3,4,5],[-1,1,2,3,1]])
m=data[:,0]<1
retarray[m]=-1.0 |
0926e507810c83670b62c9b9ff2551f94f8ea0c6 | aparnabreddy/python-assignment-1 | /sum.py | 52 | 3.53125 | 4 | num1=5
num2=10
num3=20
sum=num1+num2+num3
print(sum) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.