blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
bab5047463f263311de080b527a017f76ea9680b | ksaubhri12/ds_algo | /practice_450/graph/05_cycle_undirected_graph.py | 732 | 3.640625 | 4 | def is_cyclic(graph: [[]], v):
visited = [False] * v
for i in range(v):
if not visited[i]:
if dfs_util(i, visited, graph, -1):
return True
return False
def dfs_util(vertex: int, visited: [], graph: [[]], parent: int):
visited[vertex] = True
for neighbour in gra... |
a7fe6382d8f6f8bdcf40227bfbdcc8ddee87929d | SoftwareDojo/Katas | /Python/Katas/WordWrap/wordwrap.py | 600 | 3.625 | 4 | class wordwrap(object):
def wrap(text, length):
result = ""
currentLength = 0
for value in str(text).split(" "):
if currentLength > 0:
result += wordwrap.__newline_or_whitespace(currentLength, len(value), length)
currentLength += len(value)
... |
d0dba32ca24ebce454a8c35c6d936274741c896d | MrNullPointer/AlgoandDS | /Udacity_NanoDegree/Tree_Revisited/Binary_Search_Tree.py | 9,222 | 4.15625 | 4 | # this code makes the tree that we'll traverse
from collections import deque
class Queue():
def __init__(self):
self.q = deque()
def enq(self, value):
self.q.appendleft(value)
def deq(self):
if len(self.q) > 0:
return self.q.pop()
else:
return Non... |
839d70176ecfb9f5d9edf407e541266c8f6b9b17 | petushoque/spa-django-rest-nuxtjs | /section3lesson1step4.py | 662 | 3.71875 | 4 | # решение с подключением дополнительной библиотеки
import roman;
s = input()
print(roman.fromRoman(s))
# готовая функция для перевода
def romanToInt(s):
result=0
f={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
i=0
while i < len(s)-1:
if f[s[i+1]] > f[s[i]]:
... |
37e9440da26eb15bd1ea1a74b329e3f220b71891 | AdarshNamdev/Python-Practice-Files | /Constructor&Method_Overriding_Super().py | 1,391 | 4.03125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 20:02:15 2021
@author: adars
"""
class father(object):
def __init__(self, name, age, prop):
self.prop = prop
self.name = name
self.age = age
def getpropdetails(self):
print("Father's Property: ", self.prop)
cla... |
ab091a745c0a10c082ba1400d4156da47ed19823 | CauchyPolymer/teaching_python | /python_intro/24_recursion.py | 1,566 | 3.703125 | 4 | def func_1(): #function은 정의를 하고 call을 하여 재활용을 한다. 중요한 개념
#일반적으로는 함수가 있고 글로벌에서 함수를 불러서 쓰는데, 함수 안에서 함수를 call 할 수 있다.
print('hello')
def func_2():
func_1()
print('hello again')#func1이 끝나야 프린트 가능.
func_2
#top-level -> func_2 -> func_1
#function call chain/ function call stack
#call stack 이 넘치게 되면 에러가 남.
prin... |
77c87985e22259462264afcfb4dc85d61617226e | AECassAWei/dsc80-wi20 | /discussions/07/disc07.py | 958 | 3.765625 | 4 | import requests
def url_list():
"""
A list of urls to scrape.
:Example:
>>> isinstance(url_list(), list)
True
>>> len(url_list()) > 1
True
"""
url_list = []
for num in range(0, 26):
url_list.append('http://example.webscraping.com/places/default/index/' + str(num))
... |
4f335b651346f568077bae94423995055976c730 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/meetup/92908cd0e4a24bf7986d6688dbd0c57a.py | 1,706 | 3.765625 | 4 | from datetime import date, timedelta
def meetup_day(year, month, weekday_name, happens):
weekday_number = __to_weekday_number__(weekday_name)
if happens == '1st':
return __first__(year, month, weekday_number)
elif happens == 'teenth':
return __teenth__(year, month, weekday_number)
elif happens == '... |
e9aafdc489d49887636a445d1f0276c0fb5e8c79 | SaiSarathVattikuti/practice_programming | /s30-problem1.py | 584 | 3.65625 | 4 | import sys
class Node:
def __init__(self,value=None):
self.value=value
self.right_child=None
self.left_child=None
def validate_Bst(root,min=-sys.maxsize,max=sys.maxsize):
if root==None:
return True
if(root.value>min
and root.value<max
and valid... |
ca9cd34a1999a714dc4902e9dd32a5f59d997376 | ger-hernandez/UTP-backup | /week3/string3.py | 441 | 3.765625 | 4 | #
#Solicitar el ingreso de una clave por teclado y almacenarla en una cadena de caracteres.
#controlar que el string ingresado tenga entre 10 y 20 caracteres para que sea válido,
# en caso contrario mostrar un mensaje de error.
def clave():
c = input('ingrese una clave entre 10 y 20 caracteres de largo: \n')
... |
c310fb05ea9c5ed702a0f61dc6ef137518282ff9 | jxie0755/Learning_Python | /ProgrammingCourses/MIT6001X/week2/function_3.py | 648 | 3.984375 | 4 | def f(y):
x = 1
x += 1
print(x)
x = 5
f(x)
print(x)
# f(5), 重新定义x=1, 然后x+1=2
# 所以函数输出就是2
# 但是本身的print(x)依然输出5,因为x=2在函数内,不能影响函数外
def g(y):
print(x)
print(x + 1)
n = 5
g(x)
print(x)
# g(5)首先寻找x,发现函数内没有,所以找函数外发现x=5
# 函数输出5和6
# print(x)依然不受函数影响还是输出5
def h(y):
x = x + 1
x = 5
h(x)
print(x)
# h... |
a1895a28eb09357b6e91d3045a5472671835ea10 | daniel-reich/turbo-robot | /HBuWYyh5YCmDKF4uH_4.py | 1,366 | 4.15625 | 4 | """
An **almost-sorted sequence** is a sequence that is **strictly increasing** or
**strictly decreasing** if you remove a **single element** from the list (no
more, no less). Write a function that returns `True` if a list is **almost-
sorted** , and `False` otherwise.
For example, if you remove `80` from the first... |
5d262e371c6b75e199d5de61cb953f1c157e4fe7 | rajatmishra3108/Daily-Flash-PYTHON | /25 aug 2020/prog5.py | 406 | 3.9375 | 4 | from time import clock
start = clock()
history = {'French Revolution' : 1789, 'Industrial Revolution' : 1760, "Greek Revolution" : 1821, "Serbian Revolution" : 1748}
n1 = input("Enter first event\n")
n2 = input("Enter second event\n")
for i in history :
if n1 == i:
year1 = history[i]
elif n2 == i:... |
87dd046d4ce79d4d8b2da655375889a6fc78d6a8 | FawenYo/NTU_Programming-for-Business-Computing | /Assistant/1029/problem2.py | 395 | 3.78125 | 4 | import math
def main():
mode = int(input())
number = int(input())
answer = calculate(mode=mode, number=number)
print(answer)
def calculate(mode, number):
if mode == 1:
result = math.log(number, 2)
elif mode == 2:
result = math.log(number, math.e)
else:
result = nu... |
06229817c1120a8b213f0eee2619800f85587bb8 | liyingying1105/selenium7th | /day4/CsvFileManager3.py | 1,012 | 3.59375 | 4 | import csv
#每个测试用例对应着不同的CSV文件,每条测试用例都会打开一个CSV文件,所以每次也应该关闭该文件
class CsvFileManger3:
@classmethod
def read(self):
path=r'C:\Users\51Testing\PycharmProjects\selenium7th\data\test_data.csv'
file=open(path,'r')
try: #尝试执行一下代码
#通过CSV代码库读取打开的CSV文件,获取文件中所有数据
data_table=csv.r... |
638fa04ea7e66daa2202a0ed60f67d64a2077fb3 | Yellow-Shadow/SICXE | /LinkingLoader2021/LinkingLoader/pass2.py | 4,795 | 3.515625 | 4 | import objreader
def hexDig2hexStr(hexDig, length):
hexDig = hexDig.upper()
hexStr = hexDig[2:] # 0xFFFFF6 => FFFFF6
for i in range(0, length - len(hexStr)): # 位數不足補零
hexStr = '0' + hexStr
return hexStr
# Hex String => Dec Int Digit
def hexStr2decDig(hexStr, bit... |
97651d29357feb05578d80921320d53e1b07bd92 | doraemon1293/Leetcode | /archive/592. Fraction Addition and Subtraction.py | 943 | 3.75 | 4 | import re
class Solution:
def fractionAddition(self, expression):
"""
:type expression: str
:rtype: str
"""
def gcd(a, b):
while a % b:
a, b = b, a % b
return b
def add(a, b, c, d):
x = a * d + b * c
... |
afd7678af6043e8098f508bd56a3aa912ff848ce | GMBAMorera/OC_projet_3 | /Labyrinths.py | 2,361 | 3.578125 | 4 | from random import randrange
from constants import OBJECT_TILES
from Exceptions import InvalidLabyrinth
class Labyrinth:
def __init__(self, lab):
self.path_to_array(lab)
self.column_length = len(self.lab)
self.row_length = len(self.lab[0])
self.compare()
self.haystacking()... |
3e79e6ebd06b6d665c798279a6a4b29f09f33507 | emilea12/Python- | /Panda_Tutorial.py | 1,884 | 4.5625 | 5 | import pandas as pd
import numpy as np
#The primary data structures in pandas are implemented as two classes:
#DataFrame, which you can imagine as a relational data table, with rows and named columns.
#Series, which is a single column. A DataFrame contains one or more Series and a name for each Series.
california_... |
e26204aaed58da7c765ef06c2be8f9931e837d68 | bjfletc/Learning-Python-4th-Edition | /Chapter 4, Introducing Python Object Types/userDefinedClasses.py | 759 | 3.828125 | 4 | '''
We’ll study object-oriented programming in Python—an optional but powerful feature
of the language that cuts development time by supporting programming by customization—
in depth later in this book. In abstract terms, though, classes define new types
of objects that extend the core set, so they merit a passing glan... |
0fda531a0602f48c6ae385baeeb358542b211555 | runningshuai/jz_offer | /33.丑数.py | 1,621 | 3.890625 | 4 | """
题目描述
把只包含质因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含质因子7。
习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个丑数。
思路:
从1开始,我们只用比较3个数:u2:用于乘2的数,u3:乘3的数,u5:乘5的数,然后取最小的数
最小的数取完之后,更新当前的数,例如u2 * 2
一直循环,直到取N个
"""
class Solution:
def GetUglyNumber_Solution(self, index):
# write code here
if index < 7:
retur... |
b84cda4022254d68719da575fbb73fa14704ef6f | vkagwiria/thecodevillage | /Python week 1/Python day 4/exercise4.py | 213 | 4.1875 | 4 | num=int(input("Insert your number here: "))
numsquare = num**2
if (num>10):
print(" The square of your number {} is {}.".format(num, numsquare))
else:
print("Your number needs to be greater than 10.") |
220eb07259efae7dcfead7551527549a11a14e21 | RichLuna/g-challenge | /g-challenge.py | 2,126 | 3.5625 | 4 | #Abrimos el documento con el numero e. Puedes ingorar completamente esta parte
def open_e():
e_file = open("euler.txt")
e = e_file.read()
return e
#########################################################################
#Start challenge here
########################################################################
... |
4c0a69994f609c42e8aafa21172185da9f8ef352 | shunjizhan/Gradient-Descent | /gd.py | 3,336 | 3.625 | 4 | import numpy as np
from random import randint
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from sklearn.preprocessing import normalize
def n(v):
return normalize(v[:, np.newaxis], axis=0).ravel()
class GradientDescent:
def __init__(self):
self.n, self.d = 6000, 100
self... |
6aee4a08f9364faad53bffab4a9ebbf90f3cc012 | Untamanei/Sudoku-AI-Problem | /sudoku4.py | 5,761 | 4.15625 | 4 | '''
Exercise4.1: Apply Constraint Propagation to Sudoku problem
Now that you see how we apply Constraint Propagation to this problem, let's try to code it!
In the following quiz, combine the functions eliminate and only_choice to write the function reduce_puzzle,
which receives as input an unsolved puzzle and appli... |
c7896ffcdf6dc1fd41863efa3dcf6d280fb32cbc | mapleeit/Python | /anti_vowel_v1.py | 194 | 4 | 4 | def anti_vowel(text):
items = ['a', 'A', 'E', 'e', 'i', 'I', 'o', 'O', 'u', 'U']
for item in items:
if item in text:
text = text.replace(item,'')
return text
|
7e53bad9d9719ddf01204d65e741721ab1df32bc | davll/practical-algorithms | /LeetCode/99-recover_binary_search_tree.py | 857 | 3.71875 | 4 | # https://leetcode.com/problems/recover-binary-search-tree/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
def inorder(root):
if not root:
return
yield from inorder(root.left)
yield r... |
7c400216f0d7687b4cb15a031ad7f392f9526376 | Murgowt/hacktoberfest-2021 | /python/palindrome_checker.py | 597 | 4.21875 | 4 | '''
Palindrome checker by python
'''
#Palindrome check for String inputs.
def palindrome (s):
r=s[::-1]
if(r==s):
print("Yes It is a palindrome")
else:
print("No It is not a palindrome")
s = input("Enter a String to check whether it is palindrome or not")
palin... |
30b1aaeb35332f3dd2e372292a323f545a047147 | tomboxfan/PythonExample | /exercise/014_3/P014Solution2.py | 949 | 3.96875 | 4 | # From Yixuan / Natalie
import math
def factorise(n):
print(n, '=', end = ' ')
m = int(math.sqrt(n)) + 1
# this is not possible
# origianl = a * b * c * d * e
# sqr root < d and e
#
# if it is prime, then output should be n = 1 * n
is_prime = True
# loop from 2 to square ro... |
e1959421c27e002400728fc541c84c1701866134 | adityapande-1995/DSA | /LinkedLists/main.py | 1,788 | 4.03125 | 4 | #!PYTHON3
class Node:
def __init__(self, num):
self.content = num
self.prev = None
self.next = None
def addNext(self, other):
self.next = other
other.prev = self
def addPrev(self,other):
self.prev = other
other.next = self
class LL:
def... |
3c76d16a9bda2041a0f8a5a9a4f23eb463bf215d | CrisofilaxDives/Python-Practica | /practicaspropias2.0.py | 4,525 | 3.96875 | 4 | # Tipos de datos y condicionales
str_1 = "Pescado"
str_2 = "Mariscos y cefalopodos"
int_1 = 56
int_2 = 89
flt_1 = 1.9
flt_2 = 2.5
bool_f = False
none_1 = None
list_1 = list(("Azul", "Verde", "Morado"))
list_2 = list(range(1,4))
tuple_1 = tuple((12, 13, 14))
tuple_2 = tuple((20,))
set_1 = {"Perros", 3, Tr... |
7301647ec241cedae05a63daeffb6417f45dcc91 | lalitkapoor112000/Python | /Removing Data from list.py | 215 | 3.953125 | 4 | fruits=['apple','orange','grapes','mango','peach']
fruits.remove('orange')
print(fruits)
fruits.pop()
print(fruits)
del fruits[1]
print(fruits)
fruits.pop(1)
print(fruits)
for i in fruits:
print(i)
|
83a04887f1aa5f422e446bcbc3a204663c264c4c | vincek59/qcm-exo7 | /bin/braces.py | 1,550 | 4.0625 | 4 |
#!/usr/bin/env python3
from re import *
# Find the first well-balanced string in brace
# Usage : find_braces(string)
# Example find_braces("Hello{ab{c}d}{fg}"") returns "ab{c}d", "Hello{", "}{fg}"
def find_braces(string):
"""return the first string inside a well-balanced expression with {}"""
res = ""
... |
de42580f9b5234004f293bba16ed85fd37946939 | SunatP/Python | /Hello World/Hello world.py | 176 | 3.84375 | 4 | print("Hello World")
print(2+2)
name = 'chawna'
test = name +' '+ "Hi"
print(test)
print(name[3])
print(name[0:3])
a = b = pow(2,5)
print(a+b)
a = 5
a += 5
b = 10
print(a==b) |
a22fc4ecde52331b464b7c5e7a09de0e43a69621 | manuelF/Encuestas2015 | /ways.py | 928 | 3.671875 | 4 | def linspace(a,b,step):
res =[]
while(a<=b):
res.append(a)
a+=step
return res
def solve():
fun = linspace
step = 1
a=set(fun(0,50,step)) #macri
b=set(fun(0,50,step)) #massa
c=set(fun(0,50,step)) #scioli
d=set(fun(0,20,step)) #binner
e=set(fun(0,0,step)) #otro
f=set(fun(0,0,step)) #otro
... |
52969bf9e2292f7e5feb4d047c1e2c0c204bcdc3 | Ratnakarmaurya/Data-Analytics-and-visualization | /working with data 02/10_Renaming_index.py | 1,109 | 4.125 | 4 | import numpy as np
import pandas as pd
from pandas import Series, DataFrame
# Making a DataFrame
dframe= DataFrame(np.arange(12).reshape((3, 4)),
index=['NY', 'LA', 'SF'],
columns=['A', 'B', 'C', 'D'])
dframe
# Just like a Series, axis indexes can also use map
#Let's use... |
c104ec2c8725418a90a626d011c72429af1f1cbd | theishansri/Python_Codes | /Python/segment_tree_1.py | 2,554 | 3.65625 | 4 | # import sys
# def segment_tree(tree,a,index,start,end):
# if(start>end):
# return
# if(start==end):
# tree[index]=a[start]
# return
# mid=(start+end)//2
# segment_tree(tree,a,2*index,start,mid)
# segment_tree(tree,a,2*index+1,mid+1,end)
# left=tree[2*index]
# right=t... |
f52b7cafb68a4e6c33d0a618ce785847c02e568e | shubham14/Coding_Contest_solutions | /target_difference.py | 1,481 | 3.796875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 29 10:12:55 2018
@author: Shubham
"""
# Python program to find if there are
# two elements wtih given sum
# function to check for the given sum
# in the array
def cutSticks(lengths):
count_sticks = []
while len(lengths) != 0:
count_sticks.append(... |
37162fca54b1643080d961e1bec751e782deed36 | pranavchandran/Key-Exploit | /exploit/generator_exp.py | 776 | 3.578125 | 4 | import random
import string
def excel_format(num):
res = ""
while num:
mod = (num - 1) % 26
# res = chr(65 + mod) + res
num = (num - mod) // 26
return res
def full_format(num, d=3,stringLength=7):
letters = string.ascii_uppercase
random_string = ''.join(random.cho... |
b0dd784ab9bc2790b2d4591dc41d156d0d9b25f0 | 8sagh8/Python | /Isha_Prayer_Qaza_Time/isha_qaza_time.py | 2,157 | 3.75 | 4 | # -*- coding: utf-8 -*-
"""
title: ISHA QAZA TIME CALCULATOR
created by: SAMMAR ABBAS
"""
def hr_mint(time):
pos = time.find(":")
hr = int(time[0:pos])
mint = int(time[pos+1:])
lst = []
lst.append(hr)
lst.append(mint)
return lst
def accurate_time(time, event):
new_time = ""
... |
4b6ac6383a17d443ca59f24965af5c6a21f880fd | Anakinliu/PythonProjects | /book/others/test_for.py | 241 | 3.5 | 4 | # coding: utf-8
sf = [] # 空列表
for i in range(1, 11):
square = i ** 2
sf.append(square)
print (sf)
sf = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
print (min(sf)) # 最大值
print (max(sf)) # 最小值
print (sum(sf)) # 求和 |
bc1f037aa465d63247329b3639827e272bffcdf0 | caron1211/Computer-Vision-image-processing--exercises | /Ex1/ex1_utils.py | 9,346 | 3.609375 | 4 | """
'########:'##::::'##::::'##:::
##.....::. ##::'##:::'####:::
##::::::::. ##'##::::.. ##:::
######:::::. ###::::::: ##:::
##...:::::: ## ##:::::: ##:::
##:::::::: ##:. ##::::: ##:::
########: ##:::. ##::'######:
........::..:::::..:::......::
"""
... |
0711c87aa327a0c297060c145042cc4d3be85ed0 | abhi0987/DeepLearning-ML | /Hand_Written_digit_prediction/classify.py | 7,639 | 3.53125 | 4 | #import tensorflow and other libraries
import matplotlib.pyplot as plt
import os
import sys
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import pandas as pd
from scipy import ndimage
from sklearn.metrics import accuracy_score
import tensorflow as tf
from scipy.misc import imread
from P... |
ff3572f28a2492c6dad001c0b7064b85d51bf9e8 | pod1019/python_learning | /第3章 序列/my_dict/字典新增键值对.py | 795 | 3.625 | 4 | ''''''
'''
1、给字典新增“键值对”。①如果“键”已经存在,则覆盖旧的键值对;②如果“键”不存在, 则新增“键值对”。
'''
dict1 = {'name':'小白','age':18, 'job':'QA'}
dict1['age'] = 27 # ①如果“键”已经存在,则覆盖旧的键值对;
dict1['addr'] = '和平饭店' # ②如果“键”不存在, 则新增“键值对”
print(dict1)
'''
2. 使用update()将新字典中所有键值对全部添加到旧字典对象上。如果 key 有重复,则直接覆盖。
'''
dict2 = {'name':'小白','age':18, 'job':'QA'}
dic... |
4ec44b7c7dc24d2434e7d3bdd0c62141b4ae32ae | CeciliaPYY/road2beEngineer | /duNiang/binarySearchforSqrt.py | 2,741 | 3.890625 | 4 | # 问题:现在没有开根号这个运算符,你如何写一个函数,即 y^2 = x,
# 在已知 x 的情况下,求得 y 的值。
# 以下是我面试的时候写的伪代码,回来 run 了一下是跑不通的,
# 可能是递归没写好的关系
import numbers
def binarySearchforSqrt(start, end, num):
if not isinstance(num, numbers.Number):
return
elif num < 0:
return
elif num == 0:
return 0
elif num < 1:
... |
5b3c01a03cf8453d185bfefe378c1c9c2b2ad03a | league-python-student/level2-module0-dencee | /_01_file_io/_c_sudoku/sudoku.py | 10,698 | 4.1875 | 4 | """
Create a Sudoku game!
"""
import random
from pathlib import Path
import tkinter as tk
from tkinter import messagebox
# TODO 1) Look at the sudo_grids.txt file. There are multiple starting sudoku
# grids inside. Complete the function below with the following requirements:
# 1. Open the sudoku_grids_file file for... |
80848618b709bec18f0397f771209de5e5a19530 | yukan97/python_essential_mini_tasks | /004_Iterators_Generators/Task2.py | 306 | 3.9375 | 4 | def my_reverse(input_list):
step = -1
while -step <= len(input_list):
yield input_list[step]
step = step - 1
test_list = [1, 2, 3]
generator = my_reverse(test_list)
print(next(generator))
print(next(generator))
print(next(generator))
print(next(generator)) |
bb44506dc687761122e59ebb732560f35206cc4a | ordinary-developer/education | /py/m_lutz-learning_py-5_ed/code/part_04-functions_and_generators/ch_17-scopes/04-the_nonlocal_statement/main.py | 2,362 | 3.546875 | 4 | def example_1():
def tester(start):
state = start
def nested(label):
print(label, state)
return nested
F = tester(0)
F('spam')
F('ham')
def example_2():
def tester(start):
state = start
def nested(label):
nonlocal state
p... |
ec9a80d07436752997c94939effa009be6bbd554 | wasjediknight/python | /exercicios/week7/conta_primos.py | 597 | 3.625 | 4 | def EsteNumeroEPrimo(numero):
numeroDeDivisores = 0
for divisor in range(1, numero + 1):
if numero % divisor == 0:
numeroDeDivisores += 1
if numeroDeDivisores > 2:
return False
return True
def ContarNumerosPrimos(numeroInicial, numeroFinal):
quantidade... |
b703203ee52fde3d0f91d46b7824e746867699a8 | zdzjiuge/TestCode | /UnittestTest/demo_03.py | 512 | 3.8125 | 4 | """
unittest的测试结果
"""
import unittest
class TestCaseResultDemo(unittest.TestCase):
def test_01_pass(self):
# pass 所有代码都执行完了/断言通过
self.assertEqual(1, 1)
def test_02_failed(self):
# 断言失败了
self.assertEqual(1, 2)
def test_03_error(self):
# 代码报错了抛出了异常
... |
5a0be0d063b062975a0c9169d2ca89f915c26fc3 | archanadeshpande/codewars | /Sum of intervals.py | 1,856 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Write a function called sumIntervals/sum_intervals() that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only be counted once.
Intervals
Intervals are represented by a pair of integers in the form of an array. The first value of ... |
ea2db29b964f64e51d936af9ea3227a93e3230a9 | Arya16ap/c-1oo3oo1oo3 | /103/bar.py | 175 | 3.609375 | 4 | import pandas as pd
import plotly.express as px
#reading data from csv files
df = pd.read_csv("data.csv")
fig = px.line(df,x = "Country",y = "InternetUsers")
fig.show() |
88cdf9bb74cd720bf359a43ab3e5a054b5e6be1b | rubenspgcavalcante/python-para-padawans | /ep2/q3/main.py | 474 | 4.46875 | 4 | # coding=utf-8
# Faça uma função que receba um número n e que imprima uma pirâmide invertida de números:
# 1, 2, 3, ... n
# ...
# 1, 2, 3
# 1, 2
# 1
def piramide(altura):
# Recebe as larguras das linhas em ordem crescente
linhas = range(1, altura + 1)
# Porém, é utilzado a ordem invertida para a piramide... |
9be6f1bc1ff7ac8e242109c7ac3bfc95a4597628 | lucasgarciabertaina/hackerrank-python3 | /set/introduction.py | 307 | 4 | 4 | # https://www.hackerrank.com/challenges/py-introduction-to-sets/problem
def average(array):
s = set(array)
print(s)
total = 0
for i in s:
total += i
return '%.3f' % float(total/len(s))
n = int(input())
arr = list(map(int, input().split()))
result = average(arr)
print(result)
|
e9b5ba9d36993c731d2d2cdf1fd1c8b8ff1aacf0 | BBode11/CIT228 | /Project1/laser.py | 1,016 | 3.578125 | 4 | import pygame
from pygame.sprite import Sprite
class Laser(Sprite):
# A class to manage the lasers fired from the cat
def __init__(self, cm_game):
#Create a laser object at the cats current position
super().__init__()
self.screen = cm_game.screen
self.settings = cm_game.set... |
d88edb25b8e0a48ec18d525e97dbc7b7c2ae39a9 | t0ri-make-school-coursework/cracking-the-coding-interview | /stacks-and-queues/queue_via_stacks.py | 722 | 4.375 | 4 | # 3.4
# Implement a MyQueue class which implements a queue using two stacks.
class MyQueue:
def __init__(self):
self.stack1 = []
self.stack2 = []
def enqueue(self, item):
# Shift all elements from stack1 to stack2
while len(self.stack1) is not 0:
self.stack2.appen... |
18c7ed211f34eb41deed26a142801329e5fbbed6 | sglim/inno-study | /baekjoon/problem_4673/self_number.py | 1,069 | 3.828125 | 4 | # function d(n) : sum n and its each order's number
# for example, d(75) = 75 + 7 + 5 = 87
def d(n):
result = n
while n != 0:
result += (n % 10)
n = n // 10
return result
# has_n() function will check out if certain number 'num' has 'n' such that d(n) = num
def has_n(num):
exp = 0
... |
4fa0d5dfa3c8c5beb9215e7186e0877abe45d0d3 | pangyouzhen/data-structure | /linked_list/141 hasCycle.py | 438 | 3.578125 | 4 | from base.linked_list.ListNode import ListNode
class Solution:
def hasCycle(self, head: ListNode) -> bool:
dummy_head1 = ListNode(0, head)
dummy_head2 = ListNode(0, dummy_head1)
fast, slow = head, dummy_head2
while fast != slow:
if fast and fast.next:
... |
d020e72a17666b5c6d06305241dd059ea44fbf56 | NealGross1/PythonChess | /test_ChessPiecesandBoard.py | 12,246 | 3.59375 | 4 | import unittest
from ChessPiecesandBoard import *
class TestChessPiece(unittest.TestCase):
def test_init(self):
newPiece = ChessPiece([0,3],'white')
self.assertEqual(newPiece.color, 'white')
self.assertEqual(newPiece.boardPosition,[0,3])
del newPiece
class TestChessBoard(unittest.T... |
22594d9ac41c808537f74574c0e23af762d5b436 | zhiweiguo/my_leetcode | /offer/62.py | 1,505 | 3.53125 | 4 | # 每日打卡 day8 : offer 62
'''
圆圈中最后剩下的数字
0,1,,n-1这n个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字。
求出这个圆圈里剩下的最后一个数字。
例如:
0、1、2、3、4这5个数字组成一个圆圈,
从数字0开始每次删除第3个数字,则删除的前4个数字依次是2、0、4、1,
因此最后剩下的数字是3。
'''
class Solution:
def lastRemaining(self, n: int, m: int) -> int:
'''
构建数组,计算索引依次删除,时间复杂度较高,待优化
'''
num... |
ded66d21c781404ae382a530dc68d318568654c3 | MrHamdulay/csc3-capstone | /examples/data/Assignment_5/tmpste002/question4.py | 1,371 | 4.25 | 4 | """ Print a graph of a function using ASCII art """
__author__ = 'Stephen Temple - TMPSTE002'
__date__ = '2014/04/13'
import math
# set x axis range and increment
X_MIN = -10
X_MAX = 10
X_INC = 1
x_multiplier = int(1 / X_INC) # required if increment is a floating point number to convert to whole number
# set y axis... |
9dbf87a85158d3834ea278ead08d04895c450802 | dcyoung23/data-analyst-nd | /data-wrangling/lessons/Lesson_3_Problem_Set/01-Auditing_Data_Quality/audit.py | 3,609 | 3.9375 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up.
In the first exercise we want you to audit the datatypes that can be found in some particular fields in the dataset.
The possible types of values can be:
... |
e3a75ce0183c1bde6705ae2a14ea94ce5e4f6f03 | CodingDojoOnline-Nov2016/al-lakshmanan | /python/flask/starterproj/python basics/oddeven.py | 292 | 4.1875 | 4 | def oddeven():
sum = 0
for val in range(1,2001,1):
if val % 2 == 0:
print "Number is ", val, ".This is even Number."
else:
print "Number is ", val, ".This is odd Number."
sum = sum + val
return sum
result = oddeven()
print result
|
f753ebd1a22146d354346a879cab467561df3d80 | rafaelperazzo/programacao-web | /moodledata/vpl_data/116/usersdata/164/25963/submittedfiles/al1.py | 181 | 3.71875 | 4 | from __future__ import division
#INICIE AQUI SEU CODIGO
R=float(input('Digite o raio da lata: '))
A=float(input('Digite a altura da lata: '))
V= 3.14159*(R**2)*A
print('%.2f' %V) |
bfe72d8fbf4f6a01f7ec2557b59f3b27b2d76e67 | olivierverdier/polynomial | /polynomial.py | 5,741 | 3.84375 | 4 | # -*- coding: utf-8 -*-
from __future__ import division # to avoid the mess with integer divisions
# determine what is imported during a `from polynomial import *`
__all__ = ['Polynomial', 'Zero', 'One', 'X']
"""
Classes to model polynomials.
It also defines a Zero and One polynomials
"""
import numpy as np
import n... |
f18c8cbc60d927953bfd23c303e9ff9158b4d88f | lucianthorr/traffic-simulation | /trafficsimulation/car.py | 3,548 | 3.890625 | 4 | from blackbox import Blackbox
import random
class Car:
""" The Car is the workhorse class of this project. Each car keeps track of its location, speed,
and uses a Road object to get changes in the environment.
Also, each car has a Car attribute that points to the car ahead of it.
This is used to manag... |
b199d3d6336ccb77d090afe4f2be3048ada29091 | pulinghao/LeetCode_Python | /647. 回文子串.py | 905 | 3.796875 | 4 | #!/usr/bin/env python
# _*_coding:utf-8 _*_
"""
@Time :2020/8/19 10:04 下午
@Author :pulinghao@baidu.com
@File :647. 回文子串.py
@Description :
"""
class Solution(object):
def __init__(self):
self.cnt = 0
def countSubstrings(self, s):
"""
:type s: str
:rtype: int
... |
fb53f49b5607af41d9d89924d89c55bae6295e9e | SushantiThottambeti/Assignment-10 | /Thottambeti.Sushanti.Assignment-10.py.py | 4,117 | 3.546875 | 4 | """
File: Python Programming
Author: Sushanti Thottambeti
DU ID: 873406925
Date: 06/05/2020
Title: Adding Functions to the Stock Problem
Description: This program creates a line graph with Matplotlib for stock data imported
from a JSON file. The graph shows variation in closing price for each stock over time.Al... |
f80f48bac7426249948893a7c03f32af7c69df0b | 1751660300/lanqiaobei | /基础练习/01.py | 403 | 3.671875 | 4 | # -*- coding:utf-8 -*-
n = int(input())
a = input().split(" ")
def i(s):
return int(s)
if n < 2:
print(a[0])
else:
a.pop()
a.sort(key=i)
for b in a:
print(b, end=' ')
# 问题:n大于1时,a的分割会多出一个空出来,所以要把列表的最后一个元素删除
# 技术:使用了列表的排序
# 想起了字符的提取 re lxml bs4 jsonpath
|
0f5c8f5dd26de8f01e477ddaca90b431da5fab10 | Daividao/interview | /topological_sort.py | 1,177 | 3.859375 | 4 | # Topological sort is applied to Directed Acyclic Graph to
# find a a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u
# comes before v in the ordering
from utils import build_adjacency_list_directed
from collections import deque
# time complexity: O(N+M)
# space: O(N)
... |
54348692e73a2732236255ecc6d908c211504359 | enrique-martinez95/Python | /DayOfTheWeek.py | 1,997 | 4.25 | 4 | # File: DayOfTheWeek.py
# Description: A program that asks the user for a date and returns the day
# of the week the day falls on.
# Student's Name: Enrique Martinez
# Student's UT EID: egm657
# Course Name: CS 303E
# Unique Number: 50191
#
# Date Created: 2/23/2020
# Date Last Modified: 2/23/2020
... |
747f77dc55afb73fd7a74c4e18f023ddcd9a03a0 | nadavpeled/automudo | /automudo/browsers/base.py | 937 | 3.65625 | 4 | class Browser(object):
"""
An interface representing a browser.
Provides functions for getting bookmarks from it.
"""
# When inheriting this class, you should define a module-level
# constant named "name", containing the browser's name
def get_all_bookmarks(self):
"""
... |
b675b047dea080792425c8c74b72abaf6ba42094 | brlala/Educative-Grokking-Coding-Exercise | /Leetcode/138. Copy List with Random Pointer.py | 1,508 | 3.9375 | 4 | """
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution:
def copyRandomList(self, head: 'Node') -> 'Node':
"""
O(2n)
"""
d... |
b368a98a8df737b29ec0fd2cba2eb5f9a276957a | Edgarlv/Tarea_03 | /Magnitud.py | 300 | 3.890625 | 4 | #encoding: UTF-8
#author: Edgar Eduardo Alvarado Duran
#Problema 5
import math
x= int(input("Dame el valor de x"))
y= int(input("Dame el valor de y"))
r= math.sqrt((x**2)+ (y**2))
angulo= math.atan2(x,y)
grados= math.degrees(angulo)
grados= 90-grados
print ("La magnitud de r es:",r)
print ("Angulo:", grados)... |
3c07168bd1f7c1721ef54198f9903df50cad4942 | dwz1011/spider | /data_spider/bs_spider.py | 415 | 3.5 | 4 | # -*- coding: utf-8 -*-
import urllib2
from bs4 import BeautifulSoup
def bs_spider(html):
soup = BeautifulSoup(html, 'lxml')
tr = soup.find(attrs={'id':'places_area__row'})
td = tr.find(attrs={'class':'w2p_fw'})
area = td.text
return area
if __name__ == '__main__':
url = 'http://example.webs... |
dce5092b88efb9c64696709897fb2809e133013e | otoolebrian/Challenges | /cryptanalysis/crypto.py | 3,515 | 3.859375 | 4 | # Vigenere Cipher Challenge Code
#
# This script is used to create ciphertext from plaintext in a file
# and to decrypt ciphertext to plaintext using a user supplied key
#
# Source code is available at https://github.com/otoolebrian/Challenges/
import sys
import re
# I will use the alphabet for encrypting and decryp... |
2df22607e0b3c4d1b65c6356c157afba1f8d6e41 | jonghwanchoi/python | /PracticePython/practice.py | 2,387 | 4.0625 | 4 | # 참 / 거짓 -->boolean
# print(5 < 10)
# print(not (5>10))
# station = "사당"
# print(station + "행 열차가 들어오고 있습니다")
# print(1+1)
# print(2**3) #2^3 = 8
# print(5%3) # 나머지 구하기 2
# print(5/3) #소수점까지 나옴
# print(5//3) # 몫 =1
# print(10>3) #True
# print(4 >= 7) #False
# print(5 <= 5) #True
# print(3 == 3) #True
# print(3 != 4)... |
83dfd350ac59374e05a0fb7a4bdd6b4f0aae3ab1 | lobsterkatie/CodeFights | /Arcade/LoopTunnel/candles.py | 1,957 | 4.34375 | 4 | """
LOOP TUNNEL / CANDLES
When a candle finishes burning it leaves a leftover. makeNew leftovers can be
combined to make a new candle, which, when burning down, will in turn leave
another leftover.
You have candlesNumber candles in your possession. What's the total number of
candles you can burn, assuming that you cr... |
3c9670e3bf58b60e5e26c15a1703430c1d440e68 | inaciofabricio/python-para-iniciantes | /aula 10.py | 268 | 4.09375 | 4 | numero=20
while True:
numero=numero-1
print(numero)
if(numero==2):
break
print('---')
numero=10
while True:
numero=numero-1
if(numero==4):
continue
print(numero)
if(numero==2):
break
for x in range(0,5):
pass
|
4960366c9893866db32d1dada0af773a10b2ce0a | membriux/Wallbreakers-Training | /week1/Arrays/transpose_matrix.py | 628 | 4.15625 | 4 | # Problem 2: Transpose Matrix
# Given matrix A, return transpose of A
# Transpose = matrix flipped over it's main diagonal,
# switching the row and column indices of the matrix
'''
Example: Input:
[[1,2,3],
[4,5,6],
[7,8,9]]
Output:
[[1,4,7],
[2,5,8],
[3,6,9]
]
Input
[[1,2,3],
[4,5,6]]
Output
[[1,4],
[2,5],... |
4617259b96130bc9ddca55f020042a5776b1a291 | rgerk/PythonFiap | /variavel_numero.py | 330 | 4.03125 | 4 | nota1 = int( input("Digite a nota 1: "))
nota2 = int( input("Digite a nota 2: "))
media = (nota1 + nota2) / 2
if media >= 6:
print("VOCE FOI APROVADO: " + "MEDIA: ", media)
elif media < 4:
print("VOCE ESTA EM REPROVADO:" + "MEDIA: ", media)
else:
print("VOCE ESTA EM RECUPERACAO: " + "MEDIA: ", m... |
6bc3a9fbfef9373938df4528b1a26552a912d28d | realitycrysis/htx-immersive-08-2019 | /01-week/3-thursday/labs/8-29-19 python exercises Scott/exercise6.py | 100 | 3.796875 | 4 | celcius = int(input('Temperature in Celsius?'))
farenheit = 9.0/5.0 * celcius + 32
print(farenheit)
|
33acc5ba71e88c38e5642e55fae5c2162843f651 | Elkasitu/advent-of-code | /day-07/tower.py | 932 | 3.546875 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def parse(raw):
lines = [line for line in raw.split('\n') if line.find('->') > 0]
supporting = []
supported = []
for line in lines:
splitted = line.split('->')
supporting.append(splitted[0].split()[0])
supported += splitted[1].stri... |
d92d1f79415a7003720a374c94ffe6968b9ff982 | Computer-engineering-FICT/Computer-engineering-FICT | /I семестр/Програмування (Python)/Лабораторні/Лисенко 6116/Python/Презентації/ex23/Ex8.py | 242 | 3.53125 | 4 | class Base:
tb=10
class One(Base):
to=20
class Two(Base):
tt=30
x=Base()
y=One()
z=Two()
L=[(x,"tb"),(y,"to"),(z,"tt")] #Атрибути задаємо як рядки
for i,j in L:
print(getattr(i,j), end=" ")
|
3d151510991e6d9f59053ca094ea17e3b7bb2bb8 | boknowswiki/mytraning | /lintcode/python/1315_summary_ranges.py | 4,821 | 3.609375 | 4 | #!/usr/bin/python -t
# array no duplicated number case
class Solution:
"""
@param nums: a sorted integer array without duplicates
@return: the summary of its ranges
"""
def summaryRanges(self, nums):
# Write your code here
n = len(nums)
ret = []
if n == 0:
... |
e0d711e342dad3eba5762540a287db35e70538d9 | ghostklart/python_work | /08.07.1.py | 263 | 3.5 | 4 | def make_album():
prompt_0 = "Please, specify the album: "
prompt_1 = "Please, specify the artist: "
res_album = input(prompt_0)
res_artist = input(prompt_1)
album_info = {'album': res_album, 'res_artist': res_artist}
print(album_info)
make_album()
|
ccc7ea3b924ea01ce43a8f9150eb3f76556f93c3 | manondesclides/ismrmrd-python-tools | /ismrmrdtools/ndarray_io.py | 2,452 | 3.640625 | 4 | import numpy as np
from struct import unpack
def write_ndarray(filename,ndarray):
'''Writes simple ndarray format. This format is mostly used for debugging purposes
The file name extension indicates the binary data format:
'*.float' indicates float32
'*.double' indicates float64
'*.cplx' indicat... |
a4c4d2d41a314c6be75e3c908dea6231b458ee43 | TurusovMaxim/newrepository | /Pyramid for Mario.py | 1,218 | 4.0625 | 4 | element = input('Enter the data: ')
def pyramid(element):
if element.isdigit():
while int(element) > 23:
element = input('Enter a number less than 23: ')
while int(element) < 0:
element = input('enter a number greater than 0: ')
if int(element) >= 0 and int(element) ... |
61878d94877c03611996947c648ceeb8e6318326 | jobiaj/Problems-from-Problem-Solving-with-Algorithms-and-Data-Structures- | /Chapter_02/deque.py | 505 | 3.8125 | 4 | class Deque:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def add_front(self, item):
self.items.append(item)
def add_rear(self, item):
self.items.insert(0, item)
def remove_front(self):
return self.items.pop()
def remove_rear(self):
return self.items.pop(0)
def size... |
2c5d289e36c119f9c2973a8126477e9e6337896f | hubieva-a/lab19 | /l19z1.py | 1,370 | 3.546875 | 4 | from tkinter import *
def func_sum(event):
s1 = entry1.get()
s1 = float(s1)
s2 = entry2.get()
s2 = float(s2)
result1 = s1 + s2
result1 = str(result1)
label1['text'] = ' '.join(result1)
def func_difference(event):
s1 = entry1.get()
s1 = float(s1)
s2 = entry2.get()
... |
73f72fd4a7cd11b57c082330384bf6aba37cb3fe | 3Thiago/Competition-Toolbox | /longest_sequence.py | 526 | 4.0625 | 4 | def longest_sequence(N):
'''
Find longest sequence of zeros in binary representation of an integer.
The solution is straight-forward! Use of binary shift.
'''
cnt = 0
result = 0
found_one = False
i = N
while i:
if i & 1 == 1:
if (found_one... |
a303f16dda7121ad44c087c9fba0e9001ddebab3 | JoseAntonioVelasco/2DAM_Workspaces | /Python/ejercicio5JoseantonioVelasco.py | 1,190 | 4.0625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 18 09:00:16 2020
@author: ADMIN
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
listaLetras = ['T','R','W','A','G','M','Y','F','P','D','X','B','N','J','Z','S','Q','V','H','L','C','K','E']
class DNI:
def __init__(self,numero,letra):
self.numero = nume... |
d0473a3f9139951de0051eea70f98eb98011b387 | GauravBhardwaj/pythonDS | /28questionsbyArdenDertat/2LargetsContinuousSum.py | 864 | 4.09375 | 4 | #Given an array of integers (positive and negative) find the largest continuous sum
#return the largest sum, start and end
import timeit
def largest_sum1(arr):
'''
We will keep swapping the maxsum with cureent sum while traversing the array.
This doesnt work for negative numbers, so add an extra condition t... |
2fbd11a100c8fd3b6b9223b37841b7b74df742be | Maidno/Muitos_Exercicios_Python | /exe14.py | 142 | 3.984375 | 4 | c = float(input('Informe a temperatura em ºC: '))
fa = 9 * c / 5 + 32
print('A temperatura de {} ºC corresponde a {} ºF!' .format(c,fa))
|
a43210129bccc5794ea060bd7fb90564093b0b2f | binfen1/PythonWithHardware | /CyberPi V1/Python with CyberPi 043(read 阅后即焚).py | 1,440 | 3.5625 | 4 | """"
名称:043 阅后即焚
硬件: 童芯派
功能介绍:读取文件的信息后,就会自动将读取到的信息进行删除。
难度:⭐⭐⭐⭐
支持的模式:仅支持在线模式
使用到的API及功能解读:
1.read()函数
python的内建函数,通过read函数可以读取到文件中的数据
"""
# ---------程序分割线----------------程序分割线----------------程序分割线----------
import cyberpi
import time
cyberpi.led.off()
cyberpi.console.clear()
while True:
if cyberpi.contro... |
82a13e6438bde9c9bb840eb8b9bfc3a200d8e3cb | KennedyOdongo/Time_Series | /LSTM.py | 6,127 | 3.765625 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers import LSTM
from keras.layers import Dense
from keras.layers import Flatten
import math
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
import pan... |
47201e22b61833e6b2ec0a46b81f400bdacb311f | piyush18184/Student-Management-System | /student_enrollement.py | 4,856 | 3.921875 | 4 | from Course import *
from ListOfCourses import CourseList as c
from ListOfMajors import *
from Course import *
from ListOfStudents import *
from Major import *
from ListOfParticularCourses import *
from Student import *
import sys
if __name__ == '__main__':
while True:
print()
print("1:Student na... |
de3034b0cddf4768cd21c45d24f7e8e3c266b892 | CharlesBasham132/com404 | /second-attempt-at-tasks/1-basics/3-decision/2-nested-decisions/1-nested/bot.py | 596 | 4 | 4 |
print("what type of book cover is that?(soft/hard)")
book_cover_hardness = str(input())
if (book_cover_hardness == "soft"):
print("is the cover perfect bound?(yes/no)")
book_cover_bound = str(input())
if (book_cover_bound == "yes"):
print("soft cover, perfect bound books are popular")
elif (bo... |
ae34f58be95bb422ed47b5b1a3065e4f006f100f | sanderheieren/in1000 | /oblig2/utskriftsfunksjon.py | 521 | 3.53125 | 4 | # Sander Heieren, Oblig 2, IN1000
# Dette programmet skal ta inn navn og bosted fra terminalen (brukeren)
# Vi skal også brukte prosedyrer for å bli bedre kjent med kodeflyt, her er det bare om utskrifter
# 1, 2 får navn og bosted og legger all logikk inn i en egen prosedyre. Denne skal kalles 3 ganger.
def navnOgBos... |
81c5335d0b90373381d5f94aee11d78c38e0e6ca | itsbritt/python_practice | /conditionals.py | 436 | 3.9375 | 4 | myList = [1,2,3,4]
myTuple = (1,2,3,4)
if 1 in myList:
print 'Do I print?'
if 4 in myTuple:
print 'yo'
if 5 not in myTuple:
print 'no'
aList = ['apples', 'oranges', 'pineapples']
whatIsRange = range(1,10)
whatIsRangeAgain = range(20,30)
print whatIsRange
print whatIsRangeAgain
for i in range(len(aLis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.