blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
989d8d4ad415764c97332ce8008f1946c5a90d24 | thuaung23/rock-paper-scissors | /main.py | 2,083 | 4.28125 | 4 | # This is a simple game of Rock, Paper, Scissor
# Written by: Thu Aung
# Written on: Sept 10,2020
print('Welcome to the game of Rock, Paper and Scissor!!!')
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
__... | false |
ef219d587fb46ba7dd01c69f55e05aca2b0de6f1 | sn1p3r46/pyspacexy | /psyspacexy/point.py | 1,610 | 4.4375 | 4 | #!/usr/bin/python3
from numbers import Number
class Point:
"""
This class is meant to describe and represent points in a 2D plane,it also
implements some basic operations.
"""
def __init__(self,x,y):
if not isinstance(x,Number) or not isinstance(y,Number):
TypeError("Coordin... | true |
3a934cf92f631e657b1191106a0db02e70f707da | JAYASANKARG/cracking_the_coding_interview_solution | /is_unique.py | 892 | 4.21875 | 4 | """Is Unique: Implement an algorithm to determine if a string has all unique characters. What if you
cannot use additional data structures clear
"""
"""s=input("Enter the string : ")
before_set=len(s)
s=set(s)
after_Set=len(s)
if(before_set==after_Set):
print("all is unique")
else:
print("Not unique")
o(1)
r... | true |
e90427b98d48bc2feab9fdc1d3091a538f99cbaf | willtseng12/dsp | /python/q8_parsing.py | 2,105 | 4.59375 | 5 | # The football.csv file contains the results from the English Premier League.
# The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of
# goals scored for and against each team in that season (so Arsenal scored 79 goals
# against opponents, and had 36 goals scored against them). Write a program to r... | true |
4ff04cb313be5cb69b00b116cfaf71cfd771ba25 | spicy-crispy/python | /py4e/iterationtest.py | 373 | 4.25 | 4 | count = 0
print('Before:', count)
# This loop goes through the numbers in the list and counts their position
for thing in [9, 41, 12, 3, 74, 15]:
count = count + 1
print(count, thing)
print('After:', count)
print('Summing in a loop')
sum = 0
print('Before:', sum)
for item in [9, 41, 12, 3, 74, 15]:
sum = ... | true |
0f541ff7da0c1b58ddc9dba2b5a2b8c31e6dfe9b | spicy-crispy/python | /bio/symbol_array.py | 1,058 | 4.15625 | 4 | def symbol_array(genome, symbol):
array = {}
n = len(genome)
extended_genome = genome + genome[0:n//2 - 1] # extended because circular DNA,
# so must extend genome by length of the window (minus 1) to catch the tail to head fusion nucleotides.
# note: if you dont -1, still get same answer, j... | true |
ae24e94f4658933a32895c4531daecc4b537e83a | amkolotov/homework_python | /homework_6/homework_6.2.py | 566 | 4.28125 | 4 | # Реализовать класс Road (дорога)
# Определить метод расчета массы асфальта, необходимого для покрытия всего дорожного полотна
class Road:
def __init__(self, length, width):
self._length = length
self._width = width
self.__thick = 0.05
self.__consumption = 25
def mass(self):
... | false |
adc84c39f426a9010de6de00f2b1c27bdf2b6807 | TiffanyD/Hangman | /GuessingWithLimit.py | 2,660 | 4.1875 | 4 | from math import pi
spaces = " "
spaces2 = " "
print ("%sShapes available to compute: Triangle, Square, Rectangle, Circle" %spaces)
def multiplier(counter,number,retain,shape):
return numbe... | true |
fdcc00bc129f576f5f339c853b5919ed3963cbbd | cavan33/My_OpenBT_Backup | /PyScripts/Scikit-Learn Learning/StatisticalLearning_ScikitLearn.py | 2,549 | 4.125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
================================
Statistical learning: the setting and
the estimator object in scikit-learn
================================
This section of the tutorial...
"""
from sklearn import datasets
iris=datasets.load_iris()
data=iris.data
data.shape
# Example ... | true |
113024536e704d0d7852f867f4f6b42cf2b592f1 | qqqq5566/pythonTest | /ex5.py | 852 | 4.3125 | 4 | #-*- coding:utf-8 -*-
#python 中的格式化输出变量
#如果在{0}有数字,则其他的{n},必须也是数字
my_name = 'Zend A. Shaw'
my_age = 35
my_height = 74
my_weight = 180
my_eyes = 'blue'
my_teeth = 'White'
my_hair = 'Brown'
#f 是format的意思
#print(f'Let\'s talk about {my_name}') #这中格式化字符串从Python3.6开始使用
print("Let's talk about {}.".format(my_name))
prin... | true |
2df2ae4378929ad2fdd58be254c9795c0ee7c2aa | AadeshSalecha/HackerRank---Python-Domain | /Classes/ClassesDealingwithComplexNumbers.py | 2,658 | 4.3125 | 4 | #Classes: Dealing with Complex Numbers
#by harsh_beria93
#Problem
#Submissions
#Leaderboard
#Discussions
#Editorial
#For this challenge, you are given two complex numbers, and you have to print the result of their addition, subtraction, multiplication, division and modulus operations.
#
#The real and imaginary precisio... | true |
8239b18b51180346a0d573b10a46ffb9d6ceec56 | fapers/python-beginners-example | /dicionario.py | 787 | 4.53125 | 5 | '''Tuplas (), o conteúdo não pode ser alterado ou removido'''
teste = (1,2,3)
print(teste[1])
'''Dicionário {}, possui chave e valor e pode ser acessado pela chave'''
pins = {"Mike":1234, "Joe":1111, "Jack":2222}
print(pins['Jack'])
print(pins.keys())
print(pins.values())
person97 = {"name":"Jack", "surname":"Smith",... | false |
cd9f1f81a4b28f44315851db386f710356a8ffe7 | Seemasikander116/ASSIGNMENT-1-2-AND-3 | /Assignment 3.py | 1,760 | 4.125 | 4 | #!/usr/bin/env python
# coding: utf-8
# Seema Sikander
# seemasikander116@gmail.com
# Assignment #3
# PY04134
# question 1: Make calculator with addition , subtraction, multiplication, division and power
# In[1]:
print('***Calculator***')
x=int(input('Enter Number1:'))
y=int(input('Enter Number2:'))
print('Sum of ... | true |
772101a29feadcb198dcba45f0a2300edfd54ecc | suniljarad/unity | /Assignment2_3.py | 1,113 | 4.53125 | 5 | #
#Step 1 : Understand the problem statement
#step 2 : Write the Algorithm
#Step 3 : Decide the programming language
#Step 4 : Write the Program
#Step 5 : Test the Written Program
#program statement:
# accept one number from user and return its factorial.
###############################################... | true |
32ba947924046228ab39a8ac4ff350d3e38613eb | suniljarad/unity | /Assignment1_3.py | 1,294 | 4.28125 | 4 | #
#Step 1 : Understand the problem statement
#step 2 : Write the Algorithm
#Step 3 : Decide the programming language
#Step 4 : Write the Program
#Step 5 : Test the Written Program
#program statement:
# Take one function named as Add() which accepts two numbers from user and return addition of that two numb... | true |
7f2a3f00292a7cd74e77020f9ac27c9f142f9c04 | suniljarad/unity | /Assignment1_8.py | 1,066 | 4.5 | 4 | #
#Step 1 : Understand the problem statement
#step 2 : Write the Algorithm
#Step 3 : Decide the programming language
#Step 4 : Write the Program
#Step 5 : Test the Written Program
#program statement:
# accept number from user and print that number of “*” on screen
######################################... | true |
80c369d21ed6c57919bc5700a044d51c26cb6857 | suniljarad/unity | /Assignment2_1.py | 1,936 | 4.125 | 4 | #
#Step 1 : Understand the problem statement
#step 2 : Write the Algorithm
#Step 3 : Decide the programming language
#Step 4 : Write the Program
#Step 5 : Test the Written Program
#program statement:
#Create on module named as Arithmetic which contains 4 functions as Add()for addition,Sub()for subtraction,Mult... | true |
41ca92cc3e3850e3e24d28a55e594ae386bab853 | Bhumiika16/Python_Assignment | /Problem(2.5).py | 520 | 4.28125 | 4 | #Length, Breadth and Heigth of both the cuboid is taken as an input from user.
dimensions_x = list(map(int, input().split(",")))
dimensions_y = list(map(int, input().split(",")))
#Initialized volume of both the cuboid as One.
volume_of_x, volume_of_y = 1, 1
#Loop is run 3 times to multiply all the 3 dimesnions of the... | true |
7e8d417286b457522937ab5bf79664b56322ee38 | chiren/kaggle-micro-courses | /python/lesson-03/ex-02.py | 339 | 4.125 | 4 | """
Exercise 02:
Define a function named avg2 which takes 2 arguments n1, n2 and return the average
of n1, n2.
Then run your avg2 function with 2 numbers, and print out the result
ex:
result = avg2(3, 4)
print("Result:", result)
"""
# define your function here
# Call your function with 2 numbers, and print ou... | true |
a0d2d1375a743c8efc7264405b0698de33eb9f45 | chiren/kaggle-micro-courses | /python/lesson-03/ex-05-solution.py | 698 | 4.25 | 4 | """
Exercise 05:
Define 2 functions. The first one named larger which takes 2 numbers,
and return the larger of the 2 numbers. The second one named smaller which
takes 2 numbers and return the smaller one.
Call your functions with 2 number, and print out the results
ex:
a, b = 4, -5
print("The larger of a and b is... | true |
596798d01ca2ddc3e7498da16e9066dec7c042c1 | chiren/kaggle-micro-courses | /python/lesson-04/ex-01-solution.py | 752 | 4.125 | 4 | """
Function Name: first_item
Function Arguments: list
Return: The first item of the list
Function Name: last_item
Function Arguments: list
Return: The last item of the list
"""
# define your function here
def first_item(list):
return list[0]
def last_item(list):
return list[-1]
# The following codes test... | true |
8c83babb242becf48e9f9da462432a43addbdf5f | chiren/kaggle-micro-courses | /python/lesson-05/ex-09.py | 992 | 4.5 | 4 | """
Define a function which takes a list of grades, and calculates the Grade Point Average(GPA)
for the courses taken. Assuming each course has the same weight.
Function Name: gpa
Function Arguments: grades which is a list of grades
Returns gpa which is a decimal number
** NOTE **
This time there is no grade_to_po... | true |
30ab097763c7edfee6c142b052a27726973723a4 | Choumingzhao/ProgrammingProjectList | /TextProcessing/PigLatin.py | 566 | 4.15625 | 4 | # -*- encoding:utf-8 -*-
import re
def pigLatin(word):
if word.isalpha() is False:
raise TypeError
lower = word.lower()
# When word is not started with vowel letter
if all([not lower.startswith(i) for i in 'aeiou']):
head = re.match(r'[bcdfghjklmnpqrstvwxyz]+', lower).group()
r... | false |
dda91b44d572827db5ce113732a936e22058d125 | hoops92/Intro-Python-I | /src/05_lists.py | 545 | 4.34375 | 4 | # For the exercise, look up the methods and functions that are available for use
# with Python lists.
x = [1, 2, 3]
y = [5, 6, 7]
# For the following, DO NOT USE AN ASSIGNMENT (=).
# Change x so that it is [1, 2, 3, 4]
# YOUR CODE HERE
x.append(4)
print(x)
# Using y, change x so that it is [1, 2, 3, 4, 8, 9, 10]
# ... | true |
ced82fd1194a648e6f884744d02261fa3c4758a8 | yusuf-zain/1786-voting-simulator | /1786-voting-simulator.py | 1,378 | 4.125 | 4 | import sys
print("""""")
print("""Welcome to Voting Simulator 1786.
Before we can decide whether you could vote,
we will have to ask you some questions.
Please answer in a yes/no format (besides age).
""")
closing = """Thank you for playing!"""
landowner = (input("Do you own any land? ").lower())
if landowner is not {"... | true |
4fb31538c36bc9ed15236ec487ef579ae17855e9 | reisenbrandt/python102 | /sequences.py | 1,182 | 4.5 | 4 | # strings
'example string'
empty_string = ''
# integers
7
# floats
7.7
# booleans
True
False
# list => indicated by square brackets
languages = ['python', 'javascript', 'html', 'css']
empty_list = []
# lists use a zero based index => ALWAYS starts at 0
# lists have two indexes => a positive index and a negative in... | true |
7cdf8971bb0c2e8cfd7886227578219128aa9e18 | gxgarciat/Playground-PythonPractice | /D4_p.py | 2,491 | 4.3125 | 4 | # Type a program that will play Rock, Paper, Scissors against the user
# Use the ASCII code to show the selection from the computer and the user
import random
computerRound = 0
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
... | true |
6f05809c55668ea82385da806958702556da9912 | gxgarciat/Playground-PythonPractice | /D3_c4.py | 1,205 | 4.40625 | 4 | # Build a program that create an automatic pizza order
# Consider that there are three types of pizza: Small ($15), Medium ($20) and large ($25)
# If you want to add pepperoni, you will need to add $2 for a small pizza
# For the Medium or large one, you will need to add $3
# If you want extra cheese, the added price wi... | true |
ecd967ece7662a1551df91ec391e81c29d947220 | soyo-kaze/PythonTuT101 | /Chap2 Functions.py | 770 | 4.28125 | 4 | """
-Chapter 2-
\Functions/
->It is systematic way of solving a problem by dividing the problem into several
sub-problems and then integrating them and form final program.
->This approach also called stepwise refinement method or modular approach.
=Built-in Functions=
1. input function: accepts string from user w... | true |
932d18a22a09731d2782c046f68b299a8b6906f1 | SadraZg/python_mini_projects | /Queue.py | 1,264 | 4.21875 | 4 | from LinkedList import *
class Queue:
def __init__(self):
self.queue = LinkedList()
def is_empty(self):
return self.queue.is_empty()
def enqueue(self, element):
self.queue.insert_last(element)
def dequeue(self):
return self.queue.delete_first()
d... | false |
af65992a62e81fb46ac24b27ce8c2f6bb1c2ccbd | SadraZg/python_mini_projects | /DoubleLinkedList.py | 1,336 | 4.3125 | 4 | class Node:
def __init__(self, element=None):
self.element = element
self.next_node = None
self.prev_node = None
class DoubleLinkedList:
""" A double LinkedList has both way arrows ' ↔ ' between nodes """
def __init__(self):
self.head = None
def is_empty(se... | false |
cbab49aae4192297353906881985b65627eafa20 | mateusrmoreira/Curso-EM-Video | /desafios/desafio04.py | 521 | 4.4375 | 4 | ''' 13/03/2020 by jan Mesu
Escreva um valor e printe o tipo primitivo
e todas as informações sobre ele.
'''
from cores import cores
n = input('Digite alguma coisa: ')
print(
f"""{cores['vermelho']}
O tipo primitivo de {n} é {type(n)}
Alphanumerico {n.isalpha()}
É numerico {n.isnumeric()}
lowercase {n.islower()}
I... | false |
6108cfde46b2d1acd5996aebd89ea52d074929f4 | mateusrmoreira/Curso-EM-Video | /desafios/desafio37.py | 473 | 4.25 | 4 | """ 25/03/2020 jan Mesu
Escreva um programa que peça um número inteiro qualquer
e peça para o usuário escrever uma base de conversão.
[1] Converter para Binários
[2] Converter para octal
[3] Converter para hexadecimal
"""
select = int(input("""
Escolha uma base numéria para conversão
1 - Para binários
2 - Para oct... | false |
dce5e0e8c42cb355700d961c51b1a4f7f508ed3b | vidyakinjarapu/Automate_the_boring_stuff | /ch_6/bulletPointAdder.py | 603 | 4.1875 | 4 | '''
get the text from the clipboard, add a star and space to the beginning of each
line, and then paste this new text to the clipboard.
1.Paste text from the clipboard.
2.Do something to it.
3.Copy the new text to the clipboard. '''
#!python
import pyperclip
text = pyperclip.paste()
# print(text)
#Code to add star an... | true |
c0cb1ce6d8aabc41c28bc63f22e137c4a939c6ed | vidyakinjarapu/Automate_the_boring_stuff | /ch_2/rpsown.py | 1,879 | 4.21875 | 4 | """
ROCK, PAPER, SCISSORS
0 Wins, 0 Losses, 0 Ties
Enter your move: (r)ock (p)aper (s)cissors or (q)uit
p
PAPER versus...
PAPER
It is a tie!
0 Wins, 1 Losses, 1 Ties
Enter your move: (r)ock (p)aper (s)cissors or (q)uit
s
SCISSORS versus...
PAPER
You win!
1 Wins, 1 Losses, 1 Ties
Enter your move: (r)ock (p)aper (s)cisso... | false |
2845bdc789527ab56b480d192a93288088d5484f | myGitRao/Python | /Operators.py | 640 | 4.15625 | 4 | # Arithmetic
print("Arithmetic operators")
print("5 + 6 = ", 5 + 6)
print("5 - 6 = ", 5 - 6)
print("5 * 6 = ", 5 * 6)
print("5 / 6 = ", 5 / 6)
print("5 ** 6 = ", 5 ** 6)
print("5 // 6 = ", 5 // 6)
print("5 % 6 = ", 5 % 6)
# Assignment
print("Assignment operators")
x = 5
print(x)
x -= 7
print(x)
# Comparison
print("Co... | false |
f6f37a78f00dd4ae18d8a3b203f6420365d9baac | Sai-Bharadwaj/JenkinsWorking | /input.py | 403 | 4.15625 | 4 | x=int(input("Enter First Number:"))
y=int(input("Enter Second Number:"))
#z=int(input("Enter Third Number:"))
#if(x>y):
# print("First number is greater,",x)
#else:
# print("Second Number is greater,",12)
#l= x if x>y and x>z else y if y>z else z
#print("Max values is:",l)
l = "Both Numbers are equaly" if x==... | true |
b2ae37fbc3424ab6abf424c972dfcf0f71c029ef | Dominic-Perez/CSE | /LuckySevens/More Python Notes.py | 1,620 | 4.46875 | 4 | #shopping_list(0) = "2% milk"
#print(shopping_list)
#print(shopping_list[0])
# Looping through lists
#for item in shopping_list:
# print(item)
'''
1. Make a list
2. change the 3rd thing on the list
3. print the item
4.print the full list
'''
#List = ["straw", "nut", "glass", "lime", "table", "chair", "Tonatiuh", ... | true |
0d533fc1830ec11bab5fef1a327a42f1c5a7574b | morningred88/data-structure-algorithms-in-python | /Array/string-slicing.py | 957 | 4.25 | 4 | def sliceString(s):
# Specify the start index and the end index, separated by a colon, to return a part of the string. The end index is not included
# llo, get the characters from position 2 to position 5 (not included)
s = s[2:5]
# Slice from the start
# hello world, whole string
s = s[:]
# h... | true |
70478953dc18bd961f381cea434778136ad37f03 | morningred88/data-structure-algorithms-in-python | /Stack-Queue/stack.py | 1,301 | 4.125 | 4 | # LIFO:last item we insert is the first item we take out
class Stack():
# Use one dimensional array as underlying data structure
def __init__(self):
self.stack = []
# Insert item into the stack //O(1)
def push(self, data):
self.stack.append(data)
# remove and return the last item we have ins... | true |
a2c12bafe8d659445718e4ad683d41205e2b07e7 | rahulmajjage/Learning | /exercisescripts/list_methods.py | 1,353 | 4.375 | 4 | #High Scores program
#Demonstrate List methods
#Create an empty list
scores = []
choice = None
#Print the options
while choice !="0":
print (\
"""
\t High Scores Keeper
0: Exit
1: Show score
2: Add a score
3: Delete a score
4: Sort scores
""")
choice= input ("Choice: ")
# Exit
... | true |
a1d8aa288a9d40f7068da878e79bc3a8e476df31 | rahulmajjage/Learning | /exercisescripts/for loop demo.py | 216 | 4.5 | 4 | #loopy string
#Demonstrates the for loop with a string.
word= input ("Enter the word: ")
print ("\n Here is each letter in your word:")
for letter in word:
print (letter)
input ("Press enter to exit")
| true |
f05c61c8cdb3877fbf8da2554e16860d1b6eb848 | rahulmajjage/Learning | /exercisescripts/exercise5_3.py | 2,403 | 4.4375 | 4 | #Exercise 5.3
#Daddy_Son_Program
# Daddy_Son Dictionary
daddy_son = { "Rahul" : "Shivalingappa",
"Nikita" : "Ramesh",
"Rohit" : "Rachappa" }
#To display the name of Father with Son's name
son = input ("\n\nEnter the name of son to get the father name: ")
if son in daddy_... | false |
5f716a6bb3b96a3b862808a15b0a70db2573a9bf | amit0-git/simple-python-program | /English-alphabets.py | 1,048 | 4.1875 | 4 | '''Python program to print English alphabets'''
def A():
for row in range(6):
for col in range(11):
if (row+col==5) or (col-row==5) or (row==3 and row+col in[7,9]):
print('*',end='')
else:
print(end=' ')
print()
#########################
def M():
for row in range(6):
for col in range(11):
... | false |
c28f5affcc831d411bdb327406790022a8aca2c6 | rupeshjaiswar/ekLakshya-Assignments | /Python Codes/Day 2 Assignments/6_code.py | 656 | 4.15625 | 4 | import math as m
# area of triangle with base and height given
b = int(input("Enter the base of the triangle:"))
h = int(input("Enter the height of thr triangle: "))
a = 0.5 * b * h
print(f"Area of triangle with base {b} and height {h} is {a} square meters")
# area of triangle with three sides given
x = in... | false |
0d35bfe204dd9c003ced7b934546c60829c43e2e | rupeshjaiswar/ekLakshya-Assignments | /Python Codes/Day 2 Assignments/23_code.py | 345 | 4.3125 | 4 | str = input("Enter a string:")
print("The String is:", str)
str1 = str[0:3]
print("The first three characters in the string str:", str1)
for i in str1:
print(f"The ASCII value of the character {i} in str1 is:", ord(i))
print("The position of str1 in str is:", str.find(str1))
print("Count of str1 in s... | true |
b4ef894611376eae065beacbaf46be978a7500a9 | mary-lev/algo | /bubble_sort.py | 706 | 4.21875 | 4 | def bubble(numbers):
"""
Реализация алгоритма сортировки пузырьком.
"""
length = len(numbers)
for x in range(length - 1):
check = False
for y in range(length - 1 - x):
if numbers[y] > numbers[y + 1]:
check = True
numbers[y], numbers[y + 1] ... | false |
3aa080aba1880282d9dc15b06b648c870ce78ede | presian/HackBulgaria | /Programming0-1/Week_6/2-String-Functions/strings.py | 1,026 | 4.1875 | 4 | def str_reverse(string):
return string[::-1]
# print(str_reverse("Python"))
# print(str_reverse("kapak"))
# print(str_reverse(""))
def join(delimiter, items):
return delimiter.join(items)
# print(join(" ", ["Radoslav", "Yordanov", "Georgiev"]))
# print(join("\n", ["line1", "line2"]))
def startswith(search... | false |
7e6ee9617f1a07ea20de8eb3c7c3e3dfcf08bdc4 | presian/HackBulgaria | /Algo1/Week_4/Monday/my_queue.py | 1,533 | 4.15625 | 4 | from vector import Vector
class Queue:
def __init__(self):
self.__queue = Vector()
# Adds value to the end of the Queue.
# Complexity: O(1)
def push(self, value):
self.__queue.add(value)
# Returns value from the front of the Queue and removes it.
# Complexity: O(1)
def p... | true |
2939d0c2b6cbf0f63e1f9a9c3ade0f9a699f661b | willzh0u/Python | /ex34.py | 2,085 | 4.625 | 5 | # Accessing Elements of Lists
# REMEMBER: Python start its lists at 0 rather than 1.
# ordinal numbers, because they indicate an ordering of things. Ordial numbers tell the order of things in a set, first, second, third.
# cardinal numbre means you can pick at random, so there needs to be a 0 element. Cardial numbers... | true |
aaa1b169899f0e91693b98f042442080f13d0c13 | YanteLB/pracs | /week1/python/weeek.py | 440 | 4.34375 | 4 |
#getting current day
currentDay = input("Enter the number of our current day: ")
currentDay = int(currentDay)
#getting the length of the holiday
holidayLength = input("How long is your holiday: ")
holidayLength = int(holidayLength)
returnDay = currentDay + holidayLength
if returnDay < 7:
print("You will return ... | true |
cae2f7f0945939ecdf220fd7cb06a402e7638348 | moakes010/ThinkPython | /Chapter17/Chapter17_Exercise3.py | 321 | 4.25 | 4 | '''
Exercise 3
Write a str method for the Point class. Create a Point object and print it.
'''
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "Point (x,y) at (%.2d,%.2d)" % (self.x, self.y)
p = Point(10, 11)
print(p... | true |
3114191f140ad280a6a71b3855580606f036cc93 | moakes010/ThinkPython | /Chapter11/Chapter11_Exercise10.py | 1,084 | 4.21875 | 4 | '''
Exercise 10
Two words are “rotate pairs” if you can rotate one of them and get the other (see rotate_word in Exercise 12).
'''
import os
def rotate_pairs(word, word_dict):
for i in range(1, 14):
r = rotate_word(word, i)
if r in word_dict:
print(word, i, r)
def rotate_letter(lett... | true |
58b91fc4ac376d1f0b197c704cad38ba602b4200 | bmatis/atbswp | /chapter12/multiplicationTable.py | 1,259 | 4.28125 | 4 | #!/usr/bin/env python3
# multiplicationTable.py - takes a number (N) from command line and creates
# an N x N mulitplication table in an Excel spreadsheet
# example: multiplicationTable.py 6 to create a 6 x 6 multiplication table
import sys, openpyxl
from openpyxl.styles import Font
from openpyxl.utils import get_colu... | true |
7183239071eca81ac679704880918eb4d22b86da | SimantaKarki/Python | /class4.py | 983 | 4.125 | 4 | #Basic2
is_old = True
is_licenced = True
#if is_old:
# print("You are old enough to drive!")
# elif is_licenced:
# print("You can Drive on Highway")
# else:
# print("Your age is not eligible to drive!")
# print("end if")
if (is_licenced and is_old):
print("You are in age and you can drive")
... | true |
4ed2886bafb58f67dcb6fa4b0e0160357b4ecd19 | alvas-education-foundation/ISE_3rd_Year_Coding_challenge | /4AL17IS012_Danush_Kumar/SharanSir_codingchallenge/SharanSir_codingchallenge2/prg1.py | 686 | 4.5625 | 5 | ''' We are given 3 strings: str1, str2, and str3. Str3 is said to be a shuffle of str1 and str2
if it can be formed by interleaving the characters of str1 and str2 in a way that maintains
the left to right ordering of the characters from each string.
For example, given str1="abc" and str2="def", str3="dabecf" is a v... | true |
4c18f4a6bfefdb2c2de251e5a11cc4c215abb468 | alvas-education-foundation/ISE_3rd_Year_Coding_challenge | /4AL17IS001_Ahimsa_Jain/SK-Challenge-1/s2.py | 1,182 | 4.15625 | 4 | 2) Given an array,A, of N integers and an array, W, representing the respective weights of A's elements, calculate and print the weighted mean of A's elements. Your answer should be rounded to a scale of decimal place
Input format:
1. The first line contains an integer, N, denoting the number of elements in arrays ... | true |
c2920b0657f7a2d5bec5230c29e894dff78571f5 | alvas-education-foundation/ISE_3rd_Year_Coding_challenge | /4AL17IS006_VISHAK_AMIN/22May20/fourth.py | 1,126 | 4.15625 | 4 | # Given the names and grades for each student in a Physics class of students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade.
# Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line.
# Input For... | true |
54672ba72d2d620401fe22b3eea9873b352c6b86 | suvo-oko/intermediate-python-course | /dice_roller.py | 956 | 4.25 | 4 | import random
def main():
dice_rolls = int(input('How many dice would you like to roll? '))
dice_size = int(input('How many sides are the dice? '))
dice_sum = 0
for i in range(0, dice_rolls): # for every Index in this range, do this:
roll = random.randint(1,dice_size) # the random... | true |
368cf1d3c85fe5a6cdad6b15036627fb17f3bd6e | Faiax/Python_Basics | /dictionaries.py | 954 | 4.125 | 4 | fruit = {"orange":"a sweet orange citrus fruit",
"apple":"good for making cider",
"lemon":"a sour yellow citrus fruit",
"grape":"a small sweet fruit growing in brunches",
"lime":"a sour green citrus fruit",
"banana":"long yellow tasty things"}
print(fruit)
#ordered_keys = li... | true |
27b480f773db0209aca8871b367e96c1c2a8fefe | S-web7272/tanu_sri_pro | /strings/creating_string.py | 844 | 4.15625 | 4 | # for creating a single line string value
name = "Abraham "
bookname = "An Ancient Journey"
# for creating multi line string value
author_info = '''Most of us wonder if there is a God
and if He really is the God of the Bible.
In the Bible God says ‘I will make your name great’
and today the name of Abraham/Abr... | true |
a392c805c1a02400e0d31a6b34a2d4065ba12785 | DX9807/General-Practice-Code | /datetime1.py | 809 | 4.125 | 4 | from datetime import datetime
now = datetime.now()
mm = str(now.month)
dd = str(now.day)
yyyy = str(now.year)
hour = str(now.hour)
mi = str(now.minute)
ss = str(now.second)
print (mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss)
now = datetime.now()
print()
print("Current date and time using s... | false |
c6e39018e2f32eda3bc2df390274b9473b4e9891 | daviddumas/mcs275spring2021 | /samplecode/debugging/puzzle2/biggest_number.py | 2,117 | 4.125 | 4 | """Debugging puzzle: Script to find largest integer in a
text file (allowing Python int literal syntax for hexadecimal,
binary, etc.)"""
# MCS 275 Spring 2021 Lecture 11
# This script is written in a way that avoids some constructions
# that would make the code more concise (e.g. list comprehensions).
# This gives mor... | true |
8b14536bc036c4716ac3a321b47bc018f83cdb1f | daviddumas/mcs275spring2021 | /projects/lookup.py | 2,787 | 4.125 | 4 | # MCS 275 Spring 2021 Project 3 Solution
# David Dumas
# Project description:
# https://www.dumas.io/teaching/2021/spring/mcs275/nbview/projects/project3.html
"""
Reads a list of chromaticities and names from the CSV file
(name given as first command line argument) and provides a
lookup service using keyboard input. ... | true |
a30fa837584e9b52c04c8d75a2489790900f331d | wfgiles/P3FE | /Week 7/Exercise 5..10.1.py | 1,425 | 4.21875 | 4 | ##number = raw_input('Enter number: ')
##num = int(number)
##print num
##
##Write a program which repeatedly reads numbers until the
##user enters "done". Once done is entered, print out the
##total, count and average of the numbers. If the user enters
##anything other than a number, detect the mistake usinf a try
##an... | true |
aeb8a93ddc74b60d01ab138b526cdc1c7d899faa | wfgiles/P3FE | /Week 8 Ch6/Week 6 slide examples.py | 2,101 | 4.21875 | 4 | ##INDEFINITE - WHILE STATEMENT
##
##fruit = 'banana'
##index = 0
##while index < len(fruit):
## letter = fruit[index]
## print index, letter
## index = index + 1
##
##----------------------------
##DEFINITE - FOR STATEMENT
##
##fruit = 'banana'
##for letter in fruit:
## print letter
##
##-------------------... | false |
02dcca5997e80c2d3f6b49f96a3a95b836e5d01e | kermitt/challenges | /py/bouncing_ball.py | 1,820 | 4.34375 | 4 | """
https://www.codewars.com/kata/5544c7a5cb454edb3c000047/train/python
A child is playing with a ball on the nth floor of a tall building. The height of this floor, h, is known.
He drops the ball out of the window. The ball bounces (for example), to two-thirds of its height (a bounce of 0.66).
His mother looks out ... | true |
ab96c922d0b0fc454e81188cdd9195956402e578 | truongductri01/Hackerrank_problems_solutions | /Problem_Solving/Data_Structure/Linked_list/Reverse_linked_list.py | 1,519 | 4.21875 | 4 | # Link: https://www.hackerrank.com/challenges/reverse-a-linked-list/problem
class SinglyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
class SinglyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def insert_node(self,... | true |
ca4f516b17d4ba871e9cb61e65e8d392621c5a42 | truongductri01/Hackerrank_problems_solutions | /Problem_Solving/Medium/Almost_Sorted/Almost_Sorted.py | 2,418 | 4.3125 | 4 | # link: https://www.hackerrank.com/challenges/almost-sorted/problem
explanation = ''' Output Format
If the array is already sorted, output yes on the first line. You do not need to output anything else.
If you can sort this array using one single operation (from the two permitted operations)
... | true |
5ac6c88180aef91c17cdcd01f13ce4f58d59575b | Code-Institute-Submissions/battleships-7 | /rock-paper-scissors.py | 1,080 | 4.21875 | 4 | from random import randint
# Options for player to chose
Choices = ["ROCK", "PAPER", "SCISSORS"]
# Computer chosing random move between Rock, Paper or Scissors
while True:
Computer = Choices[randint(0, 2)]
Player = input("Pick Rock, Paper, Or Scissors Or Press X To Quit: \n ").upper()
if Player == "X":
... | false |
b2c4a4dc511a2263f1a9a0df93b5c20893297b78 | KiemNguyen/data-structures-and-algorithms | /coding_challenges/lists/find_second_largest.py | 342 | 4.125 | 4 | # Returns second maximum value from given list
def find_second_largest(arr):
largest = 0
second_largest = 0
for i in range(len(arr)):
if arr[i] > largest:
second_largest = largest
largest = arr[i]
elif arr[i] > second_largest:
second_largest = arr[i]
... | false |
aa3893ed9501800385b644fc8ba7945f54962830 | KiemNguyen/data-structures-and-algorithms | /coding_challenges/linked_lists/delete.py | 1,999 | 4.3125 | 4 | class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = Node(-1)
# Function to insert a new node at the beginning
def insert_at_head(self, new_data):
# 2. Create a new n... | true |
bb75c61df2d363b27703b8c02c6ebbfcf5eba4c1 | aartiaw/Solved_Puzzles | /mul_subarray.py | 903 | 4.15625 | 4 | """Max product subarray same as the Max sum subarray."""
def get_max_product(arr):
"""Function to get maximum product from subarray."""
if arr:
ans = arr[0]
cur_max_product = arr[0]
prev_max_product = arr[0]
prev_min_product = arr[0]
for i in range(1, len(arr)):
... | false |
239a5babfec5b5fecb3e9a11f6a168d75fa779b6 | LadislavVasina1/PythonStudy | /ProgramFlow/trueFalse.py | 285 | 4.25 | 4 | day = "Monday"
temperature = 30
raining = True
if (day == "Saturday" and temperature > 27) or not raining:
print("Go swimming.")
else:
print("Learn Python")
name = input("Enter your name: ")
if name:
print(f"Hi, {name}")
else:
print("Are you the man with no name?")
| true |
2b53bc3f72d5ea1528666abe1d9a5e174b17d7c2 | federicociner/leetcode | /graphs/valid_tree.py | 1,690 | 4.15625 | 4 | """Given n nodes labeled from 0 to n-1 and a list of undirected edges (each
edge is a pair of nodes), write a function to check whether these edges make
up a valid tree.
Example 1:
Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]]
Output: true
Example 2:
Input: n = 5, and edges = [[0,1], [1,2], [2,... | true |
cbcfea6a3d9052c030b2dd071269a3506bf1dd54 | federicociner/leetcode | /arrays/find_duplicate_number.py | 1,336 | 4.21875 | 4 | """Given an nums nums containing n + 1 integers where each integer is between
1 and n (inclusive), prove that at least one duplicate number must exist.
Assume that there is only one duplicate number, find the duplicate one.
Example 1:
Input: [1,3,4,2,2]
Output: 2
Example 2:
Input: [3,1,3,4,2]
Outpu... | true |
4f6eb16985300e4634b3788f5493185c2654b606 | federicociner/leetcode | /design_problems/design_max_stack.py | 1,944 | 4.25 | 4 | """Design a max stack that supports push, pop, top, peekMax and popMax.
push(x) -- Push element x onto stack.
pop() -- Remove the element on top of the stack and return it.
top() -- Get the element on the top.
peekMax() -- Retrieve the maximum element in the stack.
popMax() -- Retrieve the maximum element in the stack... | true |
1e287847a48951f62d8fa99795bb792453396603 | federicociner/leetcode | /dynamic_programming/palindromic_substrings.py | 1,247 | 4.21875 | 4 | """Given a string, your task is to count how many palindromic substrings in
this string.
The substrings with different start indexes or end indexes are counted as
different substrings even they consist of same characters.
Example 1:
Input: "abc"
Output: 3
Explanation: Three palindromic strings: "a", "b",... | true |
d57d848792e49d6eb6c6667dc1ad1143ad402ceb | gvnn/csv_perimeter_calculator | /perimeter.py | 2,382 | 4.34375 | 4 | #!/usr/bin/env python
import csv
import glob
import os
import sys
def calculate_length(file_name):
"""
read a list of points from a CSV file and print out the length of the perimeter of the shape that is formed by
joining the points in their listed order
"""
fp = open(file_name)
reader = csv.r... | true |
80f2643b925dded0e7a6723828ddf03887f4fad6 | devilroop/loops-programs | /loops task1.py | 1,714 | 4.21875 | 4 | '''#program1
#check whether a no is prime or not
n=33
for i in range(2,n):
if n%i==0:
print(n,"is not primre number")
break
else:
print(n,"is primre number")
#program2
#check list of prime numbers within a range
a=int(input("starting number:"))
b=int(input("ending number:"))
for num... | false |
a1e9fb6536c4221f5f58fa3b800550806f0163d9 | MohammadQu/Summer2348 | /Homework1/ZyLab2.19.py | 1,447 | 4.125 | 4 | # Mohammad Qureshi
# PSID 1789301
# LAB 2.19
# PART 1
# INPUT NUMBER OF LEMON, WATER, AND NECTAR CUPS AND SERVINGS
print('Enter amount of lemon juice (in cups):')
lemon = int(input())
print('Enter amount of water (in cups):')
water = int(input())
print('Enter amount of agave nectar (in cups):')
nectar = flo... | true |
d977177bd14dbc7910f183544d23f1e1f4752ee4 | Kallikrates/adv_dsi_lab_2 | /src/features/dates.py | 477 | 4.34375 | 4 | def convert_to_date(df, cols:list):
"""Convert specified columns from a Pandas dataframe into datetime
Parameters
----------
df : pd.DataFrame
Input dataframe
cols : list
List of columns to be converted
Returns
-------
pd.DataFrame
Pandas dataframe with converte... | true |
4745c3664cdb74b4a67f3afb2ee126cbae225994 | m-samik/pythontutorial | /itterativeapproach.py | 255 | 4.15625 | 4 | # Itterative Approach for a Function
def factorial_itr(n):
fac=1
for i in range(n):
fac=fac*(i+1)
return fac
number=int(input("Enter the Nunber\n"))
print("factorial of the number using itterative method is :\n",factorial_itr(number))
| true |
9dbb209e95bdadd3f722101dc2915b5242f6e37c | m-samik/pythontutorial | /dictionary.py | 258 | 4.21875 | 4 | #creating a dictionary with words and meanings
d1 ={"Mutable":"Which Changes","Immutable" : "Which doesn't Change","Luminous":"Object with Light","Sonorous" : "Sound Producing Utencils"}
print("Enter the word to which you want meaning")
print(d1[input()]) | true |
4ba42df9e051ece562b5d6f9d4b537ad8da1bb28 | vineetpathak/Python-Project2 | /reverse_alternate_k_nodes.py | 965 | 4.21875 | 4 | # -*- coding: UTF-8 -*-
# Program to reverse alternate k nodes in a linked list
import initialize
def reverse_alternate_k_nodes(head, k):
count = 0
prev = None
curr = head
# reverse first k nodes in link list
while count < k and curr:
next = curr.nextnode
curr.nextnode = prev
prev = curr
... | true |
3f86e2b16b0ef7f9fec2f6bac05bf8031dea71fc | vineetpathak/Python-Project2 | /convert_to_sumtree.py | 679 | 4.21875 | 4 | # -*- coding: UTF-8 -*-
# Program to convert tree to sumTree
import binary_tree
def convert_to_SumTree(root):
'''Convert a tree to its sum tree'''
if root is None:
return 0
old_value = root.data
root.data = convert_to_SumTree(root.left) + convert_to_SumTree(root.right)
return root.data + old_val... | true |
5438bd96360a3d93a74c37c8f1465864324ebb2a | Lckythr33/CodingDojo | /src/python_stack/python/fundamentals/insertion_sort.py | 571 | 4.15625 | 4 | # Python Insertion Sort
# Function to do insertion sort
def insertionSort(myList):
# Traverse through 1 to len(myList)
for i in range(1, len(myList)):
curr = myList[i]
# Move elements of myList[0..i-1], that are
# greater than curr, to one position ahead
# of ... | true |
71ee0519bec09a2ebc810be3b97b46ef4c1c7263 | profnssorg/tcclucastanussantos | /exercicio 7-3.py | 439 | 4.125 | 4 | primeira = input("Digite a primeira string: ")
segunda = input("Digite a segunda string: ")
terceira = ""
for letra in primeira:
if letra not in segunda and letra not in terceira:
terceira+=letra
for letra in segunda:
if letra not in primeira and letra not in terceira:
terceira+=letra
if te... | false |
f53745c1d0b91273b69fa4c70ad77a53a8837fbf | dannielshalev/py-quiz | /quiz3.py | 1,129 | 4.46875 | 4 | # An anagram is a word obtained by rearranging the letters of another word. For example,
# "rats", "tars", and "star" are anagrams of one another, as are "dictionary" and
# "indicatory". We will call any list of single-word anagrams an anagram group. For
# instance, ["rats", "tars", "star"] is an anagram group, as is [... | true |
c809124aaadfe3ca974ab4a6ce3bd0944fe9182c | Alcatrazee/robot_kinematic | /python code/ABB_Robot.py | 855 | 4.15625 | 4 | # -*- coding: utf-8 -*-
from forward_kinematic import *
from inverse_kinematic import *
import numpy as np
#Before running,you need to make sure you have installed numpy,scipy,matplotlib.
#All you need to do is to alternate the angle of each joint on below
#Set the theta vector to determine the angle of each joint
th... | true |
2a18b4e470a4f6352cac822144f2a180bd372174 | SACHSTech/ics2o-livehack1-practice-GavinGe3 | /minutes_days.py | 829 | 4.3125 | 4 | """
-------------------------------------------------------------------------------
Name: minutes_days.py
Purpose: Converts given minutes into days, hours and minutes
Author: Ge.G
Created: 08/02.2021
------------------------------------------------------------------------------
"""
print("******Minutes to days,... | true |
67393c0a1b38f784e6e035a01363a630622d2ac1 | c4collins/PyTHWay | /ex16.py | 996 | 4.4375 | 4 | from sys import argv
script, filename = argv
print "Opening %r for reading..." % filename
target = open(filename, 'r') # opens the file with the read attribute
print "It currently says:"
print target.read()
print "Closing the file."
target.close() # close the file after reading
print "We're going to erase %r." % f... | true |
afe44c80b943e1b5f8704ff79f464173897161c3 | akm12k16/Python3-SortingAlgorithm | /insertion_algo1.py | 1,215 | 4.1875 | 4 | # sorting algorithm
# insertion sorting
def insertion_sort(a):
for i in range(1, len(a)):
print("In the i {%s} A : {%s}" % (i, a))
key = a[i]
j = i - 1
print('Before entering in the while j : {%s} , i : {%s} , key : {%s}' % (j, i, key))
while j >= 0 and a[j] > key:
... | false |
5a0ee3949c55e7899a9fcd1a00bd70af162f108c | PanBohdan/ITEA_Python_Basics | /lesson4/recursive_bubble_sort.py | 616 | 4.40625 | 4 | # Напишите функцию, которая сортирует массив рекурсивно.
def recursive_bubble_sort(numbers):
for i in range(len(numbers) - 1):
if numbers[i] > numbers[i + 1]: # if next number is larger than swap
temp = numbers[i]
numbers[i] = numbers[i + 1]
numbers[i + 1] = temp
... | false |
063163e2aaa8391cebf5243113bc728354c3e559 | PanBohdan/ITEA_Python_Basics | /lesson2/homework_6(triangle).py | 282 | 4.1875 | 4 | # print triangle with the height of h
def build_triangle(h):
for i in range(h):
rows = [(h - i) * ' ' + i * 2 * '^' + '^']
for i1 in rows:
print(i1)
if __name__ == '__main__':
h1 = int(input('Input height of triangle '))
build_triangle(h1)
| false |
93f075fa8c8f9e7017e74be4e4ce2bceb329b13b | leoswaldo/pythonchallenge | /0.py | 411 | 4.3125 | 4 | #!/python/python3.4/bin/python3
## Function: pow, return a number to a power
# Parameters: base, power
# base: base number to pow
# power: number of pow
def pow(base, power):
result = 1
while(power > 0):
power-=1
result = result * base
return result
if __name__ == '__main__':
... | true |
84102b0b9be5ceaafb61a4ba7fa04bdbbb4f455b | hbrown017/Projies | /Python/Turtle Graphics/bubbleSortAnimation.py | 2,928 | 4.25 | 4 | '''
Name: Harry Brown III
Program: Bubble Sort using Turtle
Date: 6/20/16
'''
import turtle
def drawHistogram(t, list):
t.speed(10) #0(fastest), 10(fast), 6(normal), 3 (slow)
t.hideturtle()
height = 100 #histogram height
width = 400 #histogram width
#draw bottom line for histogram
t.up()
... | false |
8ede9e26eb72585afb7424bf72cd9e28f5562e68 | haokai-li/ICS3U-Unit3-08-Python-Leap-Year | /leap_year.py | 911 | 4.21875 | 4 | #!/usr/bin/env python3
# Created by: Haokai Li
# Created on: Sept 2021
# This Program calculate leap year
def main():
# This function calculate leap year
# input
user_string = input("Please enter the year: ")
print("")
# process
try:
user_year = int(user_string)
if user_year... | true |
16806de0e4ca649c6ed4dd2480ff7a1ea0aefc0b | thiagorangeldasilva/Exercicios-de-Python | /pythonBrasil/03.Estrutura de Repetição/30. panificadora 0.18.py | 791 | 4.15625 | 4 | #coding: utf-8
"""
O Sr. Manoel Joaquim acaba de adquirir uma panificadora e pretende
implantar a metodologia da tabelinha, que já é um sucesso na sua
loja de 1,99. Você foi contratado para desenvolver o programa que
monta a tabela de preços de pães, de 1 até 50 pães, a partir do
preço do pão informado pelo usuário... | false |
1d8ed81948c23dc4a2d610864a0f9989e96ac814 | thiagorangeldasilva/Exercicios-de-Python | /pythonBrasil/04. Listas/17. competição de salto.py | 2,327 | 4.1875 | 4 | #coding: utf-8
"""
Em uma competição de salto em distância cada atleta tem direito
a cinco saltos. O resultado do atleta será determinado pela média
dos cinco valores restantes. Você deve fazer um programa que receba
o nome e as cinco distâncias alcançadas pelo atleta em seus saltos
e depois informe o nome, os salt... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.