blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
d5f75bf3d992a0dbf4d463ca69d9d51bef501a62 | drdavella/algorithms | /python/inversions/inversions.py | 1,070 | 3.8125 | 4 | #!/usr/bin/env python3
def merge_and_count_split_inversions(left, right):
i = 0
j = 0
inversions = 0
array = []
while True:
# No inversion
if left[i] < right[j]:
array.append(left[i])
i += 1
elif right[j] < left[i]:
array.append(right[... |
c7e53a80b27725b3c6051c48611e0630ad7f7b9d | gayathrikolluru05/Amazon-Online-Assessment-Python-Solutions | /Questions/FindPairWithGivenSum.py | 1,318 | 3.84375 | 4 | '''
Find Pair With Given Sum
'''
'''
Given a list of positive integers nums and an int target, return indices of the two numbers such that they add up to a target - 30.
Conditions:
You will pick exactly 2 numbers.
You cannot pick the same element twice.
If you have muliple pairs, select the pair with the largest number... |
4a5c54b7d21ffcf4cc4979a41b85887f65a55052 | gayathrikolluru05/Amazon-Online-Assessment-Python-Solutions | /Questions/Search2DMatrixII.py | 1,537 | 3.9375 | 4 | '''
Search a 2D Matrix II
'''
'''
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted in ascending from left to right.
Integers in each column are sorted in ascending from top to bottom.
'''
def searchMatrix(matrix, target... |
f35b20283a4ff48dcc659f79e4b1174f729c8b6a | gayathrikolluru05/Amazon-Online-Assessment-Python-Solutions | /Questions/TopKFrequentlyMentionedKeywords.py | 1,875 | 4.125 | 4 | """Given a list of reviews, a list of keywords and an integer k. Find the most popular k keywords in order of
most to least frequently mentioned.
The comparison of strings is case-insensitive. If keywords are mentioned an equal number of times in reviews,
sort alphabetically."""
# ----------------ex 1
k1 = 2
keyword... |
cb7ce0ed589d94ecf88e31a14ae6d374b1552a70 | Nizhurin/vowels | /vowels6.py | 386 | 4.28125 | 4 | vowels = ['a', 'e', 'i', 'o', 'u']
found = {}
word = input("Provide a text to search for vowels: ")
for letter in word:
if letter.lower() in vowels:
found.setdefault(letter.lower(), 0)
found[letter.lower()] += 1
print("Vowels - Count vowels in input text ")
for key,value in sorted(found.items()):
... |
ea440ec17c2c1b6921576995d9ea7c95ef656a8a | msshakeel12/Automatic-Hand-Dispenser | /main.py | 4,392 | 3.578125 | 4 | #libraries for time delay and random functions
import time
import random
'''
function setup for the checking of the
various componets used in the hardware
and returns error accordingly, if no errors
returns the intial light intensity of the room
'''
def setup():
lcd_rgb(252,0,0)
lcd_print("Hello")
t... |
ab30014305062289415160e0e7f6b651a1c4fe6d | borisbho/PythonPractice | /Demo/conditionals.py | 830 | 4.1875 | 4 | monsters1 = ['vampire', 'zombie', 'ghost']
monsters2 = ['vampire', 'zombie', 'ghost']
monsters3 = ['vampire', 'zombie', 'werewolf']
if monsters1 == monsters2:
print('Yay, monsters1 and monsters2 are equal!')
print(monsters1 == monsters3)
bool1 = True
bool2 = False
print(bool1)
print(not bool1)
print... |
dc246d51433d78d32a385056131336bcfeb307d2 | borisbho/PythonPractice | /Demo/variables.py | 1,420 | 3.828125 | 4 | a = 3
b = 4
print(a + b)
x = a
a = 5
print( a, x )
c = 3.14
d = a + c
e = d - a
print(c, d, e)
a = True
print(a)
my_string = 'ABCDEFGHIJKLM'
print(my_string)
print(len(my_string))
print(my_string[3])
print(my_string[5:10])
print(my_string[2:])
print(my_string[:3])
print(my_string[:-3])
p... |
488dea9f5bfc3076503fbfe68c742a668e4de1d0 | ChristianGracia/Algorithms | /python-algorithms/fraction-series-summer.py | 195 | 4.0625 | 4 | sum = 0
for x in range(0, 48, 1):
numerator = (1+(2 * x))
denominator = (3 + (2 * x))
print(str(numerator) + " / " + str(denominator))
sum += (numerator / denominator)
print(sum)
|
e18e7c6e80e551f857e0e6d26b89ac0d47f87d7b | DawidSobierajskiprograming/bunch-off-Practice-projects | /Text-based-adventure-game/Text_based_adventure_game.py | 2,743 | 4 | 4 | import random
Player_location = 1
def Outside_home(Player_name):
print("Outside your home you see your friend Bill and a way to head to the harbour")
playerchoice = input ("What would you like to do? \n")
if playerchoice == "Bill":
f = open(r"Text-based-adventure-game\Friends_lines.txt","r")
... |
52c4a632a17aa61208b79d079b78b654b572fa3d | OsasEnebi/Python-and-HTML-projects | /Osas_Enebi- wage calculator.py | 1,616 | 4.15625 | 4 | # Osas Enebi
# Student no: R00167276
# Class: CO.COMP1D-Y
# Group - Y
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
# Empty lists to store wages and user info
wages = []
user_info = []
# Prints out the heading
def print_heading():
print("-" * 15)
print("Processing wages")
p... |
89080ac74bba62a055f784fdd924813a10d19c86 | OsasEnebi/Python-and-HTML-projects | /Labs/week02/lab02_functions.py | 333 | 4.03125 | 4 | #Various functions to print out the shape of a box
def straight_line():
print("+", "-" * 10, "+", sep="")
def gappy_line():
print("-", 10 * " ", "-", sep="")
def draw_box():
straight_line()
for k in range(3):
gappy_line()
straight_line()
def draw_nose():
print("")
... |
f9171d9e450726b8ee49c9c2a1d94acd1ef30619 | jshams/cs-1.3 | /redact_problem.py | 656 | 4.125 | 4 | def redact_words(words, banned_words):
'''Takes in 2 array inputs words and banned_words
Output is a new array of words without the words found in banned words
Time complexity: O(n)
'''
banned_words_set = set(banned_words) # I create a set of banned_words because searching a set is constant time
... |
eb8d8d4cc0f2d75a2dee7dc9095efd525ca1d748 | Jajang1293/labpy03 | /latihan1.py | 166 | 3.59375 | 4 | x = int(input("masukkan nilai N: "))
import random
for y in range(1,6):
z=random.uniform(0.0,0.5)
print("data ke : {} => {}".format(y,z))
print(" Selesai! ")
|
b07b58bf7845cb831d6887df2da8264c0bafba18 | xmlu2020/python_learn | /4_1高阶函数_map_reduce.py | 2,808 | 3.96875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/7/14 16:15
# @Author : XiaomeiLu
# @FileName: 4_1高阶函数_map_reduce.py
# @Software: PyCharm
from functools import reduce
'''变量可以指向函数'''
def add (x,y,f):
return f(x) + f(y)
print(add(-5,6,abs))
'''
map()函数接收两个参数,一个是函数,一个是Iterable,map将传入的函数依次作用到序列... |
51b0d13b95925a0de195052fd67dfc37a1e44eba | xmlu2020/python_learn | /练习/12_获取两个列表的交并差集.py | 544 | 3.59375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/9/16 16:33
# @Author : XiaomeiLu
# @FileName: 12_获取两个列表的交并差集.py
# @Software: PyCharm
a = [1, 2, 3, 4]
b = [4, 3, 5, 6]
jj1 = [i for i in a if i in b]
print("交集", jj1)
jj2 = list(set(a).intersection(set(b)))
print("交集", jj2)
bj1 = list(set(a).union(set... |
d8974e86007268376ef9ae84227ae938bc41a95c | YasinLiu/Data-structure | /example/insertion_sort.py | 618 | 3.8125 | 4 | """
Insertion sort
"""
import numpy as np
def Insertion_sort(lyst):
i = 1 # 从第二个数开始往前插
while i < len(lyst):
item_to_insert = lyst[i]
j = i - 1
# 将第i个数插入到前i-1个已经排序好的数列中的正确位置
while j >= 0:
if item_to_insert < lyst[j]:
lyst[j+1] = lyst [j]
... |
b3afa9f69d0240ce1435458036d171900e6678b2 | methsirik/Python | /Rock Paper 3.py | 2,698 | 3.546875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 19:12:00 2021
@author: Methsiri_07324
"""
import random
def get_ratings(file_name, usr_name): # file name of the ratings
dic_1 = {}
file = open(file_name, 'r')
list_1 = file.read().splitlines(keepends=False)
file.close()
for line in list_1:
... |
03f98de5c99e41742b8841c8946d6e83ee2cd8fb | mmann964/exercises | /Exercise25.py | 1,102 | 3.90625 | 4 | #!/usr/bin/python
def get_ans(prompt, valid_responses):
while True:
ans = raw_input(prompt).lower().strip()
if len(ans) > 0 and ans[0] in valid_responses:
return ans[0]
if __name__ == "__main__":
guesses = 0
print("Think of a number between 1 and 100...")
low_guess = 1
... |
7244aa790e1ac5596e57f28f6d26c2d36c6cc007 | mmann964/exercises | /Exercise3.py | 216 | 3.859375 | 4 | #!/usr/bin/python
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = []
num = int(raw_input("Number please: "))
for element in a:
if element < num:
b.append(element)
for element in b:
print element
|
ac0e00847596267bf4960ac340996fbdf7a7951c | mmann964/exercises | /Exercise15.py | 571 | 4.15625 | 4 | #!/usr/bin/python
def reverse_str(s):
return ' '.join(s.split()[::-1])
def reverse_str1(s):
myStr = s.split()
retStr = ""
for w in myStr[::-1]:
retStr += w + ' '
return retStr.strip()
def reverse_str2(s):
myStr = s.split()
retStr = ""
for w in range(len(myStr) - 1, -1, -1):
... |
374ea34a26a4d6734c2a56c9e1edd6d2a8f4a5ac | SiChiTong/Agent-Aggressiveness-Sim | /src/driving_agent_simulation/src/vehicle_assignment.py | 4,871 | 3.59375 | 4 | #!/usr/bin/env python
# Author: Jinwei Zhang
# This node is going to randomly assign the agent vehicles and certain numbers of
# front vehicles into Gazebo environment, and then load their simulation program
# and controller.
# It firstly creates two grids (shown in matrix), for saving all possible vehicles
# posi... |
981e1fe745e6ce7819909ce3cee7417f77bc2896 | HarunUni/Labels | /Python Skripte/writeCoordinates.py | 545 | 3.671875 | 4 | """Writes the coordinates to a file."""
import csv
def write_coordinates(people, size_array, destination):
print("Writing into a csv file...")
zipped_people = zip(*people)
# Create the header
header = []
for number in range(size_array):
person = "Person " + str(number + 1)
... |
4230c7d9123bee2ea84c868b931cd2ddfaf1ad7f | JarryChung/Python-Learn | /python_5.py | 2,109 | 3.71875 | 4 | # -*- coding: utf-8 -*-
from collections import Iterable
from collections import Iterator
# 切片,list & tuple & 字符串
L = ['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack']
lis = list(range(100))
print(L[0:3])
print(lis[:10])
print(lis[-10:])
print(lis[:20:2]) # 前10个数,每两个取一个
print("JarryChung"[:5])
print("-----------... |
fd30f9ddefd46f0e65069aa5b9014b2aeb63ad18 | JeneralTso/Python | /smallListSort.py | 766 | 4.4375 | 4 | '''
Jenny Tso
Python Course: Drill (Item 48/68)
Write your own version of the sorted() method in Python.
This method should take a list as an argument and return
a list that is sorted in ascending order.
Print out each sorted list to the shell.
(Using an inserting sort, as they are apparently
the fastest o... |
864711818a1fdbe71e0e79d171b47c888d33d701 | mercurist/Coursera | /Competitive Programmer's Core Skills/Week 1/straightFlush.py | 1,714 | 3.546875 | 4 | # python3
def checkSuit(entry):
suit = None
for i in range(len(entry)):
if suit is None:
suit = entry[i][1]
continue
if entry[i][1] != suit:
return False
return True
def convertChar(char):
convs = {"T": 10, "J": 11, "Q": 12, "K": 13, "A": 14}
if ... |
9f8a80c92a6388c6773efb6f470f2ec51c4442bd | urbanemold/sentiment_analysis | /graph_drawing.py | 657 | 3.625 | 4 | import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
style.use('fivethirtyeight')
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
def animate(i):
graph_data = open('twitter_output.txt','r').read()
lines = graph_data.split('\n')
xarrray = []
... |
e442753af1f758359040574078e6f3c70e99e8a9 | Emrys-Hong/pypi_package | /pypi_package/info.py | 1,000 | 4 | 4 | import argparse
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--day", required = False,
help = "fill in the important days of your life")
ap.add_argument('-w','--who', required = False,
help = 'who loves who')
args = vars(ap.parse_args())
def info(sth):
if sth == '21-06-1997' or '0621':
print('ha... |
f4a4ed772b1fbce140eee1bc6d391472ca05de26 | mahsa-ashna/python-project | /project_phase2_mahsa ashna/login.py | 1,893 | 3.734375 | 4 | import pandas as pd
import hashlib
import csv
class User:
def __init__(self, username, password,varity):
self.username = username
self.password = password
self.kind = varity
@staticmethod
def register():
file_path = "account.csv"
df_account = pd.read_... |
e5b365dbf08a38cdce87c5b72c9932c0a2dfbc99 | vicvv/cdojo-PythonStack | /python/OOP/with_transfer_user.py | 1,175 | 3.75 | 4 |
# make_withdrawal(self, amount) - have this method decrease the user's balance by the amount specified
# display_user_balance(self) - have this method print the user's name and account balance to the terminal
# eg. "User: Guido van Rossum, Balance: $150
# BONUS: transfer_money(self, other_user, amount) - have this met... |
534b27eeab25bdee75f687eade5a290e556b229d | vicvv/cdojo-PythonStack | /python/OOP/math_Dojo.py | 650 | 3.703125 | 4 | class MathDojo:
def __init__(self):
self.result = 0
def add(self, num, *nums):
self.result += num
for item in nums:
self.result = self.result + item
print("Add result",self.result)
return self
def subtract(self, num, *nums):
self.result -= num
... |
116e2af3b1fd1fce57c9a4f2e4856031db6323ef | vicvv/cdojo-PythonStack | /python/data_structures/add_print.py | 523 | 3.6875 | 4 | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Slist:
#count = 1
def __init__(self):
self.head = None
def addfront(self, val):
nn = Node(val)
nn.next = self.head
self.head = nn
def printlist(self):
runner = ... |
a5abe2c3cd853749937333830dac07dbd7a5cb2d | vicvv/cdojo-PythonStack | /flask/flask_fundamentals/hello_flask/hello_flask.py | 1,406 | 3.703125 | 4 | from flask import Flask # Import Flask to allow us to create our app
app = Flask(__name__) # Create a new instance of the Flask class called "app"
@app.route('/') # The "@" decorator associates this route with the function immediately following
def hello_world():
return 'Hello World!' # Return the st... |
749f6ee116b121ed5dbf01734c0eb6b5a617866e | deb761/cake | /binary_tree.py | 4,515 | 4.03125 | 4 | import sys
class BinaryTreeNode:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
self.depth = 0
def insert_left(self, value):
self.left = BinaryTreeNode(value)
return self.left
def insert_right(self, value):
self.r... |
89b8d410d9e36c7b9050bc687b8462fae87a8a6e | lodisperkins/Python-AIForGames | /20190501_warmup_s188043.py | 512 | 3.953125 | 4 | '''Create the following function
func(x)-> []
Calculate and return all prime factors of x and return as list
Ex: f(13195)-> [5, 7, 13, 29]'''
import math
def get_prime_factors(number):
factors = []
for num in range(1,number):
if number %num == 0 and num % 2 != 0:
factors.append(num)
fo... |
6e02c0778a67d2bcd6ed133d73b1b90ab053dada | uxlsl/leetcode_practice | /next-greater-node-in-linked-list/solution.py | 1,170 | 3.65625 | 4 | # leetcode
# https://leetcode-cn.com/problems/next-greater-node-in-linked-list/
# Definition for singly-linked list.
import time
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def nextLargerNodes(self, head):
"""
:type head:... |
41c4fd33ef2d135ff7cb16edd52a08fee862b905 | uxlsl/leetcode_practice | /number-of-islands/solution.py | 1,032 | 3.53125 | 4 | # leetcode
# https://leetcode-cn.com/problems/number-of-islands/
# 结果至少有一个
# 多少个连续的1
# 用深度算法
import copy
class Solution(object):
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
def mark(grid, used, i, j):
if 0 <= i < len(grid) and 0... |
52b9039fb9b35793911f620cb52ca592c4356e15 | uxlsl/leetcode_practice | /convert-sorted-array-to-binary-search-tree/solution.py | 542 | 3.515625 | 4 | from utils import TreeNode
class Solution(object):
def sortedArrayToBST(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
def help(nums, l, h):
m = (l + h) // 2
node = TreeNode(nums[m])
if l <= m-1:
node.left = he... |
facd5114b63673b50267f3bdf7d6d9e1f1e60bef | uxlsl/leetcode_practice | /construct-binary-tree-from-inorder-and-postorder-traversal/solution.py | 782 | 3.953125 | 4 | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def buildTree(self, inorder, postorder):
"""
:type inorder: List[int]
:type postorder: List[int]
:r... |
f4380ef9deb311c2a8bb6500e3a3f63230a2f6d3 | uxlsl/leetcode_practice | /reverse-linked-list-ii/solution.py | 767 | 3.875 | 4 | # leetcode
# https://leetcode-cn.com/problems/reverse-linked-list-ii/
# https://www.geeksforgeeks.org/reverse-a-linked-list/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseBetween(self,... |
b10ee014a23061e1d285f24c282c7b650667fc47 | uxlsl/leetcode_practice | /remove-duplicates-from-sorted-list/test_solution.py | 1,005 | 3.609375 | 4 | from solution import Solution, ListNode
def make_list(lst):
head = None
n = None
for i in lst:
if head is None:
n = head = ListNode(i)
else:
n.next = ListNode(i)
n = n.next
return head
def cmp_list(l1, l2):
n1 = l1
n2 = l2
while n1 !... |
7539eec58e7a0c900f24e5479590e3873c44df45 | uxlsl/leetcode_practice | /unique-paths/solution.py | 465 | 3.5 | 4 | class Solution:
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
record = [
[0]*m for _ in range(n)
]
for i in range(n):
for j in range(m):
if i == 0 or j == 0:
... |
09568357df0d4456f7fd3c5a85240f1d8f992037 | uxlsl/leetcode_practice | /print-zero-even-odd/solution.py | 1,125 | 3.9375 | 4 | import queue
class ZeroEvenOdd(object):
def __init__(self, n):
self.n = n
self.x = 0
self.q1 = queue.Queue()
self.q2 = queue.Queue()
self.q3 = queue.Queue()
self.q1.put('')
# printNumber(x) outputs "x", where x is an integer.
def zero(self, printNumber):
... |
e246a26efe647c31f6f5819484b3984b3f54417f | uxlsl/leetcode_practice | /lowest-common-ancestor-of-a-binary-tree/solution.py | 1,048 | 3.78125 | 4 | # leetcode
# https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/
# 节点相交
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def lowestCommonAncestor(se... |
6ec471a14d0bcab8259772fec39d6417c179c561 | uxlsl/leetcode_practice | /add-digits/solution.py | 388 | 3.609375 | 4 | class Solution(object):
def addDigits(self, num):
"""
:type num: int
:rtype: int
"""
x = num
y = 0
while True:
while True:
y += x % 10
x = x // 10
if x == 0:
break
if y... |
461ae8d6339918168c7e46689012d914175e215e | uxlsl/leetcode_practice | /valid-perfect-square/solution.py | 664 | 3.6875 | 4 | # 可使用二分法找
class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
def square(guess):
return guess * guess
def goodenough(guess, x):
if abs(square(guess) - x) < 0.1:
return True
el... |
9d29bf6df6922d3f9285d1413f26fc80ab8b97f7 | uxlsl/leetcode_practice | /count-primes/solution.py | 887 | 3.578125 | 4 | # https://coolshell.cn/articles/3738.html
class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
if n < 2:
return 0
a = list(range(2,n+1))
i = 0
while True:
x = a[i]
if x * x > a[-1]:
... |
8d0ff137b23ecb5a68c6a95aee8af4d4d6b84fe6 | uxlsl/leetcode_practice | /climbing-stairs/solution.py | 301 | 3.515625 | 4 | class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
record = {
0:1,
1:1,
}
for i in range(2, n+1):
record[i] = record[i-1] + record[i-2]
return record[n]
|
9592e9fee836f337a8e84ec9adb8aab52c2165e7 | uxlsl/leetcode_practice | /split-linked-list-in-parts/solution.py | 986 | 3.8125 | 4 | # leetcode
# https://leetcode-cn.com/problems/split-linked-list-in-parts/
# 解法:
# 求长度
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def splitListToParts(self, root, k):
"""
:typ... |
1335df262b1dfa1b3a686c7bfd7190bace6e0525 | uxlsl/leetcode_practice | /unique-binary-search-trees-ii/solution.py | 974 | 3.765625 | 4 | # Definition for a binary tree node.
import copy
import functools
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def generateTrees(self, n):
"""
:type n: int
:rtype: List[TreeNode]
... |
d35ba47eb05e64bc2e58b30633235adfb15ba46d | uxlsl/leetcode_practice | /construct-binary-tree-from-preorder-and-inorder-traversal/solution.py | 952 | 3.921875 | 4 | # leetcode
# https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def buildTree(self, preo... |
d05936784abf17dad7f907ad0509998821a285ab | uxlsl/leetcode_practice | /rotate-list/solution.py | 980 | 3.84375 | 4 | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def getlistlen(self, head):
total = 0
p = head
while p is not None:
total += 1
p = p.next
return tota... |
b20d7e5969ab3dd0b7f2b0790cdce151146fa4f3 | uxlsl/leetcode_practice | /merge-two-sorted-lists/solution.py | 940 | 3.859375 | 4 | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeTwoLists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if l1 is Non... |
86547374ff51bf2258a4a10a9064126b7056a2e7 | VohidovTohirjon/shaxzoda | /Nuqta.py | 538 | 3.515625 | 4 | from math import *
class Nuqta:
### public propertylar x va y butun sonni qabul qilmoqda
### konstruktorida x va y ni qabul qilib propertylarga joylaydi
### public method: gachaMasofa() → ushbu method boshqa bir
### nuqta qabul qiladi joriy nuqtadan o'sha berilgan nuqtagacha
#... |
5a32c73bc2a33398ba0a49096fad6ee19de106f6 | WolfAuto/Atom-Folder | /Tkinter/tkinter 3.py | 1,811 | 3.703125 | 4 | from tkinter import *
root=Tk()
equa = ""
store=""
equation = StringVar()
calculation= Label(root,textvariable=equation)
equation.set("Enter your Equation")
calculation.grid(columnspan=4)
def btnPress(num):
global equa
equa= equa+ str(num)
equation.set(equa)
def EqualPress():
global equa
tota... |
1653d754aa487b576342252ccf6e06f46825de29 | learninglegion/PCC | /old_exercises/chap11exercises.py | 1,422 | 3.5625 | 4 | ##11.1 and 11.2 test_cities
#import unittest
#from city_functions import city_country
#
#class CityCountryTestCase(unittest.TestCase):
# """Test for city_country"""
#
# def test_city_country(self):
# """Do name like santiago chile work?"""
# formatted_name = city_country('evansville', 'indiana')
# ... |
4572fec25afe0b7a5d5ec95b94457b4c3a98f79e | learninglegion/PCC | /old_exercises/Alienexercises/elseifalienred.py | 360 | 4.03125 | 4 | alien_color = 'red'
if alien_color == 'green':
print("That alien was green. You just earned 5 points!")
elif alien_color == 'yellow':
print("That alien was yellow. You just earned 10 points!")
elif alien_color == 'red':
print("That alien was red. You just earned 15 points!")
else:
print("There is no els... |
7d3ef44134deac126fa997facf2f2b04b04bfe7e | learninglegion/PCC | /old_exercises/Alienexercises/elseifaliencolor.py | 383 | 4 | 4 | alien_color = 'green'
if alien_color == 'green':
print("You shot down a green alien! You just earned 5 points!")
elif alien_color == 'yellow':
print("You shot down a yellow alien! You just earned 10 points!")
elif alien_color == 'red':
print("You shot down a red alien! You just earned 15 points!")
else:
... |
360401758d0734f09c4801c58df18aa600364d15 | slavakargin/RandomGeometricStructures | /rgs/mndrpy/DyckPaths.py | 4,710 | 3.75 | 4 | '''
Created on Mar 12, 2021
@author: vladislavkargin
A collection of functions for Dyck paths.
A Dyck path is an array of +1 and -1, such that the total sum is zero and
the partial sums are always non-negative.
'''
import numpy as np
import matplotlib.pyplot as plt
def randomDyckPath(n, seed = None):
'''
... |
356498da2a53cd7ed8bca016d1277bff4f5a90be | slavakargin/RandomGeometricStructures | /rgs/ribbons/Ribbon.py | 8,466 | 4.03125 | 4 | '''
Created on Jan 17, 2021
@author: vladislavkargin
'''
#import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
class Ribbon(object):
'''
This class realizes a ribbon tile for ribbon tilings.
Ribbon is deetermined by its root square
s_{xy} (south-west corner is at (x, y))... |
f58226eec24104bafbec86e0919dbdfd65dc3004 | StuMcA/testing_lab | /classes/pub.py | 1,363 | 3.625 | 4 | from classes.food import *
class Pub:
# declare data-types
name = str
# initialise Person Class
def __init__(self, name, till, drinks, foods):
self.name = name
self.till = till
self.drinks = drinks
self.foods = foods
def increase_till(self, amount):
self.ti... |
875099ff161af5e653f2ae094005ab8c87d07ab5 | yasuaki-eda/trainNumericalCalc | /InroroductionToAlgorithm/FordFulkerson.py | 1,620 | 3.53125 | 4 | import numpy as np
import breadthFirstSearch as BFS
import copy
def init_graph():
G = {
0: [1, 2],
1: [2, 3],
2: [1, 4],
3: [2, 5],
4: [3, 5],
5: []
}
C = {
0: [16, 13],
1: [10, 12],
2: [ 4, 14],
3: [ 9, 20],
4: [ 7, 4],
5: []
}
return G, C
def MaxFlow(G0, C... |
196cbb127fe0f7309e15341b078c0a532f721a34 | LanyK/TheAngerGames | /bombangerman/client/Sprites.py | 6,597 | 3.609375 | 4 | import pygame
import json
from collections import defaultdict
class Spritesheet(object):
@classmethod
def from_file(cls, filename, sprite_size=(16, 16)):
""" @param sprite_size: Defaults to (16,16)
Load a spritesheet from a file.
This method will load an image file and cut it... |
af0f0e1469db2ba460d01e13d84fd04667283f89 | nikradaev/playing-with-python-library-Turtle | /turtle_ex_01.py | 595 | 3.953125 | 4 | import turtle
from turtle import *
import random
from random import *
#get cursor to default - center position
turtle.home()
#colors
colors = ['red', 'purple', 'blue', 'green', 'yellow', 'orange']
#background
turtle.bgcolor('black')
#loop for 100 iterations
for x in range(100):
#random color
... |
8c5b7fc4254d9908ad48b607e8727b69f922ddfe | sorinash/Graphical-Calculator | /calculator_test.py | 11,009 | 3.9375 | 4 | # -*- coding: utf-8 -*-
"""
First attempt at using tkinter with python
Also a test of a basic calculator
Can add, subtract, multiply, and divide, as well as handle decimals and avoid
divide-by-zero errors
"""
from tkinter import *
class calc():
def __init__(self):
self.firstnum = 0
s... |
8ed36f9f0d21910428048f6c88b264cb447f4f71 | magahu/python-oop | /HERITANCE_AND_POLYMORPHISM/heritance.py | 491 | 4.03125 | 4 | #Superclass
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def area(self):
return self.width*self.height
#Subclass
class Square(Rectangle): #Class Square extends Rectangle
def __init__(self, h):
super().__init__(h, h) #Supercla... |
eef50aee18acf71d992d3a49bb87f06c6a487227 | Adriagallardo/adria_gallardo_thebridge_ds | /Ejercicios/Week3/imports/b/c/z.py | 267 | 3.5625 | 4 | import sys, os
ruta= __file__
print(ruta)
for i in range(3):
ruta= os.path.dirname(ruta)
print(ruta)
sys.path
sys.path.append(ruta)
import a.x as x
import b.y as y
def f1z():
print("f1z")
y.f1z
def f2z():
print("f2z")
x.f2x()
z = 3
z_z = 33
|
a794a2295ffa64a6f056347bfca391d6fa833907 | joshimanish2000/send_email | /send_email.py | 1,475 | 3.5 | 4 | #! /usr/bin/env python3
import os
import sys
from email.message import EmailMessage #Module to send emails
import mimetypes #for encoding attachments
import smtplib # to set a mail server up
import getpass # to hide typing passwords
message = EmailMessage() #EmailMessage's object
sender = 'manishjoshicsj@gmail.... |
517a782ce41b44a275432dbc8e0a0d975b741bf1 | dawchenlee/dawchengit | /Leetcode/day11有效的括号.py | 869 | 3.703125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 20:17:10 2019
题目:有效的括号
给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。
有效字符串需满足:
左括号必须用相同类型的右括号闭合。
左括号必须以正确的顺序闭合。
注意空字符串可被认为是有效字符串。
@author: dawchen
"""
class Solution:
def isValid(self, s: str) -> bool:
# 运用栈的特征来解决问题。时间复杂度O(n)空间复杂... |
10d2f362fdb850c3f902bbc4018289098a56bb0c | dawchenlee/dawchengit | /Leetcode/day24找到k近邻元素.py | 1,716 | 3.625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 7 20:33:01 2019
题目:找到 K 个最接近的元素
给定一个排序好的数组,两个整数 k 和 x,从数组中找到最靠近 x(两数之差最小)的 k 个数。
返回的结果必须要是按升序排好的。如果有两个数与 x 的差值一样,优先选择数值较小的那个数。
@author: dawchen
"""
class Solution:
def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]:
... |
0ff6ab1d432e2ca85b29b5ed6059d0e8b9bcd06a | dawchenlee/dawchengit | /Leetcode/day08最大数.py | 927 | 3.65625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 15 16:56:44 2019
题目:最大数
给定一组非负整数,重新排列它们的顺序使之组成一个最大的整数。
示例 1:
输入: [10,2]
输出: 210
示例 2:
输入: [3,30,34,5,9]
输出: 9534330
说明: 输出结果可能非常大,所以你需要返回一个字符串而不是整数。
@author: dawchen
"""
class Solution:
def largestNumber(self, nums: List[int]) -> str:
#... |
7226d4025aeb7e09b6951d96dc7207a0fba4b2c9 | dawchenlee/dawchengit | /Leetcode/day20 三角形最小路径和.py | 880 | 3.5 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 21 04:39:33 2019
题目:三角形最小路径和
给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。
例如,给定三角形:
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。
@author: dawchen
"""
# 动态方程: dp[i][j] = min(dp[i-1][j], dp[i-1][j+1]) + triangle[... |
d721baa6cd88a0006094c10e74fe7ef7beaf7846 | dawchenlee/dawchengit | /Leetcode/day18最长连续序列.py | 3,438 | 3.84375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 30 19:35:03 2019
题目:最长连续序列
给定一个未排序的整数数组,找出最长连续序列的长度。
要求算法的时间复杂度为 O(n)。
@author: dawchen
"""
'''哈希表和线性空间的构造
算法
这个优化算法与暴力算法仅有两处不同:这些数字用一个HashSet保存(或者用Python里的Set)
实现O(1)时间的查询,同时,我们只对当前数字-1不在哈希表里的数字,作为连续序列的第一个数字去找
对应的最长序列,这是因为其他数字一定已经出现在了某个序列里。
复杂度分析
时... |
d5d15275747b83e65d6eb3024245f6e525a86b24 | dbonnett10/Python_Networking | /lab03/lab3skeleton.py | 981 | 3.546875 | 4 | # YOUR NAME, HONOR CODE, LAB NUMBER
# We need the time package to calculate round-trip times:
import time
from socket import *
host = ...
port = ...
timeout = 1 # in seconds
# Create UDP client socket
# Note the use of SOCK_DGRAM for UDP datagram packet
clientsocket = socket(AF_INET, SOCK_DGRAM)
# Set socket timeo... |
15b87f0b47abfc2c5eb7c732a3dfe5c5cfd5ba04 | kumko/sublimeDemo | /python/基本数据类型/元组.py | 263 | 3.90625 | 4 | # tuple 与列表类似 不同之处在于元组的元素不能改
# 使用括号定义()
tup = ('12','klj','mm','90')
print(tup)
# 当元组只有一个元素时,最后要加个逗号
tup1 = (1,)
print(tup1)
print(len(tup))
# 查看元组地址
print(id(tup)) |
38c09a002197328b6084f8b51f4375607164fa62 | davidkiger/aoc2015 | /10-1.py | 589 | 3.71875 | 4 | string = '1113122113'
def seesay(s):
new_string = ''
digits = list(s)
digit = digits[0]
count = 1
for i in range(1, len(digits)):
if digits[i] == digit:
# Continuing
count += 1
else:
# Appending and resetting
new_string = '{}{}{}'.for... |
10d0bea3f146836dfe99278c6c84ac48bac8cb3e | davidkiger/aoc2015 | /8-2.py | 295 | 3.515625 | 4 | file = open("8-1.in", "r")
encoded = 0
code = 0
for line in file:
chars = list(line.strip())
encoded += 2
for i in range(len(chars)):
code += 1
encoded += 1
if chars[i] == '\\' or chars[i] == '"':
encoded += 1
print('{}'.format(encoded-code))
|
e8e79d72b7534e6b8ea7364b5964a39ca50e3e4b | sgav07/Harvard-CS50 | /Pset 6/mario/mario.py | 491 | 4.1875 | 4 | # Include special functions from cs50
from cs50 import get_int
# Prompt the user to provide a number
height = get_int("Height: ")
# Check if usage is correct and the user has entered a number
while False:
height = get_int("Height: ")
if height < 1 or height > 8:
height = get_int("Height: ")
# Loop through th... |
6ade8d533744edd0e733e0508a57558da3defcf0 | yunlu1997/leetcode | /其他/268缺失数字.py | 728 | 3.703125 | 4 | """
给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。
示例 1:
输入: [3,0,1]
输出: 2
示例 2:
输入: [9,6,4,2,3,5,7,0,1]
输出: 8
"""
"""
数学方法
先求0到n的和,再减去现有的,就得到了缺失值
"""
class Solution:
def missingNumber(self, nums: List[int]) -> int:
summary = len(nums)*(len(nums)+1)//2
return summary - sum(nums)
... |
2c2e8b7cf22f01886ac45f2ee758e29984410a7b | yunlu1997/leetcode | /字符串/242有效的字母异位词.py | 1,626 | 3.765625 | 4 | """
给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。
示例 1:
输入: s = "anagram", t = "nagaram"
输出: true
示例 2:
输入: s = "rat", t = "car"
输出: false
说明:
你可以假设字符串只包含小写字母。
进阶:
如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/valid-anagram
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
"""用两个字典... |
b803937b764b47774d4848c401ba2801b367a6aa | yunlu1997/leetcode | /字符串/7整数反转.py | 947 | 3.890625 | 4 | """
给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。
示例 1:
输入: 123
输出: 321
示例 2:
输入: -123
输出: -321
示例 3:
输入: 120
输出: 21
注意:
假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为 [−231, 231 − 1]。请根据这个假设,如果反转后整数溢出那么就返回 0。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/reverse-integer
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
class Solution:
... |
ee0d441618160bf1bd457ffd40886ad03b6e5af1 | yunlu1997/leetcode | /数组/169多数元素.py | 669 | 3.609375 | 4 | """
给定一个大小为 n 的数组,找到其中的多数元素。多数元素是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。
你可以假设数组是非空的,并且给定的数组总是存在多数元素。
示例 1:
输入: [3,2,3]
输出: 3
示例 2:
输入: [2,2,1,1,1,2,2]
输出: 2
"""
"""
哈希表
"""
class Solution:
def majorityElement(self, nums: list[int]) -> int:
hashmap = dict.fromkeys(set(nums),0) # 由num中的元素作剑初始化一个字典
for num i... |
bb6b2d86e07444208ba03fc1fb5e3c8e795af68d | yunlu1997/leetcode | /数组/122买卖股票的最佳时机II.py | 950 | 3.53125 | 4 | """
给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。
注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
示例 1:
输入: [7,1,5,3,6,4]
输出: 7
解释: 在第 2 天(股票价格 = 1)的时候买入,在第 3 天(股票价格 = 5)的时候卖出, 这笔交易所能获得利润 = 5-1 = 4 。
随后,在第 4 天(股票价格 = 3)的时候买入,在第 5 天(股票价格 = 6)的时候卖出, 这笔交易所能获得利润 = 6-3 = 3 。
"""
class Soluti... |
33f7f8fb584316538c1f92486f75f1c017840537 | trevorfehrman/Data-Structures | /doubly_linked_list/dll.py | 4,196 | 4.0625 | 4 | """Each ListNode holds a reference to its previous node
as well as its next node in the List."""
class ListNode:
def __init__(self, value, prev=None, next=None):
self.value = value
self.prev = prev
self.next = next
def __repr__(self):
return f"{self.value}"
def insert_aft... |
dd47f468e10e967234ddba52fc5f2ff9e9ba55d8 | yhmain/Collection-of-Tools | /tool_wordcloud.py | 581 | 3.515625 | 4 | #!/usr/bin/env python
from wordcloud import WordCloud
with open("Hack/Facebook.txt", encoding="utf-8")as file:
text = file.read() # 1. Read the text content
# 2. Set the background color, width and height of the word cloud, and the number of words
wd = WordCloud(backgro... |
aad924d18c993f79d7f5a57efc75ae1c40a937bf | slconrad/ATBSWP | /if_elif.py | 230 | 4.0625 | 4 | name = 'Bob'
age = 300
if name == 'Alice':
print('You are not the person I seek.')
elif age < 22:
print('you are not old.')
elif age < 200:
print('You are old fer sure.')
elif age > 240:
print('You might be him.')
|
0165df47b25aa577eb1d34673df2e53eb78b78a1 | Derie1/python-project-lvl1 | /brain_games/scripts/brain_prime.py | 1,290 | 4 | 4 | #!/usr/bin/env python
import prompt
from random import randint
START_NUMBER = 1
END_NUMBER = 100
TRIES = 3
WRONG_MSG = "is wrong answer ;(. Correct answer was"
def welcome_user():
player = prompt.string('May I have your name? ')
return player
def is_prime(n):
if n % 2 == 0:
return n == 2
d ... |
9dd92d6d05f4fcb266a32f926ed612fcb1027007 | fridriks98/Forritunarverkefni | /Undirbúningsnámsskeið/if_else_assignment4.py | 302 | 3.8125 | 4 | #Verkefni_6
a = input("Please enter a number: ")
b = input("Please enter another number: ")
c = input("Please enter another number: ")
a_int = int(a)
b_int = int(b)
c_int = int(c)
if c_int == a_int*b_int:
print("Good Job!")
elif c_int != a_int*b_int:
print("Not quite right, go practice!") |
0a0659e593c445f56080f0c1a5d825b9a036ad2c | fridriks98/Forritunarverkefni | /forritunaræfingar/daemi10.py | 660 | 4.4375 | 4 | #Create a program that takes 1 integer as input. The program should print \
#”Less than 10” if the input value is less than 10. If the input value is \
#greater than or equal to 10 and less than 20 it should print “between 10 and 20”. \
# If the input value is greater than or equal to 20 the program should print \
#“th... |
d5d01c230c7229192d73d09167d3d10542855523 | fridriks98/Forritunarverkefni | /forritunaræfingar/daemi4.py | 398 | 4.5625 | 5 | #Create a program that takes an integer and a string as input, let’s call \
#the integer ageand the string name. Next your program should print the text:\
#“Hello, my name is <name> and my age is <age>.” where <name> and <age> are the values that were input.
name = input("What is your name: ")
age = int(input("What is ... |
a58d89fa6a231b601c1bf85db2dd44f27540499e | fridriks98/Forritunarverkefni | /Python_projects1/Skilaverkefni/Character_counts.py | 617 | 4 | 4 | sentence = input(str("Enter a sentence: "))
Upper_case = 0
Lower_case = 0
number = 0
Punctuation = 0
space = 0
for i in range(len(sentence)):
if sentence[i].isupper():
Upper_case += 1
elif sentence[i].islower():
Lower_case += 1
elif sentence[i].isdigit():
number += 1
elif senten... |
a21d0963befd594084be6c995a9478110af2ba33 | fridriks98/Forritunarverkefni | /Python_projects1/Mímir verkefni/mimir_verkefni/for_loops/for_loops6.py | 900 | 3.921875 | 4 | top_num = int(input("Upper number for the range: ")) # Do not change this line
sum_of_divisors = 0
for number in range(1, top_num+1): # Im gonna find if there is any perfect number in the interval [1-top_num]
for divisor in range(1, number): # to do that, im going to divide the number with every number that is sm... |
b66080f64daaf99353c96113dc79b9be5033f6bf | fridriks98/Forritunarverkefni | /forritunaræfingar/daemi8.py | 388 | 4.375 | 4 | #Create a program that takes 2 strings as input. If the strings are \
#the same length the program should print “The strings are the same length”. \
#If they are not the same length the program shouldn’t print anything.
string1 = input("Enter a string: ")
string2 = input("Enter another string: ")
if len(string1) == le... |
372069da5cd83bac16d529882570bdb0e456973e | fridriks98/Forritunarverkefni | /Python_projects1/Skilaverkefni/Skilaverkefni1.py | 983 | 4.125 | 4 | loan = int(input("Input the cost of the of the item in $: "))
payment = 50.0
month = 0
total_interest_paid = 0
if 0 < loan < 2500:
if loan > 1000:
percent = 0.02
else:
percent = 0.015
while loan > 0:
month += 1
interest_paid = loan * percent
interest_paid = round(i... |
9c788af7fbfaae83ceff767200348b7c222f4f81 | fridriks98/Forritunarverkefni | /forritunaræfingar/daemi22.py | 477 | 4.28125 | 4 | #Create a program that takes 2 integers as input, let’s call them low and high. \
#Your program should print the sum of all the integers between low and high(low and high included). \
#You may assume that low is always lower than high.
low = int(input("Input the lower value: "))
high = int(input("Input the lower value:... |
66abf9f04bcc12a214f8ea5c28788be9d90ff22a | fridriks98/Forritunarverkefni | /Python_projects1/Mímir verkefni/mimir_verkefni/strings and/verkefni7.py | 553 | 4.21875 | 4 | my_int = input('Give me an int >= 0: ')
quotient = 0
remainder = 0
int_change = int(my_int)
bstr = ""
if my_int == '0':
bstr += my_int
print("The binary of", my_int, "is", bstr)
else:
while int_change > 0:
print("my int is now: ",int_change)
quotient = int_change//2
print("... |
96bf08856f1d976fd6d2effa6075ff954befe31a | fridriks98/Forritunarverkefni | /forritunaræfingar/daemi17.py | 141 | 4.28125 | 4 | #Create a program that prints all the odd integers from 15 down to 3 (15 and 3 included)
x = 15
while x >= 3:
print(x)
x -= 2
|
ad2eb899c15cb27191c90ba5580e7ced48142edb | fridriks98/Forritunarverkefni | /Python_projects1/Mímir verkefni/mimir_verkefni/while_loops/while_loops1.py | 163 | 4.15625 | 4 | num = int(input("Input an int: ")) # Do not change this line
integer = 1
# Fill in the missing code below
while integer < num:
print(integer)
integer += 1 |
32f4213f29849699007f25561f938f9aded0fc32 | fridriks98/Forritunarverkefni | /Python_projects1/Mímir verkefni/assignments/assignment1f.py | 405 | 3.984375 | 4 | d1 = int(input("Input first dice: ")) # Do not change this line
d2 = int(input("Input second dice: ")) # Do not change this line
the_sum = 0
if 6 >= d1 >= 1 and 6 >= d2 >= 1:
the_sum = d1+d2
if the_sum == 7 or the_sum == 11:
print("Winner")
elif the_sum == 2 or the_sum == 3 or the_sum == 12:
... |
34eccf55779064d76e11a90a2fc4c470630cfe45 | PhilipToddCoppola/Honours-Project | /ROOT/Main Code/Velocity_Check.py | 557 | 3.5 | 4 | ##############################################
## A simple graph plotting script to check ##
## if the equation I have matches the Paper ##
##############################################
import numpy as np
import pylab as plt
import math
vmax = 420.
a = 1./210.
b = 1100
def velocity(x):
return vmax/(1. +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.