blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
f8c1e444a56ce94ad8e0d14216d0df39f0ebace7 | adnathanail/project_euler | /001-050/014 - Longest Collatz sequence.py | 295 | 3.703125 | 4 | sbf = {}
def collatz(n):
if n == 1:
return 1
n = int(3*n +1) if n%2 else int(n/2)
if n not in sbf:
sbf[n] = collatz(n)
return sbf[n] + 1
biggest = 0
biggest_length = 0
for i in range(1,1000000):
c = collatz(i)
if c > biggest_length:
biggest = i
biggest_length = c
print(biggest) |
738f6753272b3ee9217dec25265a7b6577700a5f | adnathanail/project_euler | /051-100/U051 - Prime digit replacements.py | 1,441 | 3.5625 | 4 | NUMS = ["*", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
def generate_templates(longest_template):
if longest_template < 1:
return []
elif longest_template == 1:
return NUMS
out = []
for shorter in generate_templates(longest_template - 1):
for num in NUMS:
out.append(num + shorter)
re... |
2f1afb5f1e7a26dc2dbbe15caf70ebeb23b19cb4 | adnathanail/project_euler | /001-050/046 - Goldbach's other conjecture.py | 517 | 3.84375 | 4 | def is_prime(n):
# if n < 2:
# return False
for i in range(2,int(n**0.5)+1):
if not n%i:
return False
return True
def is_square(n):
return n**.5%1==0
primes = []
i = 2
disproved = False
while not disproved:
if is_prime(i):
primes.append(i)
elif i%2:
found = False
for p in primes:... |
a0d2538eb43c08475e44dc26983d60081ed8a304 | adnathanail/project_euler | /051-100/055 - Lychrel numbers.py | 321 | 3.640625 | 4 | def is_palindromic(n):
s = str(n)
return s == s[::-1]
def is_lychrel(n):
i = 0
while not is_palindromic(n) or i == 0: # or i == 0 to deal with palindromic lychrels
n = n + int(str(n)[::-1])
i += 1
if i >= 50:
return True
return False
print(len([i for i in range(10,10000) if is_lychrel(i)])... |
e56c5d2549bb501b1dd7aad866f712c556ac7d26 | adnathanail/project_euler | /001-050/015 - Lattice paths.py | 316 | 3.515625 | 4 | gridSize = 20
grid = []
for i in range(gridSize+1):
grid.append([])
for j in range(gridSize+1):
grid[-1].append(0)
for i in range(1, gridSize+1):
grid[i][0] = 1
grid[0][i] = 1
for i in range(1, gridSize+1):
for j in range(1, gridSize+1):
grid[i][j] = grid[i-1][j] + grid[i][j-1]
print(grid[-1][-1]) |
8b2d64326f78b41521165942b65db61259540490 | adnathanail/project_euler | /001-050/029 - Distinct powers.py | 247 | 3.5625 | 4 | mina = 2
maxa = 100
minb = 2
maxb = 100
vals = []
for a in range(mina,maxa+1):
for b in range(minb,maxb+1):
print("a: " + str(a) + " b: " + str(b))
if not((a**b) in vals):
vals.append(a**b)
vals.sort()
print(len(vals))
|
fff5b475f5a2a26279d16fc6bce439ce0032fccf | JacobLondon/pyngine | /src/input/event.py | 1,000 | 3.875 | 4 |
class Event(object):
"""@brief Event object is used to simplify connecting a
keypress or set of keypresses to a given function.
"""
def __init__(self, controller, action=None, args=(), keys=()):
"""@brief Setup the event into the controller. \\
@param Controller the parent controller. ... |
462e65b91e84ab2821f9e064a6cd44949183ae1e | lamihov/learn_python | /regular expressions/66. группы.py | 3,039 | 3.875 | 4 | '''Группа создается путем заключения части регулярного выражения в круглые скобки.
Это означает, что группа может быть задана в качестве аргумента метасимволам, таким как * и ?.
'''
import re
pattern = r"egg(spam)*"
if re.match(pattern, "egg"):
print("Match 1")
if re.match(pattern, "eggspamspamspameg... |
9950e8c3e380e34e302032878ed0d5da72cfb7cf | lamihov/learn_python | /exceptions and files/28. утверждения.py | 829 | 4.25 | 4 | #утверждения - это проверка правильности кода. Выражение проверяется, и если оно ложно вызывается исключение
print(1)
assert 2 + 2 == 4
print(2)
assert 1 + 1 == 3
print(3)
#пример
print(0)
assert "h" != "w"
print(1)
assert False
print(2)
assert True
print(3)
#утверждениям можно давать второй аргумент, кот... |
d3864e4f6e213067132c8b6cf088ceb3dbb2d47c | lamihov/learn_python | /constructions/9.while_break.py | 776 | 4.125 | 4 | #выводит значение i, пока i не будет равен 5. while (до тех пор пока)
i = 1
while i <= 5:
print(i)
i = i + 1
print("Finshed")
#бесконечный цикл
while 1 == 1:
print ("in the loop - в петле")
#использования инструкции break (стоп)
i = 0
while 1 == 1:
print(i)
i = i + 1
if i >= 5:
... |
584a5be8330e4a2961b75122d3e9cea5ac20e50a | lamihov/learn_python | /functional programming/48. декораторы.py | 799 | 4.34375 | 4 | '''Декораторы предназначены для изменения поведения фнукции без ее модификации'''
def decor(func):
def wrap():
print("=====")
func()
print("=====")
return wrap
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
''' В предыдущем примере, дек... |
69390cb48cda91d7f7215f11e3902c2ae593cb34 | lamihov/learn_python | /object oriented programming/59. свойства.py | 2,340 | 4.15625 | 4 | '''В свойствах можно настроить доступ к атрибутам экземпляра.
Чтобы создать свойства, непосредственно перед методом помещается декоратор property:
при вызове атрибута экземпляра с таким же именем, что и у метода, вместо него будет вызван метод.
Один из распространенных способов их применения - присвоение атрибуту св... |
314af36c3d176756ed89c1458e4611c5a79ca816 | lamihov/learn_python | /functions/23. test.py | 646 | 3.71875 | 4 | #тест по функциям и модулям
def min(x,y):
if x <= y:
return x
else:
return y
#функция вычисляет сумму всех чисел от 0 до числа аргумента
def sum(x):
res = 0
for i in range(x):
res += i
return res
# самое большое число которое выведет программа = 0
def print_nums(x):
for i in rang... |
e04462368b06b690b2469944ce92d0b2db906ae2 | lamihov/learn_python | /types of objects/40. форматирование строк.py | 598 | 4.25 | 4 | #форматирование строк. Используется метод форматирвания format для замены аргументов строки
nums = [4, 5, 6]
msg = "Numbers: {0} {1} {2}".format(nums[0], nums[1], nums[2])
print(msg)
#пример
print("{0}{1}{0}".format("abra", "cad"))
#форматирование строк можно делать с помощью аргументов которым присвоены имен... |
02635f466f8ae83a4bf90b216259db679f522341 | lamihov/learn_python | /regular expressions/67. специальные последовательности.py | 3,478 | 4.09375 | 4 | '''
В регулярных выражениях также используются различные специальные последовательности.
Их синтаксис записывается как бэкслэш, за которым следует другой символ.
Одна такая специальная последовательность:
бэкслэш и число между от 1 до 99, например, \1 или \17. Такая последовательность соответствует выражению груп... |
b3facba91de90ae86dd4fe59624a8822777df118 | lamihov/learn_python | /types of objects/42. анализатор текста.py | 1,840 | 4.28125 | 4 | #Рассмотрим программу которая анализирует файл и определяет, какой процент текста приходится на каждый символ.
filename = input("Enter a filename: ")
with open(filename) as f:
text = f.read()
print(text)
#Заполните пропуски так, чтобы содержимое читалось с помощью инструкции with
with open(filename) as f:
... |
99a35dc5c8ffd341bb43b870a04ab783979ed0a9 | linbinbin/pytest | /8q.py | 820 | 3.71875 | 4 | # *_utf-8_ *
import os
import math
def putNext(y,pos):
putflg = 0
if y==8:
print "Ping Pong !!!!", pos
return
for x in range(0,8):
hasflg = 0;
for jugd in pos:
if x == jugd[0] or y == jugd[1] or math.fabs(x-jugd[0]) == math.fabs(y-jugd[1]):
hasflg... |
11be6a33f851185c4f3b9bce22a0536b0c50ced9 | linbinbin/pytest | /quick_sort.py | 659 | 3.6875 | 4 | #!/usr/bin/env python
"""
This is a Flask web app controller for the cars with rasberrypi.
"""
import random
def quick_sort(a):
b1=[]
b2=[]
b3=[]
if len(a)>1:
val = a[random.randrange(0, len(a))]
for i in range(len(a)):
if a[i] < val:
b1.append(a[i])
... |
31fb77a8515adf54fae8f3dcd2bd581f17a800fd | BensyBenny/Bensybenny-rmca-s1A | /p10.py | 344 | 3.890625 | 4 | Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import math
>>> r = float(input("Enter the radius of the circle: "))
Enter the radius of the circle: 6
>>> area = math.pi* r * r
>>> print("%.... |
11fe38e5f1d31405c470800f50a1d75d3f078bdf | John151/camelCase_program_with_tests | /camelCase.py | 595 | 4.21875 | 4 | def camel_case(sentence):
# convert sentence into camel case
# remove input characters and escape characters
bad_input = ['\n', '\t', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')']
for i in bad_input:
sentence = sentence.replace(i, '')
# remove spaces
title_case = sentence.title()
... |
d7596b2cb11c82d8dab74f4b18497f98c7bade79 | mampersat/LL4P | /play.py | 1,233 | 3.609375 | 4 | import sys, pygame, time, random
pygame.init()
size = width, height = 320, 800
speed = [1, 1]
black = 0, 0, 0
cars = []
screen = pygame.display.set_mode(size)
red = (255,0,0)
screen.fill(red)
pygame.display.update()
car_img = pygame.image.load("car.png")
car_img = pygame.transform.scale(car_img, (100,200))
car_rect... |
b3c8c5a8913b27e81232f12d4e67f2dfb174a214 | Gordep/Data-Labs | /Lab1 - Recursive Drawing/Lab 1 - Recursion - FixedSquares.py | 6,751 | 4.09375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 4 21:11:42 2019
Course: CS-2302 Data-Stuctures
Author: Julian Gonzalez
Assignment: Lab 1 Drawing figures with recursion
Intstuctor: Olac Fuentes
T.A's: Anindita Nath, Maliheh Zargaran
Purpose: The purpose of this program is to draw different figures using matplo... |
bc7d1e0066f8c9c2fe4a0e1ee4c8f6578f4e02cf | goonerify/The-Python-Mega-Course-Build-10-Real-World-Applications | /Section 25 Object-Oriented Programming (OOP)/bookstore/frontend.py | 4,374 | 3.71875 | 4 |
from tkinter import *
from backend import Database
database=Database()
class Bookstore:
def __init__(self) -> None:
self.window=Tk()
self.window.wm_title("Bookstore")
self.l1 = Label(self.window, text="Title")
self.l1.grid(row=0, column=0)
self.l1 = Label(self.window, t... |
540b63174b0d93fd120d7dd606ab0b95e1703968 | SKumaran14/data-structures-2021 | /python/leap_year.py | 456 | 4.1875 | 4 | """
********************************************************
A year is leap year (366 days) if:
i. Year is multiple of 400.
OR
ii. Year is multiple of 4 and not multiple of 100.
********************************************************
"""
year = int(input("Enter the year(yyyy): "))
if not(year... |
9bc0d4c7e1142b144d4c53110879b32e2f930027 | Gayatri-Prathyusha/CSPP1-Practice | /M3/iterate_even_reverse.py | 95 | 3.609375 | 4 | """Even Numbers Reverse"""
X = 10
print("Goodbye!")
for i in range(10, 1, git-2):
print(i)
|
0aaf77b7ee22051ef2deeabea615fd0b886291c1 | cosmmiike/Evolution | /evolution_2.py | 950 | 3.6875 | 4 | class World:
def __init__(self):
self.birth_rate = 1 # chance of a new spontaneously born creation
self.creations = []
def spontaneous_birth(self):
self.creations.append(Creation())
def reproduction(self):
new_creations = []
for creation in self.creations:
... |
e6251f653ef6c2a1f3dbe981eecf0162d0a3ed8b | wieliczk/C291Project1 | /Project1/searching.py | 6,574 | 3.53125 | 4 | # Deals with searching
# 3 options
# 1) use licence or name to get information
# 2) use licence or sin to get all violations
# 3) Use vehicle serial number to see all violations its a part of
import cx_Oracle
import sys
import userInput
import person
import licence
import vehicle
def searchOption(logString):
int... |
286c9e3815948c1435ccb81d6a38ef1cd0c19c20 | yangyutu/PyTorch-Tutorial | /tutorial-contents/602_Python_multiprocessingUsingQueue.py | 707 | 4.09375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 7 19:21:34 2019
@author: yangyutu123
"""
# a good source: https://pymotw.com/2/multiprocessing/basics.html
# Here we show how to use Queue to store results from individual processes.
import multiprocessing as mp
def worker(q):
res = 0
f... |
0a07413f4cde26b08631ee3317b37089b713b301 | kwahalf/data-structures | /models/person.py | 1,447 | 3.9375 | 4 | from abc import ABCMeta, abstractmethod
class Person(object):
"""class Room"""
__metaclass__ = ABCMeta
def __init__(self, name=None, person_id=None, wants_accomodation=None):
self.person_id = person_id
self.name = name
self.role = None
self.wants_accomodation = wants... |
c24a83363dd30c81a701356c8746472919c6f0be | gourab-d-roy/tcs_codevita_solution | /super_ascii.py | 731 | 3.5 | 4 | flag=0
i=1
count=dict()
res=''
alpha=dict()
lst=list()
ls=list()
for idx in range(97, 97 +26):
res = res + chr(idx)
for le in res:
alpha[le]=alpha.get(le,0)+i
i=i+1
nos=input('numbers of strings ')
for j in range(1,int(nos)+1):
sen=input('string input ')
lst.append(sen)
print(lst)... |
ca581a2390d325d2eda504ced1634e3fc34b7330 | kuralovsa/Python | /Random3.py | 110 | 3.5625 | 4 | from random import*
a=[randint(1,26) for i in range(3)]
print(a)
print(sample(a,3))
print(randrange())
|
4a1182db44cc5c0167a01f230ab8d99e69737d6c | kuralovsa/Python | /Try blok4.py | 516 | 3.859375 | 4 | def function(*number):
list = []
list.append(max(number))
list.append(min(number))
return list
print(function(1,2,3,4,10))
def fun(string, case=True):
if case:
return string.upper()
else:
return string.lower()
print(fun('Hello', True))
def fun(*strings, glue='... |
7cc9cd87db88386726e23bd52390985a77315519 | kuralovsa/Python | /Python 3.py | 172 | 3.75 | 4 | import math
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
if(a>=b and b>=c):
print("a=",a*2,"b=",b*2,"c=",c*2)
else:
print(abs(a),abs(b),abs(c))
|
7d09b7e80cc8802f6439d8f3dca49210e2e21cb4 | kuralovsa/Python | /Python 9.py | 155 | 3.625 | 4 | import math as m
x=int(input("x="))
y=int(input("y="))
z=int(input("z="))
e=((m.cos(x)-m.sin(y))**3)/m.tan(x)**1/2+m.log(x*y*z,m.e)**2
print("e=",e)
|
441b66ca960a891cd9080d1a92af081fcb894dc7 | kuralovsa/Python | /4 bur.py | 372 | 3.890625 | 4 | for jol in range(5):
for bagan in range(5):
if(jol==0 and (bagan>=0 and bagan<5)) or\
(jol==1 and bagan==0) or\
(jol==2 and (bagan>=0 and bagan<5)) or\
(jol==3 and bagan==0) or\
(jol==4 and bagan==0):
print('*',end=' ')
else:
... |
434390ba25f7731a8818548fd4743c26611a9878 | kuralovsa/Python | /home.py | 883 | 3.984375 | 4 | import turtle
col = ["red", "blue", "green", "cyan", "purple"]
def drawHouse(t, length):
for i in range(4):
t.forward(length)
t.color("red")
t.right(90)
t.color("blue")
t.left(60)
t.forward(length)
t.color("red")
t.right(120)
t.color("red")
t.forward(length)
... |
a28be2b13a37541fdce3ed157675860d9b8d592d | up824/crackingTheCodingInterview | /16.2 WordFrequencies.py | 405 | 3.578125 | 4 | #16.2 Word Frequencies
def wordFrequencies1(book, word):
cnt = 0
for w in book:
if w == word:
cnt += 1
return cnt
import collections
def wordFrequencies2(book, word):
table = collections.Counter(book)
return table[word]
book = ['a','b','a','good']
book += ['good']... |
59aef56e3f910d90e6a1d97b61132c19517ebdb0 | up824/crackingTheCodingInterview | /8.4 PowerSet.py | 459 | 3.734375 | 4 | # 8.4
def powerSet(arr):
arr.sort()
path = []
res = []
start = 0
dfs(start, arr, path, res)
return res
def dfs(start, arr, path, res):
if start > len(arr):
return
res.append(path[:])
for i in xrange(start, len(arr)):
if i > 0 and arr[i] == arr[i -... |
90eeec28cc889bf4a8a9c801a12f8df053b7d775 | up824/crackingTheCodingInterview | /2.3 DeleteMiddleNode.py | 440 | 3.953125 | 4 | # 2.3 delete a given middle node(not first or last)
class ListNode(object):
def __init__(self, val):
self.val = val
self.next = None
def deleteMiddleNode(mid, head):
# return void
if not head or not head.next:
return
prev, curr = head, head.next
while curr != ... |
ab9e02bbe8c05e72dd55aa24827b258ea5a27602 | up824/crackingTheCodingInterview | /8.7 Permutation.py | 348 | 3.828125 | 4 | # 8.7 Permutation
def permutation(nums):
path = []
res = []
dfs(nums, path, res)
return res
def dfs(nums, path, res):
if not nums:
res.append(path)
for i, num in enumerate(nums):
dfs(nums[:i] + nums[i + 1:], path + [num], res)
if __name__ == "__main__":
pr... |
5dba97d49646f5e59bf7eb1c168ee1645e28ab18 | up824/crackingTheCodingInterview | /1.8 ZeroMatrix.py | 1,607 | 3.671875 | 4 | # 1.8 Zero Matrix zero col and row in a m*n matrix if an element is Zero
def zeroMatrix(matrix):
# matrix is list(list(int))
# return void
if not matrix or not matrix[0]:
return
m, n = len(matrix), len(matrix[0])
col0, row0 = False, False
# check row 0 and col 0
for i in ... |
8d2f04b6eb3c08f041c626d3d8f7a03b8b78197f | up824/crackingTheCodingInterview | /4.6 Successor.py | 696 | 3.578125 | 4 | # 4.6 Successor in-order successor in BST, each node has a link to its parent
class TreeNode(object):
def __init__(val):
self.val = val
self.left = None
self.right = None
self.parent = None
def successor(root):
if not root:
return root
if root.right:
... |
e0e2fc46b1c82760fc16ae7e4e1c628068e19fe7 | Greenlamp2/TP_Algos | /Ex2.5/Main.py | 419 | 3.65625 | 4 | def pair_impair(numbers, size):
if(size >= 0):
n = len(numbers) - size - 1
if(numbers[n] % 2 == 0):
print(numbers[n], end=" ")
pair_impair(numbers, size - 1)
else:
pair_impair(numbers, size - 1)
print(numbers[n], end=" ")
if __name__ == "__mai... |
048cd72fd1f5e248ce1b2b4fb905004772f89516 | izhenka/INF3331 | /assignment4/integrator_comparison.py | 873 | 3.609375 | 4 | from integrator import *
from numba_integrator import *
from numpy_integrator import *
import math
import numpy as np
answer = 2
N=1E+5
print("=======Endpoint:=======")
result_integrator = integrate(math.sin, 0, math.pi, N)
result_numpy = numpy_integrate(np.sin, 0, math.pi, N)
print("result_integrator: {}\n result_n... |
11ffbd2aaf6b50aa344d95d9c316829f4dfd03c1 | himani007/pygame_one | /one.py3 | 812 | 3.515625 | 4 |
import pygame
pygame.init()
win = pygame.display.set_mode((500,500))
pygame.display.set_caption("Hola Gameos")
x = 250
y = 450
width = 40
height = 60
vel = 5
#mainloop:
run = True
while run:
pygame.time.delay(100)#this is miniseconds!
#checking events.....
for event in pygame.event.get():
if event.type ==py... |
4e7618750c092d9bbdb8e4cee1ece9eb35d86338 | TiffanyChou21/University | /Junior/COSC0023-Py/Exercise/平方根.py | 286 | 3.921875 | 4 | #1712991 周辰霏 平方根
def sqrt(x):
result = 1.0 #取最小之后迭代
while abs(result**2-x)>0.1: #整数即可所以精度0.1必然可以
result=(result+x/result)/2 #x=(与x轴交点+x/与x轴交点)/2
return int(result)
x=eval(input())
print(sqrt(x)) |
b7854d1ea238b851a504d6a3e0634a29a6a49a84 | TiffanyChou21/University | /Junior/COSC0023-Py/Exercise/翻转数字.py | 687 | 3.59375 | 4 | #1712991 周辰霏 翻转数字
def reverse(num):
result=0 #%/方法
pos=True #标记正负
if num==0: #0
return 0
elif num<0: #提取负号
pos=False
num=-num
while num!=0: #!=0前一直先取余再整除
result=result*10+num%10
num=int(num/10)
if pos==False: #恢复负号
... |
194e82ae7d2fe5d3a671dee0b16e1537cbc2e771 | nmahmud/Statistical_Learning_760 | /Log_Reg_SGD.py | 1,643 | 4.15625 | 4 | # Logistic Regression using Stochastic Gradient Descent
# Not a homework
#%%
# Logistic Regression using Stochastic Gradient Descent
import pandas as pd
from math import exp
# Need a dataset to start using functions below
# Example Dataset
dataset = pd.read_csv('/Users/kevin/Desktop/simulated_data.csv')
dataset =... |
6e969766d7f27e38af5525661c8bfcb8da6d4ad3 | morecallan/python-basics | /classes/classes.py | 663 | 4.3125 | 4 | # 9.1: Restaurant
class Restaurant():
""" Defining a model of a restaurant """
def __init__(self, name, type_of_cuise):
""" Initialize name and type of cuisine of restaurant. """
self.name = name
self.type_of_cuise = type_of_cuise
def describe_restaurant(self):
""" Prints ... |
42501ddeaa1bb61cb7030450861eca719195a09a | shark2302/Python | /Task1/venv/Include/Task.py | 360 | 3.859375 | 4 | def loop(list, n) :
if(n > 0):
for i in range(n) :
list.insert(0, list.pop())
elif(n < 0) :
for i in range(abs(n)) :
list.append(list.pop(0))
return list
list = [int(i) for i in input('Введите элементы списка \n').split()]
n = int(input('Введите n : \n'))
print(lo... |
0172b0bc0932840603e9f7da51844684dce5b762 | HussainiLab/hd_direction_testing | /smooth.py | 862 | 3.875 | 4 | def smooth(array, window):
"""
Smooths an array over a specified window by taking a boxcar average approach
parameters:
array: 1D array values
window: window size of averaging. If window = N, we average over 'N' elements at a time.
... |
1ea6b88ef13ed20a72b2efcfd326a823a79d6208 | YXMforfun/standard-library | /product.py | 1,106 | 4.46875 | 4 | """
itertools.product(*iterables, repeat=1)
Cartesian product of input iterables.
Equivalent to nested for-loops in a generator expression. For example, product(A, B) returns the same as ((x,y) for x in A for y in B).
The nested loops cycle like an odometer with the rightmost element advancing on every iteratio... |
f6948515227fb13607180533cd4a0e34f26755f7 | Leduin-Abel/Python | /test15_continue_pass_else.py | 408 | 4.0625 | 4 | for letra in "Python":
if letra=="h":
#se salta el resto del bucle y va a la siguiente iteración
continue
print(letra)
#pass ignora lo que sigue
email=input("meta su email mi fai: ")
for i in email:
if i=="@":
arroba=True
break;
#diferente del else del if, entra una vez qu... |
39ace90dfac56f313a06c9bb80be74c087de18f8 | Leduin-Abel/Python | /test24_serializacion.py | 386 | 3.609375 | 4 | import pickle
#creación archivo bin
nombres=["Pedro", "Ana", "Juan", "Andres"]
arch_bin=open("lista_nombres", "wb")#wb es escritura binaria
pickle.dump(nombres,arch_bin)#recibe la información a echar y el archivo
arch_bin.close()
del(arch_bin)
#rescate archivo binario
text=open("lista_nombres","rb")#rb es lectura ... |
a2c9e5213d93fac07414f1dd4c4b2b331d1b4d15 | Leduin-Abel/Python | /test20_herenciap2.py | 971 | 3.75 | 4 | class persona():
def __init__(self,nombre,edad, lugar_residencia):
self.nombre=nombre
self.edad=edad
self.lugar_residencia=lugar_residencia
def descripcion(self):
print("Nombre: ", self.nombre, " Edad: ", self.edad, " Residencia: ", self.lugar_residencia)
class E... |
09e02047737761001f2bc8dd061f060ac7ca4e91 | Leduin-Abel/Python | /prac8.py | 367 | 3.875 | 4 | print("Ingrese su contraseña, recuerde que debe tener mas de 8 caracteres y no puede tener espacios en blanco")
contr=input("Ingrese su contraseña: ")
t=0
cont=0
for i in contr:
cont=cont+1
if i==" ":
print("Contraseña erronea")
t=1
if cont<8 and t==0:
print("Contraseña erronea")
elif cont... |
bf0896572c69c47137cf251c9a96b23f9fdb8e38 | Leduin-Abel/Python | /test11_tupla.py | 794 | 4.1875 | 4 | #Tupla=lista no modificable, pero permite el index
#Van con parentesis
tup=("P",2,13,99)
#Permite hacer que una tupla se vuelva lista
A=list(tup)
#Las listas se imprimen con parentesis, las listas con corchete
print(A)
print(tup)
#Permita hacer una lista en una tupla
B=("P",8,5,109,5)
tup2=tuple(B)
print(B)
print(... |
2f566139f0c6efa761930d84442184a8b8d89271 | beevageeva/tcomp | /testdata.py | 1,711 | 3.5 | 4 | import numpy as np
import matplotlib.pyplot as plt
from math import sqrt
data = np.loadtxt("datafit1.dat")
x = data[:,0]
y = data[:,1]
yerr = data[:,2]
exp = True #a0*exp-(a1*x + a2*x**2 + ... am * x**m) else a0 + a1 * x + ... am * x**m in function poly1d the order is reversed
def calculateDelta(m):
if(exp):
... |
c8a881997584cfe10e2e512480478f8294a8ec89 | Sana-mohd/functionsQuestions | /rect.py | 189 | 3.875 | 4 | def eligible_for_vote(user_age=int(input("enter your age"))):
if user_age>=18:
print("you are eligible to vote")
else:
print("your not elegible")
eligible_for_vote() |
ba3ea1fdd94490b802d9af11d319c6656191450d | Sana-mohd/functionsQuestions | /kbc.py | 2,224 | 3.96875 | 4 | question_list=["how many continents are there in the world?","what is the capital city of india?","who invented computer?","identify which place belongs to telangana?","identify which is proper noun?"]
options_list=[["four","nine","seven","eight"],["hyderabad","bhopal","sikkim","delhi"],["charles babbage","thomas","iss... |
e6ceec0824b5e657a30056e0197640d469cdf9d4 | Sana-mohd/functionsQuestions | /nested.py | 467 | 3.9375 | 4 | """def increment(number):
def inner_increment():
return number + 1
return inner_increment()
print(increment(10))
def generate_power(exponent):
def power(base):
return base ** exponent
return power(4)
print(generate_power(3))"""
def mean():
sample = []
def inner_mean(number,... |
23be7c1da94055fa0123913a7df66aea4adad035 | PhilMarsh/adventofcode | /2017/4.2.py | 272 | 3.546875 | 4 | import sys
def yield_valid_phrases(phrases):
for p in phrases:
if len(p) == len(set(str(sorted(w)) for w in p)):
yield p
phrases = [
line.split()
for line in sys.argv[1].splitlines()
]
print(sum(1 for _ in yield_valid_phrases(phrases)))
|
172278a627e38989960b67d47b52582a6d2841bf | zhangbo111/0102-0917 | /day11/03-描述符相关魔术方法.py | 1,886 | 3.984375 | 4 | # 定义描述符类
class Description:
def __init__(self):
self.name = '阮先生'
def __get__(self, obj, cls):
'''
触发时机:获取指定描述符描述的成员属性
self:表示当前描述符类的对象
:param obj: 是Emali类的对象e
:param cls: Email类本身
:return: 返回最终获取到的值 (e.username)
'''
# print(0, obj)
... |
a05d1f09dae620cf9b3f62ce4ed08c5bac1fc183 | zhangbo111/0102-0917 | /day13/07-生成器.py | 860 | 4.53125 | 5 | # 简单的生成器函数
def my_gen():
n = 1
print("first")
yield n
n += 1
print("second")
yield n
n += 1
print("three")
yield n
# 调用使用生成器的函数中含有yield关键字 表示返回一个生成器对象
generator1 = my_gen()
print(generator1, type(generator1))
# 当使用next函数的时候才能返回出值 而且还会运行我们的生成器函数
# 每次调用generator1,函数都会从之前的保存的状态继续执行 直... |
0c1a517b5475d4baa0eef58fad2c2403cd7f46e2 | zhangbo111/0102-0917 | /day01/09-运算.py | 419 | 3.609375 | 4 | # bool值运算 与运算
# 两边都是True返回True
result1 = True and True
print(result1)
# and两边只要有一个不为True 返回False
result2 = True and False
print(result2)
# 对比较运算做真假判断
result3 = 5 > 2 and 3 < 4
print(result3)
# 或运算 只要两边其中一个为True返回True
result4 = True or False
print(result4)
# 非运算 真变假 假变真
result5 = not True
print(result5)
|
6d72871979fdaea7ddd92e127598b4714a82f084 | zhangbo111/0102-0917 | /day04/12-列表推导式.py | 401 | 4.03125 | 4 | lst = []
# 负数也可以用range
for i in range(10):
lst.append(i)
# print(lst)
# 列表推导式的方式生成列表
lst1 = [i for i in range(10)]
# print(lst1)
# 把三的倍数加入到列表当中
lst2 = []
for i in range(1, 10):
# 三的倍数的余数为0
if i % 3 == 0:
lst2.append(i)
print(lst2)
lst3 = [i for i in range(1, 10) if i % 3 == 0]
print(lst3)
... |
4d9dc6ea2682b123c955d5543adfcc7b7a2e0387 | zhangbo111/0102-0917 | /day09/07-单继承.py | 1,524 | 3.71875 | 4 | class LiuBei:
# 属性
familyName = "刘"
firstName = "备"
sex = "男"
money = "$100"
country = "蜀国"
__wife = ("甘夫人","糜夫人","孙尚香")
# 方法
def say(self):
print("险些损我一员大将 怒摔阿斗")
# 非绑定类的方法
def drink(self):
print(self)
print("大碗喝酒 大块吃肉")
def walk(self):
... |
015fd0cf2d000ebd8b7e8ba6e98eeb27f2e7a989 | zhangbo111/0102-0917 | /day01/01-int.py | 339 | 3.703125 | 4 | # 这是打印输出代码
print("hello world")
# 这是一个整型
# 这是给一个变量num赋值为1
num = 1
# 打印变量会输出变量的值
print(num)
# 二进制转成十进制输出
num1 = 0b110
print(num1)
# 八进制转成十进制
num2 = 0o110
print(num2)
# 十六进制转十进制
num3 = 0x11
print(num3)
|
abff20891a42ec62a440f3e898a3f6aaff1532cf | zhangbo111/0102-0917 | /day09/02-练习.py | 1,234 | 3.625 | 4 | '''
声明一个人类
属性:性别,年龄,肤色,婚否
方法:吃饭,睡觉,思考,呼吸
在方法里面随便打印些东西
实例化张飞对象这些是实例化对象特有的属性:添加属性一张嘴,两个耳朵,姓名
实例化科比对象:添加一个他特有的功能 打篮球
'''
# 声明一个人类
class Human:
# 属性
sex = '男'
age = 18
skin = "black"
marry = "否"
# 方法
def eat_rice(self):
print('每天都要吃饭 真烦人')
def sleep(self):
print("早睡早起 有利于新晨... |
8c4842f26155cfcb4daadabde85a952731d7be11 | zhangbo111/0102-0917 | /就业/day09/02.冒泡排序.py | 1,212 | 3.796875 | 4 | # 3.冒泡排序:它重复地走访过要排序的数列,一次比较两个元素,
# 如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,
# 也就是说该数列已经排序完成
'''
第一次:i = 0 --> 7
found = False
j = 1 --> 7 - i = 7 2.当 i = 1 j = 1 --> 7 - 1 = 6 ... i = 6 j = 1 --> 1
i = 0
j = 1
lst[0] > lst[1]
[30, 13, 25, 16, 47, 26, 19, 10]
[13, 30, 25, 16, 47, 26, 19, 10] found = True
j = ... |
b9ed470f01606b1a6abe427f891ac0e52bb04f91 | zhangbo111/0102-0917 | /day13/13-with语句文件操作.py | 531 | 3.546875 | 4 | # with语句 可以不写文件关闭操作 自动执行这个操作
# 读取文件
# with open("./1.txt", 'r', encoding='utf-8') as f:
# result = f.read()
# print(result)
# # 写入文件 覆盖掉以前的所有内容
# with open("./1.txt", 'w', encoding='utf-8') as f:
# f.write("恰同学少年\n风华正茂\n书生意气\n挥斥方遒")
# 追加模式 不覆盖掉以前的内容 在原有的基础上添加
with open("./1.txt", 'a', encoding='utf-8')... |
a945730c624252507f9f2b9f42071b860ed13afb | zhangbo111/0102-0917 | /day10/07-__del__析构魔术方法.py | 664 | 3.734375 | 4 | # 析构魔术方法
class Movie:
name = "狗十三"
times = "1.5h"
def juqing(self):
print("青春期的叛逆")
def actor(self):
print("一个十三岁的小女孩")
def __del__(self):
'''
触发时机:当对象没有用的时候触发(手动删除或者全部执行完毕 回收内存)
功能:使用完对象回收资源
参数:至少接收self对象
返回值:无
'''
print("del析构... |
b952ae241d98fceb7e5ee4e6290312c6f921591e | zhangbo111/0102-0917 | /day10/08-使用析构魔术方法.py | 664 | 3.734375 | 4 | # 文件读取操作
class ReadFile:
def __init__(self, filepath):
print("=====文件打开====")
# 给self(file)对象 添加成员
# 打开文件 生成io文件操作对象 用于读取和关闭文件
self.fp = open(filepath, encoding='utf-8')
# 使用self.fp读取文件 并返回
def read(self):
print("=====文件读取=======")
result = self.fp.read()
... |
5ab14384edcffe688c297f2bbb04b821dcc81a06 | zhangbo111/0102-0917 | /day06/12-字典推导式.py | 489 | 3.734375 | 4 | dict0 = {}
for k, v in zip(['千', '山','鸟','飞', '绝'], ['万','径','人','踪','灭']):
dict0[k] = v
print(dict0)
# 字典推导式 可以减少代码的行数
dict1 = {k: v for k, v in zip(['千','山','鸟','飞', '绝'], ['万','径','人','踪','灭'])}
print(dict1)
# 集合推导式
lst = [1, 2, 3, 3, 4, 5, '李白', '李白']
# 集合推导式 是把列表中的元素 一个一个的放入集合中 重复的元素去掉
set1 = {i for i in lst}... |
0f34e677189a35e54545d13419ad88bbbb486bc2 | zhangbo111/0102-0917 | /day05/02-函数.py | 622 | 3.65625 | 4 | # def 表示声明一个函数 func表示函数名称
# ()是接收传参的地方 :是函数的开始
# 函数内面的内容需要缩进
def func():
'''
这是一个函数的注释,对函数进行解释的工具
说明这个函数是一个什么样的函数 具有哪些功能
当前函数是一个关于天气的函数
'''
print('今天天气晴朗,我没有穿秋裤')
print('今天冷吗')
print('南方一点都不冷,北方的人很嫉妒')
# 要启动和运行函数里面的代码 必须经过调用
# 调用函数 使用函数名,后面跟一个小括号
func()
|
298286a03f76b16d32a2475280b721e2c506e82a | zhangbo111/0102-0917 | /day01/04-strings.py | 1,090 | 4.125 | 4 | # 三种方式声明字符串
# 单引号声明字符串
str1 = 'hello world'
print(str1)
# 双引号声明字符串
str2 = "人生苦短 我用python"
print(str2)
# 三引号声明字符串
str3 = '''hello world, 我用python'''
print(str3)
# 三引号换行输出
str4 = '''
hello world
我用python
'''
print(str4)
# 单引号里面可以包含双引号
str5 = '鲁迅说:"阿甘是当代人的通病"'
print(str5)
# 双引号里面可以包含单引号
str6 = "三体:'这是一部很好看的科幻小说'"
print(st... |
1d2d476a6d4c10e7c542ceb09c2ca1172a0ecea5 | zhangbo111/0102-0917 | /day09/06-继承.py | 937 | 3.859375 | 4 | class Fruit:
water = "水甜"
def vitamen(self):
print("补充维他命")
# Apple继承了父类Fruit的所有成员
# 在子类的名称后面的括号内写上父类的名称
class Apple(Fruit):
'''
Apple是子类可以使用父类中的成员属性和成员方法
Fruit是Apple的父类
'''
color = 'red'
# 重载父类中的方法
def vitamen(self):
# 可以使用super来访问重载之后的父类中的方法
super().vitamen(... |
56c8eb022d3a65724fe3e8691d9d593c953b41ff | zhangbo111/0102-0917 | /day06/04-函数内部调用其他函数.py | 537 | 3.65625 | 4 | # 内层函数
def func2():
name = '秀芹大妹子'
# 查找内层函数的name
print("内层函数", name)
name = ['张大彪']
# func1表示外层函数
def func1(japen):
name = japen
func2()
print("外层函数:", name)
func1("岗村宁次")
# 查找全局变量的name
print("全局:", name)
'''
1、调用func1,执行func1,遇到func2的调用,
必须先执行完func2才会继续执行func1
2、全局调用func1,只有执行完func1才会继续执行全局变量中的... |
de4e88be724244147471451c21490c62bb0e59c3 | zhangbo111/0102-0917 | /就业/day09/03.快速排序.py | 2,260 | 3.875 | 4 | # 快速排序
# 通过一趟排序将要排序的数据分割成独立的两部分
# 其中一部分的所有数据都比另外一部分的所有数据都要小
# 然后再按此方法对这两部分数据分别进行快速排序
# 整个排序过程可以递归进行
# 以此达到整个数据变成有序序列。
'''
原理:
[9, 3, 5, 7, 8, 2, 6, 54, 1, 42,18,12]
以第一个数9为中心,大于9 放在右边
小于9的放在左边
[5,3, 1, 7, 8, 2, 6, 9, 18, 42,54,12]
再在[5,3, 1, 7, 8, 2, 6 ]中选择5为标杆,小于5的放左边,大于5的放右边
[18, 42,54,12] 以18为标杆 大于18的放右边,小于18的放左边
[2... |
a693f4db06d718614f9547ade28a6672f6a4bfe0 | cpe202fall2018/lab0-abarbieu | /planets.py | 273 | 3.796875 | 4 | def weight_on_planets():
earthWeight = int(input("What do you weigh on earth? "))
print("\nOn Mars you would weigh {!r} pounds.\nOn Jupiter you would weigh {!r} pounds.".format(earthWeight*0.38,earthWeight*2.34))
if __name__ == '__main__':
weight_on_planets()
|
44ca2d3fc53148aa5fab52bfb853bfba8900b273 | osamamohamedsoliman/Backtracking-2 | /Problem-2.py | 1,377 | 3.8125 | 4 | # Time Complexity :O(2^n)
# Space Complexity :O(n)
# Did this code successfully run on Leetcode : yes
# Any problem you faced while coding this : no
# Your code here along with comments explaining your approach
class Solution(object):
#check is string is palindrome
def ispalindrome(self,temp):
if not ... |
d10c2997f5264abbd3acb94c0a3d8ddee67b9d5c | ashishworkspace/python-dsa | /queue.py | 631 | 4.125 | 4 | class Queue:
def __init__(self):
self.queue = []
def enqueue(self, data): # used to inserst element at first position
# this means that when a new element is inserted in queue it will be at last of the queue
self.queue.insert(0, data)
def dequeue(self): # u... |
2f6cca278ff53ab4b93dba9711fa15e6ba848761 | adrianomucha/intro-programming | /assignment_6/python_a6.py | 777 | 3.8125 | 4 | import random
def get_random_direction():
direction = ""
probability = random.random()
if probability < 0.25:
direction = "west"
elif probability < 0.5:
direction = "north"
elif probability < 0.75:
direction = "south"
else:
direction = "east"
return ... |
9f4ac81409f94c414b0d6a664735e0a87ad5a928 | Bastlifa/code-challenges | /palindrome_rearranging.py | 347 | 3.640625 | 4 | def palindromeRearranging(inputString):
odds = 0
char_dict = {}
for c in inputString:
if c in char_dict:
char_dict[c] += 1
else:
char_dict[c] = 1
for c in char_dict:
if char_dict[c] % 2 == 1:
odds += 1
if odds > 1:
return False
... |
324d4b6e3b8bcaf72f1e9fa6332b0412edd9bb9d | ichiragkumar/page | /final2.py | 23,370 | 3.53125 | 4 | from tkinter import *
from tkinter import messagebox
from tkinter import ttk
root=Tk()
root.title("main page ")
import psycopg2
conn = psycopg2.connect(
database ="suppliers",
user="postgres",
password="chirag2020",
host="localhost",
port="5432"
)
# for create acoount
password=StringVar()
usern=St... |
778996c3a7a4bf96aa4b987a62c8faedd0f8ce70 | Astro-ibha/Code-Practice | /python exercise/practise.py | 263 | 3.53125 | 4 |
x = input('Enter the numbers into the array with spaces between: ')
l=list(map(int,x.split(' ')))
print(l)
x=len(l)
for i in range(x-1):
for j in range(1,x-i):
if l[j-1]>l[j]:
k=l[j]
l[j]=l[j-1]
l[j-1]=k
print(l)
|
45c44219b865ade6bb18f24e5e054c885f104c14 | fzoryf/Python | /W4Python.py | 1,595 | 4.03125 | 4 | #Question 0
def hiw():
print ( "Hello World!" )
hiw()
#Question 1
def hk5():
for hk5 in range ( 5 ) :
print ( "hello kitty is angry" )
hk5()
#Question2
number = int (input ( "Find out how angry hello kitty is by typing a number" ))
print ( "hello kitty is" )
def hk5():
for hk5 in range ( number... |
5ac318bdbeea9963bf2cac321d439756670694b6 | PiyushKumar0/tathastu_week_of_code | /day6/program2.py | 331 | 3.84375 | 4 | #https://www.linkedin.com/in/piyushkumar0/
import random
size = int(input("Enter size of list: "))
ls = []
for i in range(size):
ls.append(random.randint(0,1))
print("Original list:", ls)
ls2 = []
for i in ls:
if i==0:
ls2.append(i)
for i in ls:
if i==1:
ls2.append(i)
print("Sorted li... |
437ac6d803541b3535eaf96ccc3bab5e66f5a846 | PiyushKumar0/tathastu_week_of_code | /day5/program1.py | 156 | 3.703125 | 4 | #https://www.linkedin.com/in/piyushkumar0/
num = int(input("Enter a number: "))
print("Number after replacing all 0 with 5: " + str(num).replace('0','5'))
|
09b3c36ef5f86ce957f633a6437ea24baec80930 | PiyushKumar0/tathastu_week_of_code | /day5/program5.py | 434 | 4.15625 | 4 | #https://www.linkedin.com/in/piyushkumar0/
def sort(List):
odd = []
even = []
for x in List:
if x % 2 == 0:
even.append(x)
else :
odd.append(x)
return sorted(odd, reverse = True) + sorted(even)
size = int(input("Enter size of array: "))
li = []
for i in rang... |
d270c9867debc6923da1764fc70708a433c2cac7 | PiyushKumar0/tathastu_week_of_code | /day3/program1.py | 157 | 3.515625 | 4 | #https://www.linkedin.com/in/piyushkumar0/
string = input("Enter a string: ")
print("\nOriginial string:", string)
print("Reversed string:", string[::-1])
|
d85255927a481effc8a4e22134f5e0a1818dce6e | yj435545879/test | /section5.py | 2,834 | 3.890625 | 4 | import math
class Point:
def __init__(self,x,y):
self.x = x
self.y = y
def distance(self,p2):
return math.sqrt((self.x-p2.x)**2+(self.y-p2.y)**2)
class Polygon:
def __init__(self,points=[]):
self.vertices = []
for point in points:
if isinsta... |
3e0d6d21b37a81b63f62be2aeff802b9bbfe4516 | weizhaopeng/python_test | /test/speculate_number.py | 626 | 3.796875 | 4 | import random
def hint(answer, speculation):
if speculation > answer:
print("猜大了")
return 1
elif speculation < answer:
print("猜小了")
return -1
else:
print("猜对啦!!")
return 0
if __name__ == "__main__":
answer = random.randint(1, 100)
speculationResul... |
dd982fa232df9a4c4a6beedd090355f9e630858b | weizhaopeng/python_test | /test/list_test.py | 445 | 3.953125 | 4 | if __name__ == "__main__":
list1 = [1, 2, 6, 9, 3]
list2 = [1, 3, 5, True, "nihao", (2, 3)]
list2.reverse()
print(list1 + list2)
print(list1[2:])
print(list2)
list2.remove(5)
print(list2)
print(list2.pop(1))
del list2[-1]
print(list2)
list1.sort(reverse=True)
print(l... |
d219a4b3d73c51ae978abe085906f4d12b0d9594 | PilarNew/pybasic | /07-ejercicios/ejercicio5.py | 458 | 4.0625 | 4 | """
Ejercicio 5
- Hacer un programa que muestre todos los números entre dos números que ingrese el usuario
"""
numero_1 = int(input("Ingrese primer número: "))
numero_2 = int(input("Ingrese segundo número: "))
contador = numero_1 + 1
if numero_1 < numero_2:
contador = numero_1 + 1
while contador < numero_2:
... |
73df49877402e80469de6a47eba1aaad2c51abee | PilarNew/pybasic | /07-ejercicios/ejercicio6.py | 392 | 4.125 | 4 | """
Ejercicio 6
- Mostrar todas las tablas de multiplicar del 1 al 10.
- Mostrando el título de la tabla y luego
"""
for titulo in range(1,11):
print("################################")
print(f"######TABLA DEL {titulo} #######")
print("################################")
for numero in range(1,11):
... |
29a251154f44e6e7b82a0915920238bd8c9d0647 | PilarNew/pybasic | /07-ejercicios/ejercicio9.py | 292 | 4.09375 | 4 | """
Ejercicio 9
- Hacer un programa que pida números al usuario indefinidamente hasta meter el número 111
"""
contador = 1
while contador < 100:
numero = int(input("Introduce un número: "))
if numero == 111:
break
else:
print(f"Has introducido el {numero}") |
40c85ff2367babaf1608fdb7f57900cfa3a47ecb | PilarNew/pybasic | /03-operadores/aritmeticos.py | 423 | 4.0625 | 4 | # Operadores Aritméticos
numero1 = 78
numero2 = 2 # Operador asignación =
resta = numero1 - numero2
multiplicacion = numero1*numero2
division=numero1/numero2
resto = numero1 % numero2
print("**************CALCULADORA*****************")
print(f"La suma es: {numero1+numero2}")
print(f"La resta es {resta}")
print("La m... |
ffd74ea708d6376f218f542b87da7d9980fc87ff | PilarNew/pybasic | /08-funciones/predefinidas.py | 965 | 4.1875 | 4 | nombre = "Pilar"
# Funciones generales
print(type(nombre))
# Detectar el tipado
comprobar = isinstance(nombre,int)
if comprobar:
print("Esta variable es un string")
else:
print("Esta variable NO es un string")
if not isinstance(nombre,float):
print("Esta variable NO es un número decimal")
# Limpia... |
b544eae97ca9634cc9fdf028f82f756445d77121 | gabo19/rspls | /rspls.py | 1,865 | 4.125 | 4 | # rock, spock, paper, lizard, scissors
# rock = 0
# spock = 1
# paper = 2
# lizard = 3
# scissors = 4
import random
# Welcome and rules
print 'Welcom to Rock-scissors-paper-lizard-Spock game!\nFor rules type "rules".\nTo quit type "q"/"quit".\n'
rspls_rules = '''
\tScissors cut paper
\tPaper covers rock
\tRock crush... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.