blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 3.06M | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 3.06M |
|---|---|---|---|---|---|---|
e2ef440e9f140b93cb1adc8bf478baf2beae8fa3 | timmichanga13/python | /fundamentals/oop/demo/oop_notes.py | 1,389 | 4.25 | 4 | # Encapsulation is the idea that an instance of the class is responsible for its own data
# I have a bank account, teller verifies account info, makes withdrawal from acct
# I can't just reach over and take money from the drawer
# Inheritance allows us to pass attributes and methods from parents to children
# Vehicles... |
523094f54d9bd067b8fd7164cf312c3ace1fd9d9 | timmichanga13/python | /fundamentals/oop/user_chaining/user.py | 1,338 | 3.6875 | 4 | # declare a class and give it a user
class User:
# declaring class attribute
bank_name = "First National Dojo"
def __init__(self, name, email_address, account_balance):
self.name = name
self.email = email_address
# the account balance is set to 0
self.account_balance = accoun... |
2616ca8a82f4341ceee1be609efa5c8648aa2f29 | Mikey-Simmons/Python_Stack | /python/fundamentals/for_loops_basic_1.py | 531 | 3.71875 | 4 | for num in range(151):
print(num)
for num in range(5,1001,5):
print(num)
for num in range(1,100,1):
if num % 5 == 0:
print("Coding")
if num % 10 == 0:
print("Coding Dojo")
else:
print(num)
sum = 0
for num in range(0,500000,1):
if num % 2 == 0:
continue
el... |
25fa2b72832de7ec8c2734d043d854834ee0fd33 | notwhale/devops-school-3 | /Python/Homework/hw21/hw21.py | 1,825 | 4.03125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Написать функцию-генератор, которая объединяет два отсортированных итератора.
Результирующий итератор должен содержать последовательность в которой содержаться все элементы из каждой коллекции, в упорядоченном виде.
list(merge((x for x in range(1,4)),(x for x in rang... |
95eaa4c8b527c0ac22bbd95dcfc30dad1fc836ad | notwhale/devops-school-3 | /Python/Homework/hw09/problem6.py | 973 | 4.1875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Решить несколько задач из projecteuler.net
Решения должны быть максимально лаконичными, и использовать list comprehensions.
problem6 - list comprehension : one line
problem9 - list comprehension : one line
problem40 - list comprehension
problem48 - list comprehensio... |
5c754ed426a79e09081690eadbbd540479faf987 | mariapacifico/CSE231 | /proj02.py | 5,361 | 4.03125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 20:49:43 2019
"""
#Car Rental Sales
#Show user what info they will need to put in
#Ask if they want to continue
#If they do, ask to put in information needed
#Print to show what was inputed and they're final price and milage
#Intro to what info... |
8fc4d6e7d2e0228911a8b3f768fd2acd62c7e1ba | NovaJuan/python-linkedlist | /controllers.py | 2,216 | 4.0625 | 4 | # Here we create the logic to handle all the list functionality
import csv
import platform
import sys
import os
from linkedlist import LinkedList
from data_type import User
users = LinkedList(User)
def clear_terminal():
system = platform.system()
if system == 'Windows':
os.system('cls')
elif sys... |
647852fbc2f57fd041f877af1e7759b6bb5098bf | leostein1234/leostein1234 | /bioinformatics/Matplotlib/random lineplot pyplot.py | 647 | 3.78125 | 4 | import random as r
from matplotlib import pyplot as plt
print(plt.style.available)
plt.style.use('fivethirtyeight')
list_x = [0]
list_y = [0]
for x in range(100):
list_x.append(r.randint(1, 100) - r.randint(1, 50))
list_y.append(1+list_y[x])
plt.plot(list_y, list_x, color = 'b', linestyle='--',la... |
2e7c08e518d29bbbcca0cd478c6de19411bdc3f4 | osyunya/pull-request-test | /Hello World.py | 323 | 3.75 | 4 | import numpy as np
print("Hello World")
for i in range(5):
print(i+1)
<<<<<<< HEAD
def count(a,b):
return a+b
print(count(5,3))
=======
a=np.randint(1,5)
if a%2==0:
print("even_number")
else:
print("odd_number")
>>>>>>> 661e5f764b6a1187272a5c8f5e12fde48b41fd37
print("request")
print("develop")
print("competitio... |
9bc2dabf91883f8ba94d7699fbd661da410076da | Riyuzak2510/Cat-Dog-Image-recognition-system | /cnn.py | 2,039 | 3.625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 12 22:55:27 2017
@author: lenovo
"""
#Convolutional Neural Networks
#since we are using data which is already managed very well and we dont need to work out on splitting the training and testing sets.
#working on building the cnn will be a good idea and this will be our ... |
216821c580ff5d5f8b1968afb3f9635b7178389a | MIKI90/python_The_Hard_way_examples | /ex15.py | 240 | 3.828125 | 4 | from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read()
print"Type the filename again: "
file_again= raw_input("> ")
txt_again= open(file_again)
print txt_again.read()
|
2e164e0e08c86171d4543a6d431c3b02896ce900 | hemdai/Robot-Battle-Game-With-Python | /robot.py | 1,548 | 3.78125 | 4 | from setup import BLUE, WHITE, SQUARE_SIZE, GRAY, ROBOTS
import pygame
class Robot:
PADDING = 10
OUTLINE = 2
def __init__(self, row, col, color):
self.row = row
self.col = col
self.color = color
self.robot1 = False
self.robot2 = False
self.robot3 = True
... |
7b268a8bc5ff03e6973649785a24e517b35238c9 | ducquang2/Python | /Basic_on_HackerRank/Finding_the_percentage.py | 617 | 3.78125 | 4 | # Import decimal
from decimal import Decimal
if __name__ == '__main__':
n = int(input())
student_marks = {}
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
querry_name = input()
# Extract the value into a list: query... |
97d12c33b2d142eaf238ae867bf6324c08a02bf9 | lanvce/learn-Python-the-hard-way | /ex32.py | 1,033 | 4.46875 | 4 | the_count=[1,2,3,4,5]
fruits=['apples','oranges','pears','apricots']
change=[1,'pennies',2,'dimes',3,'quarters']
#this fruit kind of fora-loop goes through a list
for number in the_count:
print(f"this is count {number}")
#same as above
for fruit in fruits:
print(f"A fruit of type :{fruit}")
#also we can g... |
d51ea3e1714590cf9818e86d97507b217a30927f | lanvce/learn-Python-the-hard-way | /ex43_classes.py | 2,686 | 3.625 | 4 | from sys import exit
from random import randint
from textwrap import dedent
class Scene(object):
def enter(self):
print("This scene is not yet configured")
print("Subclass it and implement enter()")
exit(1)
class Engine(object):
def __init__(self,scene_map):
self.scene_map=scen... |
ce5457678e0742d76a9e7935a257cd1af6e05617 | RobertElias/PythonProjects | /GroceryList/main.py | 1,980 | 4.375 | 4 | #Grocery List App
import datetime
#create date time object and store current date/time
time = datetime.datetime.now()
month = str(time.month)
day = str(time.day)
hour = str(time.hour)
minute = str(time.minute)
foods = ["Meat", "Cheese"]
print("Welcome to the Grocery List App.")
print("Current Date and Time: " + month ... |
dae536759b45c9c3db4f98695e57aa4aeb51c88d | RobertElias/PythonProjects | /Multiplication_Exponentiation_App/main.py | 1,673 | 4.15625 | 4 | print("Welcome to the multiplication/exponentiation table app.")
print("What number would you like to work with?")
# Gather user input
name = input("\nHello, what is your name: ").title().strip()
num = float(input("What number would you like to work with: "))
message = name + ", Math is really cool!!!"
# Multiplica... |
0cf8bac0a47bb1156eaaff40503bc1cdcadb50a1 | RobertElias/PythonProjects | /Arrays/main_1.py | 309 | 4.375 | 4 | #Write a Python program to create an array of 5 integers and display the array items.
from array import *
array_num = array('i', [1,3,5,7,9])
for i in array_num:
print("Loop through the array.",i)
print("Access first three items individually")
print(array_num[0])
print(array_num[1])
print(array_num[2])
|
83fb395b9fc573098d6fe9f258391a4eef07f0e9 | RobertElias/PythonProjects | /Favorite_Teacher/main.py | 2,539 | 4.46875 | 4 | print("Welcome to the Favorite Teachers Program")
fav_teachers = []
#Get user input
fav_teachers.append(input("Who is your first favorite teacher: ").title())
fav_teachers.append(input("Who is your second favorite teacher: ").title())
fav_teachers.append(input("Who is your third favorite teacher: ").title())
fav_teac... |
641f7c3be30c236e2fde95d35f59de323cf2643b | RobertElias/PythonProjects | /Arrays/main_7.py | 248 | 4.0625 | 4 | #7. Write a Python program to append items from inerrable to the end of the array.
from array import *
array_num = array('i',[1,3,5,7,9])
print("Original array: " +str(array_num))
array_num.extend(array_num)
print("Extended array: "+str(array_num)) |
6607e083228f819582c1b3adf51b92828287c196 | Nayiib/Programas-de-haskell-a-python | /sumar.py | 121 | 3.796875 | 4 | def division(a,b):
if a<b:
return 0
else:
return 1+division(a-b,b)
print(division(15,3))
|
aceb434b82b3764cd302950e702716604dd71c93 | samiksha-patil/Tic-Tac-Toe | /TicTacToe.py | 3,733 | 3.984375 | 4 | import random
import os
def display_board(board):
os.system('cls')
print('For Your Reference')
print("-------------")
print("| 1 | 2 | 3 |")
print("-------------")
print("| 4 | 5 | 6 |")
print("-------------")
print("| 7 | 8 | 9 |")
print("-------------")
print()
print('... |
2fdaa0262999821ba9c56b768202d90c30ea48f0 | lmlongna/Programming-Paradigme-CSCE-3193 | /Assignment9/assignment9.py | 1,522 | 3.890625 | 4 | # Lambert Longnang
# Assignment9
# December, 01 2019
import sys
import operator
args = sys.argv
if len(args) != 3:
exit("Not enough arguments please pass 2 arguments")
storyFileName = args[1]
skipWordsFileName = args[2]
with open(storyFileName, 'r') as storyF... |
15c344a5337e339a895151575642f932d812b552 | jagadeesh-tolnut/GeeksforGeeks-must-do-coding-questions | /Linked_List/Finding middle element in a linked list.py | 512 | 3.609375 | 4 | # your task is to complete this function
'''
class node:
def __init__(data):
self.data = data
self.next = None
'''
# function should return index to the any valid peak element
def findMid(head):
temp = head
i=1
while temp:
temp = temp.next
i+=1
mid = (i/2)+1
tpo... |
f39a746ea3b200e62e80f3cce4fee4bc30db002b | JagDecoded/100DaysOfCode | /CodeFights/Intro/013-reverseParentheses.py | 313 | 3.53125 | 4 | def reverseParentheses(ary):
ary=list(ary)
while '(' in ary:
for i in range(len(ary)):
if ary[i]=='(':
head=i
elif ary[i]==')':
tail= i
break
ary[head:tail+1]= ary[tail-1:head:-1]
return ''.join (i for i in ary)
|
78289dc9692e19988b1966c19e5a05b5906ece7d | JagDecoded/100DaysOfCode | /CodeFights/Intro/028-alphabeticShift.py | 110 | 3.75 | 4 | def alphabeticShift(inputString):
return ''.join([chr(ord(i)+1) if i!='z' else 'a' for i in inputString])
|
39e63e39353b051896a07eb473ef407514b4df50 | JagDecoded/100DaysOfCode | /CodeFights/Intro/003-checkPalindrome.py | 144 | 3.828125 | 4 | #Given the string, check if it is a palindrome.
def checkPalindrome(inputString):
return True if inputString==inputString[::-1] else False
|
2dae568f69ab9c93d43fb38f7f5a776844bb5e3e | Isco170/Python_tutorial | /Lists/listComprehension.py | 723 | 4.84375 | 5 | # List Comprehension offers a shorter syntax when you want to create a new list based on the values of an existing list.
# Example: Based on a list of fruits, you want a new list, containing only the fruits with the letter "a" in the name
# Without list comprehension
# fruits = ["apple", "banana", "cherry", "kiwi", ... |
3b34b3e68f3687a698ba6aa60bc368ab6c1799cf | Isco170/Python_tutorial | /excercises_folder/02_areaQuadrado.py | 158 | 3.90625 | 4 | lado = int(input("Digite a medida de um dos lados do quadrado: "))
# area = int(lado) ** int(lado)
area = lado**lado
print("Area do quadrado: " + str(area)) |
b1a1d9c0229e6ef91e67a7b12c4a5ff106996742 | Isco170/Python_tutorial | /Strings/escapeCharacters.py | 624 | 3.765625 | 4 | # Escape Character
# To insert characters that are illegal in a string, use an escape character.
# An escape character is a backslash \ followed by the character you want to insert.
# An example of an illegal character is a double quote inside a string that is surrounded by double quotes:
# You will get an error if yo... |
7ec680db4a57cf287609cc90c66f32258c244cfe | BarryPercy/XsandOs | /XsandOs.py | 3,422 | 3.59375 | 4 | ###First Milestone Project. Tic Tac Toe
import random
import sys
from os import system
from IPython.display import clear_output
def checkifboardisfull(boardstate):
counter = 0
for i in boardstate:
if i == 'X' or i=='O':
counter+=1
if counter==9:
print("The game has ended in a draw!")
sys.exit(0)... |
a584ecce006e31bdf07577c279005ac403745f4c | cccczl/testpy | /test10.py | 419 | 3.875 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
for i in "python":
if i == 'h':
continue #条件满足后继续进行循环
print i
#for 循环中 int 会报错
var = 10
while var > 0:
var = var-1
if var == 5:
continue
print "当前变量", var
print "结束"
#for 数值使用范围
for i in range(10):
if i == 5:
continue
... |
d290da8a6a1c605135c04042a63f569b9f987c50 | cccczl/testpy | /test4.py | 238 | 3.9375 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
count = 0
while count<5:
print count, " is less than 5 " # 比5小的数 加后面的话
count = count + 1
else:
print count, "is not less than 5" #如果比5大时,打印这段话 |
02caf0b38eff8ee25714962a07215de61cc8a05c | margocrawf/GeneFinder | /gene_finder.py | 6,851 | 3.890625 | 4 | # -*- coding: utf-8 -*-
"""
Given a dna strand (in this case salmonella) gene_finder finds protein sequences that could be genes
Function takes about 8 seconds with 1500 trials of longest_ORF_noncoding.
@author: Margaret Crawford
"""
import random
from amino_acids import aa, codons, aa_table # you may find these use... |
c19d0fb75a783587a2da882ce9a1eff7091c400a | IonutPopovici1992/Python | /Socratica/random_module_ex2.py | 211 | 3.734375 | 4 | # Generate random numbers from interval [3, 7)
import random
def random_function():
# Random, scale, shift, return...
return 4 * random.random() + 3
for i in range(10):
print(random_function())
|
a315863eeb4b603354fc7f681e053554a35582fc | IonutPopovici1992/Python | /LearnPython/if_statements.py | 276 | 4.25 | 4 | is_male = True
is_tall = True
if is_male and is_tall:
print("You are a tall male.")
elif is_male and not(is_tall):
print("You are a short male.")
elif not(is_male) and is_tall:
print("You are not a male, but you are tall.")
else:
print("You are not a male.")
|
3b8bd7bde6eeff8d4eacc3286e17cd2c1751ebba | IonutPopovici1992/Python | /Socratica/list_comprehension_3.py | 786 | 3.5625 | 4 | # List Comprehension
# Problem
# p_remainders = [x ** 2 % p for x in range(0, p)]
# len(p_remainders) = (p + 1) / 2
# Gauss
movies = ["Star Wars", "Gandhi", "Casablanca", "Shawshank Redemption", "Toy Story",
"Gone with the Wind", "Citizen Kane", "It's a Wonderful Life", "The Wizard of Oz", "Gattaca",
... |
6a7bb24267b969c8ef619255e6b3d22c590b8daf | IonutPopovici1992/Python | /Socratica/classes.py | 754 | 3.875 | 4 | # Python Classes and Objects
class User:
pass
user1 = User()
# user1 is an "instance" of User
# user1 is an "object"
user1.first_name = "Dave"
user1.last_name = "Bowman"
print(user1.first_name)
print(user1.last_name)
print(80 * "-")
first_name = "Arthur"
last_name = "Clarke"
print(first_name, last_name)
p... |
feceb19dab475d964be829cab4843f43ca96268e | XCYZ/pythonlearn | /pythoncorlib/builtin-callable-example-1.py | 291 | 3.5625 | 4 | def dump(fun):
if callable(fun):
print fun,"is callable"
else:
print fun,"is not callable"
class A:
def method(self, value):
return value
class B(A):
def __call__(self, value):
return value
a = A()
b = B()
dump(a)
dump(b)
dump(A)
dump(B) |
d6b57183228bf76a1e3d1d78d3eed262c68c0b06 | UserPython123/python | /week10task1ab.py | 735 | 3.734375 | 4 | # -*- coding: utf-8 -*-
"""
Created on
@author:
"""
from student import student
def main():
Surname = input("Enter student's surname: ")
Firstname = input("Enter student's first name: ")
StuNo = input("Enter student number: ")
Course = input("Enter student's course: ")
... |
a3d9c08704bc4387db208058be87aafac8a1eac7 | UserPython123/python | /week7task4.py | 312 | 3.859375 | 4 | # -*- coding: utf-8 -*-
"""
Created on
@author:
"""
shoppinglist = []
setFlag = 1
item = ""
while(setFlag != 0):
item = input("Enter the item in shopping list : ")
if item == "":
setFlag = 0
break;
else:
shoppinglist.append(item)
print(shoppinglist)
|
3f4261421609d3248060d7b9d12de47ad8bac76d | becomeuseless/WeUseless | /204_Count_Primes.py | 2,069 | 4.125 | 4 | '''
Count the number of prime numbers less than a non-negative number, n.
Example:
Input: 10
Output: 4
Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.
'''
class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
#attemp 1... |
8edd49288e0835c3199760611ae138a555f92b63 | becomeuseless/WeUseless | /136_Single_Number.py | 919 | 3.953125 | 4 | '''
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
'''
class Solution(... |
bf5ae7c2e62b993181809a5a3aa7f8473c737012 | becomeuseless/WeUseless | /58_Length_of_Last_Word.py | 1,705 | 3.765625 | 4 | '''
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
If the last word does not exist, return 0.
Note: A word is defined as a character sequence consists of non-space characters only.
Example:
Input: "Hello World"
Output: 5
'''
cla... |
749f3e58f0dadf8a03dd8a38423c4e2f5d91fca1 | becomeuseless/WeUseless | /168_Excel_Sheet_Column_Title.py | 826 | 4 | 4 | '''
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
...
Example 1:
Input: 1
Output: "A"
Example 2:
Input: 28
Output: "AB"
Example 3:
Input: 701
Output: "ZY"
'''
class Soluti... |
e309820fa81af0c9ac2c89d90ae4f3d083801822 | becomeuseless/WeUseless | /206_Reverse_Linked_List.py | 1,218 | 4.03125 | 4 | '''
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
Follow up:
A linked list can be reversed either iteratively or recursively. Could you implement both?
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val =... |
77665880cde79a8f833fb1a3f8dfe9c88368d970 | codexnubes/Coding_Dojo | /api_ajax/OOP/bike/bikechain.py | 1,120 | 4.25 | 4 | class Bike(object):
def __init__(self,price,max_speed):
self.price = price
self.max_speed = max_speed
self.miles = 0
def displayinfo(self):
print "Here are your bike stats:\n\
Price: ${}\n\
Max Speed: {}\n\
Miles Rode: {}".format(self... |
5ebcc5307bcc5c5ddf117d32054a904f0a4258f7 | Phisit2001/Python | /1-2-3/Test 3 week2.py | 289 | 3.703125 | 4 | friend =["Jan","Cream","Phoo","Bam","Aom","Pee","Bas","Kong","Da","Jame"]
friend[9]="May"
friend[3]="boat"
friend.append("Dome")
friend.append("Poondang")
friend.insert(1,"Csa")
friend.insert(8,"Ped")
friend.remove("Aom")
friend.pop(3)
del friend[7]
friend.clear()
del friend
print(friend) |
617f11b1595c4aacfe6cdbb62bcae48ffa22d10d | NimaFathi/Bioinformatics-Rosalind-Textbook | /BookProblems/Chapter9/Generate the Last-to-First Mapping of a String(BA9K)/BA9K.py | 599 | 3.625 | 4 | def cyclicForm(pattern):
length = len(pattern)
form = [pattern]
def cyclicFormed(pattern , k ):
old = pattern
new = [0] * len(pattern)
for i in range(k):
new[0] = old[-1]
new[1:] = old[:-1]
old = new.copy()
return ''.join(new)
for i i... |
b709a3c1eee9ac609a5551f3d35cd32fc2b236d9 | NimaFathi/Bioinformatics-Rosalind-Textbook | /BookProblems/Chapter2/Implement MedianString (BA2B)/BA2B.py | 1,811 | 3.625 | 4 | import sys
def hamming(str1, str2):
HammingDistance = 0
for i in range(len(str2)):
if str1[i] != str2[i]:
HammingDistance += 1
return HammingDistance
def find_kmer(text, k):
kmer_collection = []
for i in range(len(text) - k):
kmer_collection.append(text[i:i + k])
... |
95c64e20f324714ffd2b6892d1ac8ea3c1d328ed | furusawa057/dict_practice | /address.py | 614 | 3.625 | 4 | def main():
address_books = [
{'name': '東京タワー',
'location': '東京都港区芝公園4丁目2−8',
'zipcode': '1050011'},
{'name': 'スカイツリー',
'location': '東京都墨田区押上1丁目1−2',
'zipcode': '1310045'},
{'name': '通天閣タワー',
'location': '大阪府大阪市浪速区恵美須東1丁目18−6',
'zipcode':... |
8f2b34c087cd792c481acff0c67e15a4420ab6b1 | Sanngeeta/function11 | /Question_2_perfect.py | 663 | 3.734375 | 4 | # def perfect(num):
# i=1
# sum=0
# while i<num:
# if num%i==0:
# sum=sum+i
# if num==sum:
# print("Perfact Number=",num)
# else:
# print("Not perfact number",num)
# i=i+1
# num1=int(input("enter your perfac... |
cfc22bb8b42a56025016a54555b7e7677968eaba | Sanngeeta/function11 | /new ques.py | 592 | 3.8125 | 4 |
# print ("NavGurukul")
# def say_hello():
# print ("Hello!")
# print ("Aap kaise ho?")
# say_hello()
# print ("Python is awesome")
# say_hello()
# print ("Hello…")
# say_hello()
# def message:
# print("hello python")
# message()
# def addtion(a,b):
# c=a+b
# print("Addtion",c)
# addtion... |
ffb1625654153f165e478e4fdc01a2b87636d6d7 | Sanngeeta/function11 | /Ques 3_sum_average.py | 546 | 4.03125 | 4 | # def sum_average(a,b,c):
# sum=a+b+c
# avg=sum/3
# print("sum is",sum)
# print("avg is",avg)
# num1=int(input("enter the number"))
# num2=int(input("enter the number"))
# num3=int(input("enter the number"))
# sum_average(num1,num2,num3)
# num=[1,2,3,[4,5],6,7,[8,9],1,2,3,[4,5]]
# i=0
# sum... |
5efbe08e0c6bfcfa17af4e5903e0ab6ef9175785 | Sanngeeta/function11 | /pre-defind function_que.py | 770 | 4.03125 | 4 |
# def maximum():
# numbers = [3, 5, 7, 34, 2, 89, 2, 5]
# k=max(numbers)
# print(k)
# maximum()
# def addition():
# numbers = [1, 2, 3, 4, 5]
# k=sum(numbers)
# print(k)
# addition()
# def sort_list():
# unorder_list = [6, 8, 4, 3, 9, 56, 0, 34, 7, 15]
# un... |
b96a0cdb70b59a8aae13e6824ec72958eef62c8f | erkghlerngm44/aniffinity | /aniffinity/aniffinity.py | 9,416 | 3.765625 | 4 | """aniffinity class."""
from . import calcs
from . import models
from . import resolver
from .exceptions import NoAffinityError
class Aniffinity:
"""
The Aniffinity class.
The purpose of this class is to store a "base user"'s scores, so
affinity with other users can be calculated easily.
For t... |
1c2228453d3381c88f22ecc15238a30bf15bf309 | easykatka04/ft_strtlist.py | /ft_sum_even_part_lst.py | 110 | 3.65625 | 4 | def ft_sum_even_part_lst(a):
b = 0
for i in a:
if i % 2 == 0:
b += i
return b
|
316dba09db34dce86510050f12e971d4123897d4 | Istiyaq123/NEA-2020-OCR | /new.py | 1,966 | 4.03125 | 4 | #initialiser
p1_score = 0
p2_score = 0
roll = 0
#import random
import random
#define login
def login():
usernameone = input('Enter Username One Username: ')
passwordone = input('Enter Username One Password: ')
usernametwo = input('Enter Username Two Username: ')
while usernameone == usernametwo:
... |
a49dc6026e472799e3f25ac9825e071c5e683c5f | arumugam-ramasamy/algorithms | /python/string/reversestrings.py~ | 290 | 4.03125 | 4 | import sys
def reverseString(str) :
strWords = str.split(' ')
strWords = strWords[-1::-1]
return ' '.join(strWords)
def main():
# print command line arguments
for arg in sys.argv[1:]:
print reverseString(arg)
if __name__ == "__main__":
main()
|
c8f387e774863d1e329bec07592d5191b66004cb | filipov73/SoftUni | /programming_basics_with_python/04.simple_operations_and_calculations-more_exercises/09.weather_forecast-part_2.py | 462 | 4.09375 | 4 | degree_celsius = float(input())
if (degree_celsius >= 26.00) and (degree_celsius <= 35.00):
print(f"Hot")
elif (degree_celsius >= 20.10) and (degree_celsius <= 25.90):
print(f"Warm")
elif (degree_celsius >= 15.00) and (degree_celsius <= 20.00):
print(f"Mild")
elif (degree_celsius >= 12.00) and (degree_cels... |
4faa0822e9a63a1efc25ef9de4c0310e3446550b | filipov73/SoftUni | /programming_basics_with_python/07.conditional_statements-more_exercises/02.sleepy_tom_cat.py | 437 | 3.59375 | 4 | vacation_days = int(input())
minutes_game = ((365 - vacation_days) * 63) + vacation_days * 127
diff = 30000 - minutes_game
if diff > 0:
down_min = 30000 - minutes_game
print(f"Tom sleeps well")
print(f"{down_min // 60} hours and {down_min % 60} minutes less for play")
else:
over_min = minutes_game - ... |
db65eb95188f1b830449851e56c5cb77dcf39f6c | filipov73/SoftUni | /programming_basics_with_python/05.conditional_statements-lab/08.equal_words.py | 113 | 3.921875 | 4 | word_1 = input().lower()
word_2 = input().lower()
if word_1 == word_2:
print(f"yes")
else:
print(f"no")
|
1af7a9246aec6a2f769e3d1f8133afd24c9a706f | filipov73/SoftUni | /python_fundamentals_open_courses/02.functions_and_debugging/03.printing_triangle.py | 396 | 3.921875 | 4 | def print_col(col):
print(f"{col} ", end='')
def print_row():
print()
def draw(n):
for row in range(1, n+1):
for col in range(1, row+1):
print_col(col)
print_row()
for row in range(n, 1, -1):
for col in range(1, row):
print_col(col)
print_row()... |
c236705806c8da54a7b163b8eb78de17c2bd718e | filipov73/SoftUni | /programming_basics_with_python/18.nested-loops-exercise/04.equal_sums_even_odd_position.py | 300 | 3.96875 | 4 | num_1 = int(input())
num_2 = int(input())
for n in range(num_1, num_2 + 1):
odd_sum = 0
even_sum = 0
number = n
for i in range(3):
even_sum += n % 10
n = n // 10
odd_sum += n % 10
n = n // 10
if odd_sum == even_sum:
print(number, end=' ')
|
aaa0e1bb681a7b3a1f57b12929a760898075c8b8 | filipov73/SoftUni | /programming_basics_with_python/17.nested-loops-lab/06.travelling.py | 312 | 4 | 4 | while True:
saved_money = 0
country = input()
if country == 'End':
break
budget = float(input())
while not saved_money >= budget:
money = float(input())
saved_money += money
if saved_money >= budget:
print(f'Going to {country}!')
break
|
46fc8fc6d3faba8aec5fdb615a2f07473f91d224 | filipov73/SoftUni | /programming_basics_with_python/15.for-loop-exercise/07.salary.py | 423 | 3.875 | 4 | num_open_site = int(input())
salary = int(input())
for _ in range(num_open_site):
name_site = input()
if name_site == 'Facebook':
fine = 150
elif name_site == 'Instagram':
fine = 100
elif name_site == 'Reddit':
fine = 50
else:
fine = 0
salary -= fine
if salar... |
7224f796380c94eb143194b6d360f0b11ad12cd2 | filipov73/SoftUni | /programming_basics_with_python/11.while-loop-lab/04.max_number.py | 128 | 3.703125 | 4 | num = int(input())
num_list = []
while num:
n = int(input())
num_list.append(n)
num -= 1
print(f"{max(num_list)}")
|
5cd22038d4983ef2b9bfbec9770044f7398f5458 | filipov73/SoftUni | /programming_basics_with_python/03.simple_operations_and_calculations-exercise/04.tailoring_workshop.py | 332 | 3.609375 | 4 | num_tables = int(input())
length = float(input())
width = float(input())
usd = 1.85
cover_table_big = (width + 0.60) * (length + 0.60)
cover_table_small = length / 2 * length / 2
price_usd = (cover_table_big * num_tables * 7) + (cover_table_small * num_tables * 9)
print(f"{price_usd:.2f} USD")
print(f"{price_usd * usd... |
b18bc8a3b4f75f276ef8d9d07f44856032611d0e | filipov73/SoftUni | /programming_basics_with_python/09.nested_conditional_statements-exercise/09.on_time_for_the_exam.py | 863 | 3.953125 | 4 | hour_exam = int(input())
minute_exam = int(input())
hour_arrival = int(input())
minute_arrival = int(input())
exam = (hour_exam * 60) + minute_exam
arrival = (hour_arrival * 60) + minute_arrival
diff_time = exam - arrival
if diff_time < 0:
print(f"Late")
if abs(diff_time) < 60:
print(f"{abs(diff_time)... |
dfdff57d7bd0134065cf484807c57a14d7c82dad | filipov73/SoftUni | /programming_basics_with_python/12.while-loop-exercise/05.coins.py | 790 | 3.859375 | 4 | change = float(input())
change = round(change * 100)
coin = 200
total_coins = 0
while not change == 0:
coins = change // coin
change = change % coin
coin = coin // 2
if coin == 25:
coin = 20
total_coins += coins
print(total_coins)
# change = float(input())
#
# count = 0
# while change:
# ... |
9ed84fe8900dc202c6d160ef193dc248c6926715 | filipov73/SoftUni | /programming_basics_with_python/14.for-loop-lab/07.vowels_sum.py | 650 | 3.921875 | 4 | word = input()
sum_vowels_letters = 0
vowels_letters_dict = {
'a': 1,
'e': 2,
'i': 3,
'o': 4,
'u': 5
}
for l in word:
if l in vowels_letters_dict.keys():
sum_vowels_letters += vowels_letters_dict[l]
print(sum_vowels_letters)
# word = input()
# sum_vowels_letters = 0
#
# for letter in wo... |
50b1be7a68dcce6b3c193a3390df2ff5931608c2 | MahoHarasawa/Maho | /uranai02.py | 5,773 | 4 | 4 | '''ソウルナンバー占い
合計が1桁になるまで足し、最終的に出た数がソウルナンバー
ぞろ目はそのまま'''
#8桁の生年月日を入力 1998/04/11生まれ⇒1,9,9,8,0,4,1,1
num1=int(input("1桁目⇒"))
while num1>=10 or num1<0:
print("0または1桁の正の数で入力してください")
print()
num1=int(input("1桁目⇒"))
num2=int(input("2桁目⇒"))
while num2>=10 or num2<0:
print("0または1桁の正の数で入力してください")
... |
54c0907406dce3b5e70762bef6da236633b2b344 | rjunghaas/Data-Mining-Examples | /Tensorflow/mb_sgd_classifier_basic.py | 2,358 | 3.625 | 4 | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.contrib.layers import fully_connected
# Load MNIST data
mnist = input_data.read_data_sets("/tmp/data")
# Constants for setting up neural network
n_inputs = 28*28 #MNIST
n_hidden1 = 30
n_hidden2 = 10
n_outputs = 10
# Le... |
51bb0eae8c6fd2a5b4c1fc554e95ec85dde18a57 | sandeepkapase/examples | /templates/python/threading.Thread.example.py | 450 | 3.78125 | 4 | import threading
import time
import sys
import random
class Hello(threading.Thread):
def __init__(self, min, max):
self.min, self.max = min, max
threading.Thread.__init__(self)
def run(self):
time.sleep(random.randint(1,3))
print "This is simple string"
tLst = []
for i in ... |
99193b9b585fd3cdb2829f13e7fac7786d388491 | ayush-09/Recursion | /IsArraySorted.py | 349 | 3.828125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 18 14:04:51 2021
@author: Ayush
"""
def isSort(arr,n):
if n==0 or n==1:
return True
if arr[n-2]>arr[n-1]:
return False
sa = isSort(arr, n-1)
return sa
if __name__=="__main__":
n=int(input())
arr = list(input().split()[:... |
2730166b08043764a7e58c606495f8d55f881b76 | ayush-09/Recursion | /Class Assignment.py | 435 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 18 19:15:26 2021
@author: Ayush
"""
def TeacherAlice(n):
if n==1 or n==2:
return n+1
else:
c1 = TeacherAlice(n-1)
c2 = TeacherAlice(n-2)
return c1+c2
if __name__=="__main__":
T = int(input())
for i in rang... |
23ed4ec62d29dc84254b51f079dcd36b8337249a | ayush-09/Recursion | /FactorialPop.py | 247 | 3.84375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 17 13:47:33 2021
@author: Ayush
"""
def fact(n): # result while pop the stack
if n==0 or n==1:
return 1
return n * fact(n-1)
if __name__=="__main__":
print(fact(5)) |
9724d8fa3e0c33411618c6e3186200d67c0d2bb0 | DuoLife-QNL/Python_OJ | /character_statistics.py | 186 | 3.5625 | 4 | ch = input()
num = int(input())
l = []
for x in range(0, num):
s = input()
if (s.count(ch.upper()) + s.count(ch.lower()) >= 3):
l.insert(0, s)
for x in l:
print(x)
|
a408767d618b41216a8375c5d2d117346ada4b49 | DuoLife-QNL/Python_OJ | /hw_06/fraction.py | 2,641 | 3.859375 | 4 | class fraction(object):
def __init__(self, numerator, denominator):
#将分数正规化处理,即只在分子中出现负号
if(denominator < 0):
numerator = -numerator
denominator = - denominator
self.numerator = numerator
self.denominator = denominator
def add(self, a):
numerator ... |
a9c7e6fbb09f341a39589fcd2e4cb417179a0d79 | DuoLife-QNL/Python_OJ | /BMI.py | 243 | 4 | 4 | weight, height = map(float, input().split())
bmi = weight / (height ** 2)
if bmi < 18.5:
grade = 'A'
elif 18.5 <= bmi < 24:
grade = 'B'
elif 24 <= bmi < 28:
grade = 'C'
else:
grade = 'D'
print("{}:{:.2f}".format(grade, bmi)) |
256f3e7cfe573c0bed1c8e5e62c6df1226d9cc79 | AlenaGB/hw | /5.py | 465 | 4.125 | 4 | gain = float(input("What is the revenue this month? $"))
costs = float(input("What is the monthly expenses? $"))
if gain == costs:
print ("Not bad. No losses this month")
elif gain < costs:
print("It's time to think seriosly about cutting costs")
else:
print("Great! This month you have a profit")
staff... |
8c15d523e93f4a23bb5e30d10f605350dac426a7 | buffik1989/untitled | /venv/list5_2.py | 1,531 | 3.859375 | 4 | # -*- coding: utf-8 -*-
'''
Задание 5.2
Запросить у пользователя ввод IP-сети в формате: 10.1.1.0/24
Затем вывести информацию о сети и маске в таком формате:
Network:
10 1 1 0
00001010 00000001 00000001 00000000
Mask:
/24
255 255 255 0
11111111 11111111 11111111 000000... |
25e69bb7661ba76e71a42c2f924274d1d1107a31 | txemac/adventofcode2017 | /day02_2.py | 2,621 | 3.9375 | 4 | """
--- Part Two ---
"Great work; looks like we're on the right track after all. Here's a star for your effort." However, the program
seems a little worried. Can programs be worried?
"Based on what we're seeing, it looks like all the User wanted is some information about the evenly divisible values
in the spreadsheet... |
c619f9cd9cef317f81eab2637a5b454ef9c745e5 | TwiggyTwixter/Udemy-Project | /test.py | 309 | 4.15625 | 4 | print("This program calculates the average of two numbers")
firstNumber = float (input({"What will the first number be:"}))
secondNumber = float (input({"What will the second number be:"}))
print("The numbers are",firstNumber, "and",secondNumber)
print("The average is: ", (firstNumber + secondNumber )/ 2) |
2fff0de67010646a6e04b1b07da6f3be7cb31631 | MaxOvcharov/Python_for_DevOps | /sys_admin_utils_for_working_with_data/duplicate_file_finder.py | 963 | 3.640625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from checksum_checker import create_checksum
from disk_path_scanner import RecursivePathWalker
from os.path import getsize
def find_duplicates(path='/tmp'):
"""
Recursive finder of all duplicate path
:param path: paht name
:return:
"""
... |
305ed394d7736235e0feec707e4d1f6072c7e955 | craigerrington/codeacademy | /coin_toss.py | 482 | 3.765625 | 4 | import random
def coin_toss(call,bet):
num = random.randint(1, 2)
if call == "Heads" and num == 1:
print("Heads, you won " + str(bet))
return bet
elif call == "Tails" and num == 2:
print("Tails, you won " + str(bet))
return bet
elif call == "Tails" and num == 1:
... |
d0a525d5b4decc9b9c3190ba84eb06e4c06ca4d8 | hariss0411/Python-Codes | /cheap.py | 678 | 3.734375 | 4 | for _ in range(int(input())):
string = input()
aCost = int(input())
bCost = int(input())
length = len(string)
ans = 0
for i in range(0,length//2):
if(string[i] == '/' or string[length - i - 1] == '/'):
if(i == length - i - 1):
ans += min(aCost, bCost)... |
a82800080a68aa44601c27075fe1d79d0fc49d22 | hariss0411/Python-Codes | /exception.py | 632 | 3.75 | 4 | class InvalidLengthException (Exception):
pass
class Mobile:
def __init__ (self,mob_no):
self.__mob_no=mob_no
def validate_mobile_number(self):
try:
if(len(self.__mob_no)!=10):
raise InvalidLengthException
else:
print("Valid M... |
37899a51d576727fdbde970880245b40e7e5b7b4 | dusanvojnovic/tic-tac-toe | /tic_tac_toe.py | 2,430 | 4.125 | 4 | import os
board = [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
def print_board(board):
print(board[7] + ' |' + board[8] + ' |' + board[9])
print("--------")
print(board[4] + ' |' + board[5] + ' |' + board[6])
print("--------")
print(board[1] + ' |' + board[2] + ' |' + board[3])
def game()... |
46be93000434cb66a3ad8784c4c65d03d9f3eab6 | ravindrank10/list_python | /insertndelete.py | 199 | 4 | 4 |
x=[10,2,3,40,3]
print (x)
x.remove(3)
print("after removing 3" , x)
del x[3]
print("after deleting index3" , x)
x.append(5)
print("after appending 5" , x)
x.pop(1)
print("after popping index 1" ,x)
|
ba76e52f1664383fe838450358d8fdd961844e00 | Garage-at-EEE/Python-JavaScript | /Python_Syntax/garage - 4. class.py | 509 | 3.578125 | 4 | class Human:
# class Human(object):
def talk(self):
print('I can talk')
def walk(self):
print('I can walk')
def eat(self):
print('I can eat')
class Teacher():
def teach(self):
print('I can teach')
class Honored_Teacher(Teacher,Human):
def __init__(self,number):
self.number = number
def prize(self):
p... |
8ffb1206686eda2a633ccf79d07d1123627b3ba4 | zhaopengme/utilbox | /utilbox/mail_utils/mail_utils.py | 4,162 | 3.53125 | 4 | """
Utility module to handle sending of email messages.
"""
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
__author__ = "Jenson Jose"
__email__ = "jensonjose@live.in"
__status__ = "Alpha"
class MailUtils:
"""
Utility class containing methods for sending of... |
4529eef083b4a27e6b7bf0c36448deea1a213878 | TIPlatypus/RS-Codes | /Test.py | 11,933 | 3.515625 | 4 | inverseval = [[0,0]]*7
def gf_division(x,y):
if y == 0:
print("Division By Zero")
return null
return gf_multiplication(x,inverseval[y-1][1])
def create_inverse():
for i in range(0,7):
inverseval[i] = [gf_pow(2,i),gf_pow(2,7-i)]
#bubble
temp = [0,0]
for i in range(0,7):
... |
f02c3f4c39690f1027918f14318b60c1eea896b3 | MickeysClubhouse/environment | /Playground.py | 1,418 | 3.5 | 4 | import numpy
from constant import *
class Playground:
"""
class playground is a dimension_x* dimension_y grid
mark the objects' position
be shown by show() in trustGame.py
"""
dimension_x = 0
dimension_y = 0
grid = numpy.zeros((1, 1), dtype=int)
apples = []
def __init__(self, ... |
b17a130e74e8278fb7bdb3d78eec979bfce79053 | ManojAdwin/100DaysofCode-Python | /Day 2/Ex3_ Life_in_weeks.py | 175 | 3.71875 | 4 | age = input("What is your age? ")
newage=90-int(age)
days=newage*365
months=newage*12
weeks=newage*52
print(f"You have {days} days, {weeks} weeks, and {months} months left.")
|
7eea6b7d336695f0efcb41c84669ae2212ad625e | ManojAdwin/100DaysofCode-Python | /Day 8/Ex1_ Paint Area Calculator.py | 305 | 4.03125 | 4 | import math
def paint_calc(height, width, cover):
num = height*width
num_of_cans = math.ciel(num/cover)
print(f"You'll need {num_of_cans} of paint")
test_h = int(input("Height of wall: "))
test_w = int(input("Width of wall: "))
coverage = 5
paint_calc(height=test_h, width=test_w, cover=coverage)
|
f8e6189d09a4ed48198474edb863a09eb7971034 | ManojAdwin/100DaysofCode-Python | /Day 9/PROJECT_ Blind Auction.py | 1,007 | 3.8125 | 4 | logo = '''
___________
\ /
)_______(
|"""""""|_.-._,.---------.,_.-._
| | | | | | ''-.
| |_| |_ _| |_..-'
... |
dbcd8ada19c245fa04913d1b114a25e2812a1d00 | varun-deokar/Cipher-Algorithms | /playfair_cypher.py | 4,120 | 3.609375 | 4 | def input_function():
message = input("Enter a message\n")
key = input("Enter a key\n")
message = message.lower()
message = message.replace('j', 'i')
key = key.lower()
return message, key
def playfair_key_generation(key):
key = key.replace("j", "i")
a = 'a'
row, col = (5, 5)
ma... |
f4247987858702440a4739dc84674cec373d9384 | league-python-student/level0-module1-dencee | /_02_variables_practice/circle_area_calculator.py | 1,345 | 4.53125 | 5 | import turtle
from tkinter import messagebox, simpledialog, Tk
import math
import turtle
# Goal: Write a Python program that asks the user for the radius
# of a circle and displays the area of that circle.
# The formula for the area of a circle is πr^2.
# See example image in package to chec... |
d79a211d4907bff6ee5c10473c71eaf021057729 | PaulKitonyi/Python-Practise-Programs | /testing_functions/odd_even.py | 94 | 3.796875 | 4 | def even_odd(n):
if n%2 == 0:
return True
return False
# print(even_odd(2))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.