blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
7f4246df5871b86d5f6bd5e6d55e15780dd98f6e | nbiadrytski-zz/python-training | /dive_into_p3/classes/person3.py | 1,004 | 4.28125 | 4 | import datetime
class Person3:
def __init__(self, name, surname, birthdate, address, phone, email): # params passed to __init__ method
self.name = name # attribute
self.surname = surname
self.birthdate = birthdate
self.address = address
self.phone = phone
self.ema... | false |
aa82cfb605e7cec0fff586fa9e24b9e8bf0df80e | NataliiaBidak/py-training-hw | /decorators.py | 1,667 | 4.1875 | 4 | """Write a Decorator named after5 that will ignore the decorated function in the first 5 times it is called. Example Usage:
@after5
def doit(): print("Yo!")
# ignore the first 5 calls
doit()
doit()
doit()
doit()
doit()
# so only print yo once
doit()
please make a similar one, but that acceps times to skip as param (... | true |
34b404276601227ab7d713cd2ee6cfa1839e7969 | ddjaell/algorithm | /Stack.py | 524 | 4.15625 | 4 | """
스택은 LIFO, FILO의 형태가 있다
"""
"""
python의 list는 기본적으로 스택의 구조를 가지고 있음
"""
stack_list = list()
stack_list.append(1)
stack_list.append(2)
stack_list.append(3)
print(stack_list)
print(stack_list.pop())
print("after pop() once = ", stack_list)
"""
pop(), push() 함수 만들어보기
"""
stack_self = list()
def push(data):
sta... | false |
7498e0e3d6658736c53c800a929fa12472bd36f6 | kura123/language_processing100 | /chapter1/03.py | 497 | 4.125 | 4 | # 03. 円周率Permalink
# “Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.”という文を単語に分解し,
# 各単語の(アルファベットの)文字数を先頭から出現順に並べたリストを作成せよ.
string = 'Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.'
string = string.replace(',','').replace('.... | false |
b309163a54cb56b9f9c3b21795388a74658910fb | 99zraymond/Daily-Lesson-Exercises | /Daily Exercise 02082018.py | 770 | 4.34375 | 4 | #Your Name - Python Daily Exercise - date of learning
# Instructions - create a file for each of the daily exercises, answer each question seperately
# 1. Write a statement that concatenates at least two variables (you can have more than 2 for this practice).
# 2. Create a program that asks the user to enter t... | true |
505c59d5b7161eab01c637f144f7f3bf790f2bfb | manjunath2019/Python_7am_May_2019 | /Operators/Membership.py | 452 | 4.15625 | 4 |
"""
in and not in are the membership operators in python
Are used to test whether a value or variable is found in a sequence
(String, List, Tuple, & Dictrionary)
"""
x_value = 'Guido Van Rossum'
y_value = {1:'a',2:'b'}
print(x_value)
print(y_value)
#a = input('Enter a Value : ')
#print(a in x_value.lower())
pr... | true |
0934c83a40bffa4b7abc9caf0235b71cf2e536fa | cylinder-lee-cn/LeetCode | /LeetCode/819.py | 2,435 | 4.28125 | 4 | """
819. 最常见的单词
给定一个段落 (paragraph) 和一个禁用单词列表 (banned)。返回出现次数最多,同时不在禁用列表中的单词。
题目保证至少有一个词不在禁用列表中,而且答案唯一。
禁用列表中的单词用小写字母表示,不含标点符号。段落中的单词不区分大小写。答案都是小写字母。
示例:
输入:
paragraph = "Bob hit a ball, the hit BALL flew far after it was hit."
banned = ["hit"]
输出: "ball"
解释:
"hit" 出现了3次,但它是一个禁用的单词。
"ball" 出现了2次 (同时没有其他单... | false |
c30de23d2ac7f09d0b389dcee2b313b231c7daa4 | cylinder-lee-cn/LeetCode | /LeetCode/98.py | 1,808 | 4.375 | 4 | """
98. 验证二叉搜索树
给定一个二叉树,判断其是否是一个有效的二叉搜索树。
假设一个二叉搜索树具有如下特征:
节点的左子树只包含小于当前节点的数。
节点的右子树只包含大于当前节点的数。
所有左子树和右子树自身必须也是二叉搜索树。
示例 1:
输入:
2
/ \
1 3
输出: true
示例 2:
输入:
5
/ \
1 4
/ \
3 6
输出: false
解释: 输入为: [5,1,4,null,null,3,6]。
根节点的值为 5 ,但是其右子节点值为 4 。
"""
... | false |
8bd7f0c881b93d5836a57cca17561cefed3ab1de | cylinder-lee-cn/LeetCode | /LeetCode/75.py | 1,700 | 4.28125 | 4 | """
75. 颜色分类
给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,
使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。
此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。
注意:
不能使用代码库中的排序函数来解决这道题。
示例:
输入: [2,0,2,1,1,0]
输出: [0,0,1,1,2,2]
进阶:
一个直观的解决方案是使用计数排序的两趟扫描算法。
首先,迭代计算出0、1 和 2 元素的个数,然后按照0、1、2的排序,重写当前数组。
你能想出一个仅使用常数空间的一趟扫描算法吗?
"""
class Solutio... | false |
b8a9793d228c4d34d48b28d6d86c402270de4ace | cylinder-lee-cn/LeetCode | /LeetCode/384.py | 1,519 | 4.28125 | 4 | """
384. 打乱数组
打乱一个没有重复元素的数组。
示例:
// 以数字集合 1, 2 和 3 初始化数组。
int[] nums = {1,2,3};
Solution solution = new Solution(nums);
// 打乱数组 [1,2,3] 并返回结果。任何 [1,2,3]的排列返回的概率应该相同。
solution.shuffle();
// 重设数组到它的初始状态[1,2,3]。
solution.reset();
// 随机返回数组[1,2,3]打乱后的结果。
solution.shuffle();
"""
import random
... | false |
6140d410e7091956e4ae5c7d42f438843ac972b7 | cylinder-lee-cn/LeetCode | /LeetCode/344.py | 507 | 4.3125 | 4 | """
344. 反转字符串
编写一个函数,其作用是将输入的字符串反转过来。
示例 1:
输入: "hello"
输出: "olleh"
示例 2:
输入: "A man, a plan, a canal: Panama"
输出: "amanaP :lanac a ,nalp a ,nam A"
"""
class Solution:
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
return s[::-1]
... | false |
a012a2254bf132917c05470cbba7e0e7e58aa997 | cylinder-lee-cn/LeetCode | /LeetCode/206.py | 1,126 | 4.15625 | 4 | """
206. 反转链表
反转一个单链表。
示例:
输入: 1->2->3->4->5->NULL
输出: 5->4->3->2->1->NULL
进阶:
你可以迭代或递归地反转链表。你能否用两种方法解决这道题?
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverseList(self, head):
... | false |
54dc735d569e57a8866fcae50dfc75254dabde04 | cylinder-lee-cn/LeetCode | /LeetCode/876.py | 2,078 | 4.21875 | 4 | """
876. 链表的中间结点
给定一个带有头结点 head 的非空单链表,返回链表的中间结点。
如果有两个中间结点,则返回第二个中间结点。
示例 1:
输入:[1,2,3,4,5]
输出:此列表中的结点 3 (序列化形式:[3,4,5])
返回的结点值为 3 。 (测评系统对该结点序列化表述是 [3,4,5])。
注意,我们返回了一个 ListNode 类型的对象 ans,这样:
ans.val = 3, ans.next.val = 4, ans.next.next.val = 5, 以及 ans.next.next.next = NULL.
示例 2:
输入:[1,2,3,4,5... | false |
31199be0e0349f61fe8df709be933f29da645805 | cylinder-lee-cn/LeetCode | /LeetCode/144.py | 819 | 4.125 | 4 | """
144. 二叉树的前序遍历
给定一个二叉树,返回它的 前序 遍历。
示例:
输入: [1,null,2,3]
1
\
2
/
3
输出: [1,2,3]
进阶: 递归算法很简单,你可以通过迭代算法完成吗?
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = No... | false |
9d557f02cbbfaa882e68b2e617d6f8a09992460a | cylinder-lee-cn/LeetCode | /LeetCode/151.py | 1,100 | 4.3125 | 4 | """
151. 翻转字符串里的单词
给定一个字符串,逐个翻转字符串中的每个单词。
示例:
输入: "the sky is blue",
输出: "blue is sky the".
说明:
无空格字符构成一个单词。
输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不能包括。
如果两个单词间有多余的空格,将反转后单词间的空格减少到只含一个。
进阶: 请选用C语言的用户尝试使用 O(1) 空间复杂度的原地解法。
"""
class Solution(object):
def reverseWords(self, s):
"""
:... | false |
ba05240853d5865e4a57d9593bd3bcdf97696bb7 | run-fourest-run/IteratorProtocol | /realpythonitertools/itertoolsintro.py | 539 | 4.1875 | 4 | '''itertools is a module that implements a number of iterator building blocks. Functions in itertools operate
on iterators to produce more complex iterators'''
test_list_0 = [95000,95000,95000,95000]
test_list_1 = [117000,117000,121000,120000]
test_list_2 = ['alex','joe','anthony','david']
'''zip example'''
def see_... | true |
e0d48e5df6768de714b9928cc4853cb92b121535 | run-fourest-run/IteratorProtocol | /itertoolsdocs/chain.py | 720 | 4.1875 | 4 | import itertools
'''
Make an iterator that returns elements from the first iterable until its exhausted. Then proceed to the next
iterable, until all the iterables are exhausted.
Used for treating consecutive sequences as a single sequence
'''
def chain(*iterables):
for it in iterables:
for element in ... | true |
ec7199c351470743b5ead5d6639229d283ecfca7 | bc-uw/IntroPython2016 | /students/bc-uw/session04/trigram.py | 949 | 4.125 | 4 | """
Trigram lab attempt.
Version0.I don't understand what this is supposed to do
"""
import sys
import string
import random
def sourceFile_to_list(input_file):
"""
list comprehension to iterate through source file lines
and add them to textlist
"""
with open(input_file) as f:
textlist = [... | true |
8f995f5ec8b53e07ea81997683fb7acd957a5acc | naymajahan/Object-Oriented-programming1 | /python-regular-method.py | 979 | 4.34375 | 4 | #### object oriented programming in python
class StoryBook:
def __init__(self, name, price, authorName, authorBorne, no_of_pages):
# setting the instance variables here
self.name = name
self.price = price
self.authorName = authorName
self.authorBorne = authorBorne
s... | true |
752cd493edac4ad35a04b1ce29c7b9449fe6d797 | tarabrosnan/hearmecode | /lesson04/lesson04_events_deduplicate.py | 986 | 4.125 | 4 | # Challenge level: Beginner
# Scenario: You have two files containing a list of email addresses of people who attended your events.
# File 1: People who attended your Film Screening event
# https://github.com/shannonturner/python-lessons/blob/master/section_09_(functions)/film_screening_attendees.txt
#
# ... | true |
3b50e9eb168075eb3aea43d8a75418171b5347c2 | HenriqueCostaSI/Python | /reversed.py | 908 | 4.59375 | 5 | """
Reversed-> Inverter o Interável
Obs: Não confunda com reverse() de listas
A função retorna um List Reverse Iterator
"""
# Exemplos
lista = [1, 2, 3, 4, 5]
res = reversed(lista)
# Lista
print(list(reversed(lista)))
# Tupla
print(tuple(reversed(lista)))
# Conjunto
print(set(reversed(lista))) # Em conjunto n... | false |
aae91a00e84efddf7be4fdb7194b73e9a4d0100f | HenriqueCostaSI/Python | /modulo_random.py | 2,681 | 4.125 | 4 | """
Módulo Random e o que são módulos?
- Em Python, módulos são outros arquivos Python.
Módulo Random -> Possui várias funções para geração de números pseudo-aleatório.
"""
# OBS: Existem duas formas de se utilizar um módulo ou função desempacotamento
# Forma 1 - Importando todo o módulo (Não recomendado).
from ... | false |
fdad87ebcc7a3644e7715817fead3af699d47543 | HenriqueCostaSI/Python | /Ordered_dict.py | 605 | 4.1875 | 4 |
"""
Ordered Dict
# Em um dicionário a ordem de inderção dos elemtos não é garantida
dict = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6}
for chave, valor in dict.items():
print(f'chave={chave}:valor={valor}')
"""
# Importando
from collections import OrderedDict
dic = orderedDict({'a': 1, 'b': 2, 'c': 3, 'd': 4,... | false |
5cdfa102cff1c3210258e57c45eb8ba103e90481 | RodiMd/Python | /RomanNumeralsRange.py | 1,937 | 4.125 | 4 | #Roman Numerals
#prompt user to enter a value between 1 and 10.
number = input('Enter a number between 1 and 10 ')
number = float(number)
def main():
if number == 1:
print('The value entered ', number, 'has a roman equivalent of I')
else:
if number == 2:
print('The val... | true |
19d948529b4da0ca728c55653e413629487b606f | RodiMd/Python | /MonthlyCarCost.py | 690 | 4.1875 | 4 | #Automobile Costs
#ask user to input automobile costs including: loan payment
#insurance, gas, oil, tires, maintenance.
loanPayment = input('Enter auto monthly payment ')
insurance = input('Enter insurance cost ')
gas = input('Enter monthly gas cost ')
oil = input('Enter monthly oil cost ')
tires = input('Ente... | true |
19be8d9e73b668b2039865214c3bb7b1937c1924 | RodiMd/Python | /convertKmToMiles.py | 383 | 4.4375 | 4 | #Kilometer Converter
#write a program that converts km to mi
#ask the user to enter a distance in km
distanceKilometers = input('Enter a distance in km ')
distanceKilometers = float(distanceKilometers)
def conversionTokilometers():
miles = distanceKilometers * 0.6214
print ('The distance entered in kil... | true |
012f04a108ad5bb0d1d6a2a939389d9ed6ba9736 | devprofe/python | /ej1_clases2406.py | 433 | 4.125 | 4 | #DECLARAR UNA LISTA VACIA
numeros = []
#COMO LLENAR UNA LISTA SOLO CON APPEND
#numeros.append(35)
#numeros.append(28)
#numeros.append(12)
#INGRESAR NUMEROS EN UNA LISTA MEDIANTE INSERT Y FOR.
#for i in range(5):
#numeros.insert(i, float(input("ingrese numero:")))
#INGRESAR NUMEROS EN UNA LISTA MEDIANTE APPEND Y ... | false |
66079189a84d8cd1c08a3b9eee964f6a116395d4 | h8rsha/tip-calculator | /main.py | 441 | 4.125 | 4 | if __name__ == '__main__':
print("Welcome to the tip calculator.")
total_bill = input("What was the total bill? ")
tip_percentage = input("What percentage tip would you like to give? 10, 12 or 15? ")
people_count = input("How many people to split the bill? ")
total_amount = (float(total_bill) / int(... | true |
b5e6f4348b9445639f2696caac83c9a761200cc0 | zchiam002/vecmc_codes_zhonglin | /nsga_ii/nsga_ii_para_imple_evaluate_objective.py | 2,310 | 4.15625 | 4 | ##Function to evaluate the objective functions for the given input vector x. x is an array of decision variables
##and f(1), f(2), etc are the objective functions. The algorithm always minimizes the objective function hence if
##you would like to maximize the function then multiply the function by negative one.
def ... | true |
5e4e2fdc4c1037667821e5f23ad88ccc62f7de18 | Salcazul/ComputerElective | /Quiz2.py | 622 | 4.21875 | 4 | #Name
name = raw_input("What is your name?")
#Last Name
last = raw_input("What is your last name?")
#Class
classname = raw_input("What class are you in?")
#Year of birth
year = input("What is your year of birth?")
#Calculate current age
age = 2015 - year
print "You are", age, "years of age."
#Computer grade 1S
s1 =... | true |
ed218f5025544474394bed9e161c987edd884a3e | yk2684/Codewars | /7kyu/Highest-and-Lowest.py | 410 | 4.125 | 4 | #In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number.
#Example:
#high_and_low("1 2 3 4 5") # return "5 1"
#high_and_low("1 2 -3 4 5") # return "5 -3"
#high_and_low("1 9 3 4 -5") # return "9 -5"
def high_and_low(numbers):
num_list = sorted(... | true |
89074f4afad000944e11ed9fcc508ecc69e42233 | yk2684/Codewars | /8kyu/Return-negative.py | 435 | 4.65625 | 5 | #In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?
#Example:
#make_negative(1); # return -1
#make_negative(-5); # return -5
#make_negative(0); # return 0
#Notes:
#The number can be negative already, in which case no change is required.
#Zero (0)... | true |
c4d957205efb049acc46b4cc892ef0fb32b8607f | Abdulkadir78/Python-basics | /q16.py | 690 | 4.34375 | 4 | '''
Use a list comprehension to square each odd number in a list.
The list is input by a sequence of comma-separated numbers.
Suppose the following input is supplied to the program:
1, 2, 3, 4, 5, 6, 7, 8, 9
Then, the output should be:
1, 9, 25, 49, 81
'''
numbers = input('Enter comma separated sequence of numbers: '... | true |
278c75115f7d16cbb3b881b0ea0ec90d22eca62a | Abdulkadir78/Python-basics | /q7.py | 565 | 4.21875 | 4 | '''
Write a program which takes 2 digits, X, Y as input and generates
a 2-dimensional array. The element value in the i-th row and j-th
column of the array should be i*j.
Example
Suppose the following inputs are given to the program:
3, 5
Then, the output of the program should be:
[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0,... | true |
f28b75916667124438f2c9e661078cf25ac70277 | Abdulkadir78/Python-basics | /q35.py | 663 | 4.15625 | 4 | '''
Please write a program which counts and prints the numbers of
each character in a string input by console.
Example:
If the following string is given as input to the program:
abcdefgabc
Then, the output of the program should be:
a, 2
b, 2
c, 2
d, 1
e, 1
f, 1
g, 1
'''
string = input('Enter a string: ')
l = []
for c... | true |
911f65f6917f1b17ebc6cb8c325e650549fe2bc3 | sapphacs13/python_basics | /syntax/functions.py | 722 | 4.125 | 4 | # Python uses white space. Everything you define or use has
# to have the correct indentation.
def adder(a, b):
return a + b
print adder(1, 2) # runs adder(1,2) and prints it (should print 3)
def subtracter(a, b):
return a - b
print subtracter(3, 2) # runs the subtracter and prints (should print 1)
# lets ... | true |
5e99a7b51a52f5301a2cb3bc65f019d52051982e | bigcat2014/Cloud_Computing | /Assignment 2/step2.py | 615 | 4.21875 | 4 | #!/usr/bin/python3
#
# Logan Thomas
# Cloud Computing Lab
# Assignment 2
#
# Capitalize the first letter of each word in the string and
# take the sum of all numbers, not contained in a word, and
# print the new string and the sum.
def main():
total = 0.0
user_input = input("Please enter a string\n>> ")
user_in... | true |
028f52f7e8a2633ba868029ca06263e993e9ca20 | bigcat2014/Cloud_Computing | /Assignment 2/shape.py | 889 | 4.125 | 4 | #!/usr/bin/python3
#
# Logan Thomas
# Cloud Computing Lab
# Assignment 2
#
from math import sqrt
class Shape:
sides = []
name = ''
def __init__(self):
self.name = 'Shape'
def area(self):
pass
class Rectangle(Shape):
def __init__(self, x, y):
super().__init__()
self.name = 'Rectangle'
self.side... | false |
1d92d87875f37503b14413d484e8656e426ac5d1 | JoelBrice/PythonForEveryone | /ex3_03.py | 439 | 4.21875 | 4 | """Check that the score is between the range and display the score level according to the score"""
score = input("Enter Score: ")
s = 0.0
try:
s = float(score)
except:
print("Error out of range!")
if s >=0 and s<=1:
if s>= 0.9:
print("A")
elif s >=0.8:
print("B")
elif s>=0.7:
... | true |
270c5c788c1fdad02806b75d3e693ef7de6c1974 | paty0504/nguyentienthanh-fundamental-c4e13 | /ss5/dict1.py | 445 | 4.1875 | 4 | dic = {
"eny" : "Em người yêu",
"any" : "Anh người yêu",
"cl" : "con lợn",
"hc" : "học",
"ik" : "đi",
}
while True:
search = input('Your code: ')
if search in dic:
print(dic[search])
else:
print('Not found')
choice = input(' Would you like to update? Y or N?:').lower()
if cho... | false |
bcc25fa4698e6c2e3d8bdef4290d8cdbc90bc7bc | alberico04/Test | /main.py | 2,845 | 4.25 | 4 | #### Describe each datatype below:(4 marks)
## 4 = integer
## 5.7 = float
## True = boolean
## Good Luck = string
#### Which datatype would be useful for storing someone's height? (1 mark)
## Answer: FLOAT
#### Which datatype would be useful for storing someone's hair colour?(1 mark)
## Answer: ST... | true |
82575d812269b58cb220e0e5c9218d5e9f5d4d11 | christophercalle/Tues_Sept_18 | /calculator.py | 581 | 4.21875 | 4 | def add(num1,num2):
print(num1 + num2)
def subtract(num1,num2):
print(num1 - num2)
def multiply(num1,num2):
print(num1 * num2)
def divide(num1,num2):
print(num1 / num2)
first_number = int(input("Give me a number: "))
operator = input("Give me a math operator: ")
second_number = int(input("Give me a... | false |
4cb82d079ffac6a7d07d598ab27ebb14d840f9b7 | abhilash1392/pythonBasicExercisesPart1 | /exercise_5.py | 292 | 4.25 | 4 | """5. Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them."""
first_name=input('Please enter your first name: ')
last_name=input('Please enter your last name: ')
print('Hello {} {}'.format(last_name,first_name))
| true |
a2929fd09d1daf91b1b4e2b08446820d38f75d67 | aleksandramitula/PYTHON_ola | /Dzien3/dzien3.py | 1,108 | 4.125 | 4 | temperature = input("Podaj temperature: ")
#DUZYMI LITERAMI piszemy stala, nie zmienna. To sa te wartosci, ktorych nie chcemy zmieniac w srodku w kodzie, ale mozna zmienic na poczatku:
HOT_TEMPERATURE=30
WARM_TEMPERATURE=25
NOT_COLD_NOT_WARM_TEMPERATURE=20
if temperature >=HOT_TEMPERATURE:
print("it's hot")
elif t... | false |
e4975175bb97edd715411f62c8a168dfe32570eb | nbrahman/HackerRank | /03 10 Days of Statistics/Day08-01-Least-Square-Regression-Line.py | 1,450 | 4.21875 | 4 | '''
Objective
In this challenge, we practice using linear regression techniques. Check out the Tutorial tab for learning materials!
Task
A group of five students enrolls in Statistics immediately after taking a Math aptitude test. Each student's Math aptitude test score, x, and Statistics course grade, y, can be expre... | true |
7d1e10a0303d71f3ff95a22bf44e2963b3745f22 | nbrahman/HackerRank | /01 Algorithms/01 Warmup/TimeConversion.py | 969 | 4.25 | 4 | '''
Given a time in 12-hour AM/PM format, convert it to military (24-hour) time.
Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock.
Input Format
A single string containing a time in 12-hour clock format (i.e.: hh:m... | true |
fd4be7ead12bb78ac455902f0721c2655643d7f4 | nbrahman/HackerRank | /01 Algorithms/02 Implementation/Utopian-Tree.py | 1,421 | 4.21875 | 4 | '''
The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter.
Laura plants a Utopian Tree sapling with a height of 1 meter at the onset of spring. How tall will her tree be after N growth cycles?
Input Format
The first line contains ... | true |
13c10b8411890edb52c47de0543427793125cd55 | nbrahman/HackerRank | /01 Algorithms/02 Implementation/Circular-Array-Rotation.py | 1,807 | 4.28125 | 4 | '''
John Watson performs an operation called a right circular rotation on an array of integers, [a0, a1, a2, an-1]. After performing one right circular rotation operation, the array is transformed from [a0, a1,
a2, an-1] to [an-1, a0, a1, a2, an-2].
Watson performs this operation k times. To test Sherlock's ability to... | true |
5d0df4565c0a9c8ddd4442a609050631ae3310f9 | kumarchandan/Data-Structures-Python | /3-linked_lists/c6_detect_loop_in_linked_list/main-floyd-algo.py | 1,201 | 4.125 | 4 | '''
This is perhaps the fastest algorithm for detecting a linked list loop. We keep
track of two iterators, onestep and twostep.
onestep moves forward one node at a time, while twostep iterates over two nodes. In this way,
twostep is the faster iterator.
By principle, if a loop exists, the two iterators will meet. ... | true |
6fb12a06b85202ca2e2e90d5baf5d198727d7cf0 | Unrealplace/Python | /Python基础教程/loop.py | 395 | 4.34375 | 4 | # 循环的使用
namelist = ['fanyangyang','yangyangfan','oliverlee']
nametuple = ('hello','world','nice ','to','meet you')
# Python的循环有两种,一种是for...in循环,依次把list或tuple中的每个元素迭代出来,看例子:
for name in namelist:
print(name)
pass
for item in nametuple:
print(item)
pass
#遍历索引的方式
for x in range(1,10):
print(x)
pass | false |
9985b32d8d79fb4bfde8d0ffbec712e5b88ac8d4 | gomanish/Python | /Linked_List/add_and_delete_last_node.py | 910 | 4.25 | 4 | # Add and Delete Last Node in a linked list
class Node:
def __init__(self,val):
self.value = val
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def printallnodeval(llist):
temp=llist.head
while temp:
print temp.value
temp=temp.next
return
de... | true |
eae27424746c9423d92b345429cf1acb5d5656e9 | gomanish/Python | /basic/threesquares.py | 348 | 4.1875 | 4 | '''Write a Python function threesquares(m) that takes an integer m as input and returns True.
if m can be expressed as the sum of three squares and False otherwise.
(If m is not positive, your function should return False.)'''
def threesquares(n):
if n<0:
return False
while(n%4==0):
n=n/4
n=n-7
if(n%8==0):
... | true |
39bcbe9d664219f56608744cc6e2b0e88261fa2a | carriehe7/bootcamp | /IfStatementBasics.py | 1,118 | 4.125 | 4 | # if statements basics part 1
salary = 8000
if salary < 5000:
print('my salary is too low, need to change my job')
else:
print('salary is above 5000, okay for now')
age = 30
if age > 50:
print('you are above 50. you are a senior developer for sure')
elif age > 40:
print('your age is bigger than 40. you... | true |
e180350b63cc478a403a3df45cc5e781d70c5d5f | carriehe7/bootcamp | /TupleCollectionHW.py | 1,642 | 4.5625 | 5 | # 1. Create a ‘technological_terms’ tuple that will contain the following items:
# a. python
# b. pycharm IDE
# c. tuple
# d. collections
# e. string
technological_terms = ('python', 'pycharm IDE', 'tuple', 'collections', 'string')
print('technological terms tuple collection : ' +str(technological_terms))
# 2. Print t... | true |
572eb584fb562b811de2b73c517ed4fffbf5c8e2 | mbonnemaison/Learning-Python | /First_programs/boolean_1.py | 730 | 4.15625 | 4 | """
def list_all(booleans):
Return True if every item in the list is True; otherwise return False
list_all([]) = True
list_all([True]) = True
list_all([False]) = False
list_all([True, False, True]) = False
raise Exception("TODO")
"""
def list_all(booleans):
for bools in booleans:
if not isinstance(bools, b... | true |
2205eee999f0175dbb14cc40d239bd819fc83baa | KarenAByrne/Python-ProblemsSets | /fib.py | 1,159 | 4.21875 | 4 | # Karen Byrne
# A program that displays Fibonacci numbers.
def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
n = n - 1
while n >= 0:
i, j = j, i + j
n = n - 1
return i
# Test the function with the following value. My name is Karen , so the first and l... | true |
c8cd572bde563d3cebd748dde843402cd1fb2077 | camaral82/Python_Self_Study_MOSH | /Dictionary.py | 506 | 4.28125 | 4 | """24/09/2020 - Thursday
Dictionary Exercise
Type a sequence of numbers and at the end
transcript each element.
In case of typing a character, show ! """
digits_mapping = {"1": "One", "2": "Two", "3": "Three",
"4": "Four", "5": "Five", "6": "Six",
"7": "Seven", "8": "Eight", "9"... | true |
72663f0656ad734acee538dc6aa8f8d67256d49a | saileshkhadka/SearchingAlgorithm-in-Python | /LargestElementfromlistinLinearTime.py | 2,475 | 4.1875 | 4 | # Problem Description
# The program takes a list and i as input and prints the ith largest element in the list.
# Problem Solution
# 1. Create a function select which takes a list and variables start, end, i as arguments.
# 2. The function will return the ith largest element in the range alist[start… end – 1].
# 3. Th... | true |
3f07333fe11b65981a4d530cc59ff45e42fe8225 | ssaroonsavath/python-workplace | /conversion/conversion.py | 977 | 4.25 | 4 | '''
Created on Jan 20, 2021
The objective is to make a program that can complete different conversions
'''
#Use input() to get the number of miles from the user. ANd store
#that int in a variable called miles.
miles = input("How many miles would you like to convert?")
#Convert miles to yards, using the following:... | true |
7686831590125c15617128a0115e1a23b084d528 | mayanderson/python-selenium-automation | /hw3_algorithms/algorithm_2.py | 298 | 4.15625 | 4 | def longestWord():
sentence = input('Please enter a sentence with words separated by spaces:')
words = sentence.split()
if len(words) == 0: return ""
if len(words) == 1: return words[0]
longest = ""
for word in words:
if len(word) > len (longest): longest = word
return longest | true |
658408212c2953a13931535581cbd34f9f446d83 | chokrihamza/opp-with-python | /try_except.py | 496 | 4.125 | 4 | try:
print(x)
except:
print("there is no value of x")
try:
print("Hello")
except:
print("Something went wrong")
else:
print("Nothing went wrong")
try:
print(x)
except:
print("Something went wrong")
finally:
print("The 'try except' is finished")
try:
f = open("demofile.txt", 'w')
f.write("Hello th... | true |
7ddab1a480e5e4ab6d33ce0bec4039a590547973 | Rohankrishna/Python_Scripting_Practice | /even_odd.py | 383 | 4.15625 | 4 | from math import sqrt
n = int(input("enter a number "))
check = int(input("Enter the number with which we want to check "))
if n % 4 == 0:
print("It is an even number and also a multiple of 4")
elif n%2==0:
print("It is an even number")
else:
print("It is an odd number")
if(n%check==0):
print(n, " is evenly divis... | true |
980b7a7e9e0eb54fdb5e45109285da68ca5dafec | brownd0g/Financial-Independence-Calculator | /Financial Independence Calculator.py | 2,070 | 4.375 | 4 |
# This function is used to make sure user inputs a valid number for each question
def validInput(question):
UI = input(question)
# The following will run until a positive real number is entered
while True:
try:
num = float(UI)
while num < 0:
num = float(input(... | true |
2c7883d2c464936c5fb2bfc6d6e62ccab313b6ce | ggsbv/pyWork | /compareDNA/AminoAlign.py | 1,526 | 4.21875 | 4 | #findLargest function finds and returns the largest DNA string
def findLargest(AA1, AA2):
largest = ""
if len(AA1) >= len(AA2):
largest = AA1
else:
largest = AA2
return largest
#align function compares two amino acid sequences and prints any differences (mutations)
def... | true |
e7c0faf8127f813db4bd4599198c8f6eda8ff552 | alexjohnlyman/Python-Exercises | /Inheritance.py | 1,003 | 4.21875 | 4 | # Inheritance
# Is an "is a" relationship
# Implicit Inheritance
class Parent(object):
def implicit(self):
print "PARENT implicit()"
def explicit(self):
print "PARENT explicit()"
def altered(self):
print "PARENT altered()"
class Child(Parent):
def implicit(self):
pri... | true |
298ab47829b2875bca88208e9d87d2d1ceb8a96f | LinuxLibrary/Python | /Py-4/py4sa-LA/programs/04-Classes.py | 864 | 4.28125 | 4 | #!/usr/bin/python
# Author : Arjun Shrinivas
# Date : 03.05.2017
# Purpose : Classes in Python
class Car():
def __init__(self):
print "Car started"
def color(self,color):
print "Your %s car is looking awesome" % color
def accel(self,speed):
print "Speeding upto %s mph" % speed
def turn(self,direction):
pri... | true |
97b7f50d9511e5acd7a86947b8bc5a367f4b589d | brookstawil/LearningPython | /Notes/7-16-14 ex1 Problem Square root calculator.py | 935 | 4.3125 | 4 | #7/16/14
#Problem: See how many odd integers can be subtracted from a given number
#Believe it or not this actually gives the square root, the amount of integers need is the square root!!
#number input
num = int(input("Give me a number to square root! "))
num_begin = num
#Loops through the subtractions
#defines the s... | true |
2af694a25d9f9174581cd14f3eafad232b278f83 | brookstawil/LearningPython | /Notes/7-14-14 ex6 Letter grades.py | 525 | 4.125 | 4 | #7-14-14
#Letter grades
#Input the grade
grade = input("What is the grade? ")
grade = grade.upper()
#Long way
#if grade == "A":
# print ("A - Excellent")
#else:
# if grade == "B":
# print("B - good!")
# else:
# if grade == "C":
# print("C - average")
# else:
# pri... | true |
ec1f9eb074b9429219c410c902a440cea069377e | brookstawil/LearningPython | /Notes/7-31-14 ex1 Determine whether a number (N) is prime.py | 958 | 4.1875 | 4 | #7/31/14
#Determine whether a number (N) is prime or not
#We only have to check numbers up to the integer square root of N.
import math
#This determines whether n is prime
#INPUT - a number to check
#OUTPUT - Ture if it is prime or False if is is not
def is_prime(n):
is_it_prime = True #We start with an assumpt... | true |
d85e661fcc6f61c320b8502dde6c185d5a50f78a | Struth-Rourke/cs-module-project-algorithms | /moving_zeroes/moving_zeroes.py | 787 | 4.34375 | 4 | '''
Input: a List of integers
Returns: a List of integers
'''
def moving_zeroes(arr):
# instantiating an empty, new_arr
new_arr = []
# loop over items in the array
for i in arr:
# if the value of the item in the array is not zero
if i != 0:
# append the value to the list
... | true |
3a9aaa5e252c042a99972e7a7146e17a9ddae7e4 | parandkar/Python_Practice | /brick_game.py | 933 | 4.15625 | 4 | """
This is a solution to the problem given at
https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/bricks-game-5140869d/
Patlu and Motu works in a building construction, they have to put some number of bricks N from one place to another, and starte... | true |
efccbfe53442920f68dba5e07a6de8f05ded48a4 | parandkar/Python_Practice | /seat.py | 733 | 4.1875 | 4 | """
This is a solution to the problem given at https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/seating-arrangement-1/
"""
# Using dictionaries to deduce the front seats and seat type
facing_seats = {1:11, 2:9, 3:7, 4:5, 5:3, 6:1, 7:-1, 8:-3, 9... | true |
625c2fb420c9fb2670a4bf01db08aaa52ccc5080 | parandkar/Python_Practice | /count-divisors.py | 694 | 4.1875 | 4 | """
This is a solution to the problem given at https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/count-divisors/
You have been given 3 integers - l, r and k. Find how many numbers between l and r (both inclusive) are divisible by k. You do not need ... | true |
a4cfcbfcad47b05b4257e2251ba015f2226761ae | chuene-99/Python_projects | /mostwords.py | 410 | 4.25 | 4 | #program that counts the most common words in a text file.
file=open(input('enter file name: '))
list_words=list()
dict_words=dict()
for line in file:
line=line.rstrip()
line=line.split()
for word in line:
dict_words[word]=dict_words.get(word,0)+1
for k,v in dict_words.items():
list_wo... | true |
744f607a516a3d874bd33b80c8b599a75e18e2a2 | rednikon/Python | /String-Functions/mymodB.py | 937 | 4.21875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 9 17:21:10 2019
@author: veemac
"""
COMMA = ','
SPACE = ' '
BLANK = ''
PERIOD = '.'
name = "Alexandria Ocasio-Cortez"
def initials(name):
"""Given a name returns the initials.
>>> initials('Elon Reeve Musk')
'E.R.M.'
>>> initial... | false |
a2c58ea778e8581d580dff71681023bb0b2f53e0 | porkpiie/pythonweek | /asciicheck.py | 319 | 4.125 | 4 | alpha=input("Enter any letter: ")
if ord(alpha)>=65 and ord(alpha)<=90:
print("Capital letter")
else:
if ord(alpha)>=97 and ord(alpha)<=122:
print("Lower case")
else:
if ord(alpha)>=48 and ord(alpha)<=57:
print("Digits")
else:
print("Any other character") | false |
a6c81c911cda7b995456e893b71b400713a8c34d | ry-blank/Module-7 | /basic_list.py | 878 | 4.53125 | 5 | """
Program: basic_list_assignment
Author: Ryan Blankenship
Last Date Modified: 10/6/2019
The purpose of this program is to take user
input then display it in a list.
"""
def make_list():
"""
function to return list of user input from function get_input()
:return: returns list of user input
... | true |
8d022903c89a5f24d5b99aba8e273ecdce4c2bb2 | Hail91/Algorithms | /recipe_batches/recipe_batches.py | 1,683 | 4.125 | 4 | #!/usr/bin/python
import math
test_recipe = { 'milk': 100, 'butter': 50, 'flour': 5 } # Test for PT
test_ingredients = { 'milk': 132, 'butter': 48, 'flour': 51 } # Test for PT
def recipe_batches(recipe, ingredients):
batches = 0 # Initalize a batches variable to zero
while True: # Using a while loop to keep... | true |
e1fbb0394458201d27b22d8df48b5df97b5e31c1 | ShabnamSaidova/basics | /dogs.py | 2,438 | 4.46875 | 4 | class Dog():
"""A simple attempt to model a dog"""
def __init__(self, name, age):
"""Initialize name and age attributes."""
self.name = name
self.age = age
def sit(self):
"""Simulate a dog sitting in response to a command."""
print(self.name.title() + " is... | true |
cb5b3c72a8482ce9be3b8b4991527eeada7c27fd | Marcus-Mosley/ICS3U-Unit4-03-Python | /squares.py | 1,024 | 4.40625 | 4 | #!/usr/bin/env python3
# Created by Marcus A. Mosley
# Created on October 2020
# This program finds the squares of all natural numbers preceding the
# number inputted by the user
def main():
# This function finds the squares of all natural numbers preceding the
# number inputted by the user
# In... | true |
b18eda77ffe0121752bb93beb291eab3184f0df2 | Udayin/Flood-warning-system | /floodsystem/flood.py | 1,586 | 4.25 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 24 18:01:03 2017
@author: Rose Humphry
"""
from floodsystem.utils import sorted_by_key
def stations_level_over_threshold(stations, tol):
''' a function that returns a list of tuples,
where each tuple holds (1) a station at which the latest
relat... | true |
fd5982d54adcca536876f48003c814f73ea227f6 | G3Code-CS/Algorithms | /making_change/making_change.py | 2,643 | 4.375 | 4 | #!/usr/bin/python
import sys
def making_change(amount, denominations):
# we can initialize a cache as a list (a dictionary
# would work fine as well) of 0s with a length equal to the amount we're
# looking to make change for.
cache = [0] * (amount + 1)
# Since we know there is one way to
... | true |
de000242afafc8fa391cce60c3ad3a0f3c356c15 | balapitchuka/python-utilities | /operator-override.py | 571 | 4.46875 | 4 | # example of overriding operators
# operator overriding
class Value:
def __init__(self, value):
self.value = value
# - __sub__, * __mul__, ** __pow__, / __truediv__, // __floordiv__, % __mod__
# << __lshift__, >> __rshift__, & __and__, | __or__, ^ __xor__, ~ __invert__
# < __lt__, <= __le__, ==... | false |
dc80c11937f7c56683556b60f211fd3504539c60 | Avulaparvathi/pythontraining | /rock paper sc game.py | 1,246 | 4.15625 | 4 | p1=input("enter the choice")
p2=input("enter the choice")
while True:
if p1==p2:
print("tie")
elif p1=="rock":
if p2=="scissors":
print("congratulatipns to p1")
else:
print("congratulation to p2")
elif p1=="paper":
if p2=="rock":
print("congratulations to p1")
else:
... | false |
8bbdb6e9157642e89e718d51a76f674d5fa177be | ethirajmanoj/Python-14-6-exercise | /14-quiz.py | 1,062 | 4.1875 | 4 | # Create a question class
# Read the file `data/quiz.csv` to create a list of questions
# Randomly choose 10 question
# For each question display it in the following format followed by a prompt for answer
"""
<Question text>
1. Option 1
2. Option 2
3. Option 3
4. Option 4
Answer ::
"""
import csv
score = 0
scor... | true |
b9c7eee17e69a1836d0cbf817509a874ebe5514f | nsvir/todo | /src/model/list_todo.py | 1,158 | 4.125 | 4 | class ListTodo:
"""
List Todo contains name
Initialize an empty list
lst = ListTodo()
To get list
>>> lst.list()
[]
To add element in list
lst.add_list(TaskList())
To check if element is contained in list
lst.contains_list(TaskList())
True
"""
def __init__(s... | true |
acee050f0b233e3769df049dc44bd5cfb6af31e3 | UJurkevica/python-course | /homework/week2/exercise1.py | 538 | 4.21875 | 4 | #1a
for num in range(0,11):
if num % 3 == 0:
continue
else:
print(f'number {num}')
#1b
def print_nums():
for num in range(0,10):
if num % 3 == 0:
continue
else:
print(f'Number in function range {num}')
print_nums()
#1c
max_number = int(input('Enter ... | false |
f52d7a33408b9645e8b66ddd580e9192732b3021 | vitaliy-developer/learning_python | /5.operator.py | 762 | 4.15625 | 4 | number = int(input("Enter a number: "))
if number > 5:
print("This number > 5")
else:
print("Number < 5")
name = input("Enter you name: ")
if name == "Alex":
print("You have entered", name)
print("This is my name, too.")
else:
print("You not Alex")
x = int(input(" x = "))
if 0 < x < 7:
print... | false |
d306f43d54d0a2713bc23a714a949af59714e9f4 | Yosolita1978/Google-Basic-Python-Exercises | /basic/wordcount.py | 2,898 | 4.34375 | 4 |
"""Wordcount exercise
Google's Python class
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fi... | true |
9368e573f0bd816c214165e71571bccfed73076d | ThomasP1234/DofE | /Week 2/GlobalVariables.py | 527 | 4.125 | 4 | # Global Variables and Scope
# ref: https://www.w3schools.com/python/
# Author: Thomas Preston
x = "awesome" # When this is commented out there is an error because the final print doesn't know what x is
def myfunc():
x = "fantastic" # Where as when this is commented out, the global x is printed
print("Python is "... | true |
95f146d5bd21e8f40343ea95c4f7e8f7ea0da0f8 | ThomasP1234/DofE | /Week 5/WhileLoops.py | 410 | 4.21875 | 4 | # One of the primary loops in python
# ref: https://www.w3schools.com/python/
# Author: Thomas Preston
a = 1
while a < 10:
print(a)
a = a + 1 # Adds 1 to a each loop
b = 1
while b < 6:
print(b)
if b == 3:
break
b += 1
c = 0
while c < 6:
c += 1
if c == 3:
continue
print(c) # skips this ste... | true |
5caa1ea1ab9aab2e1a85af0092d644ce36d8e8b1 | Mrityunjay6492/python | /day program.py | 1,929 | 4.375 | 4 | # To determine the day at that the Entered date
def date(dd,mm,yyyy):
m=[31,28,31,30,31,30,31,31,30,31,30,31] #assinment, number of days in month's
if(yyyy%4==0): #increment of 1 for a leap year in the month of feb
m[1]=29
days=0
for i in range(0,mm-1,1): ... | false |
9fba4c0eb7046f9b22e1f3a83e0752c961fedcd4 | Yfaye/AlgorithmPractice | /python/InsertInterval.py | 1,756 | 4.25 | 4 | # Insert Interval
# Description
# Given a non-overlapping interval list which is sorted by start point.
# Insert a new interval into it, make sure the list is still in order and non-overlapping (merge intervals if necessary).
# Example
# Insert [2, 5] into [[1,2], [5,9]], we get [[1,9]].
# Insert [3, 4] into [[1,2]... | true |
4147e66c5a23d70dfe1d885f5816949e808b52d5 | GitFromAleksey/pyLearn | /OOP/simpleclass.py | 1,011 | 4.34375 | 4 |
##------------------------------------------------------------------------------
class SimpleClass: # имя класса
u'Simple Class __doc__'
var = 87 # совместно используемая переменная
'Simple Class constructor'
def __init__(self):
## self.var = 99
print('SimpleClass.Constructor ')
... | false |
bb711f3653e9dd1ae3f3a88d75a2fd038df612dc | vanctate/Computer-Science-Coursework | /CSCI-3800-Advanced-Programming/HW03/Problem1_Python/piece.py | 1,365 | 4.1875 | 4 | # Patrick Tate
# CSCI 3800 HW03 | Problem 1
# class to represent a black or white piece to be inserted into an Othello gameboard
# piece has a color(B/w), and a row and column in array notation, to be used with the Grid class
class Piece:
# subtract 1 from row and column for array notation
def __init__(self, ... | true |
796695d867757555edc2d8fb69c3ece721544809 | test-python-rookie/python_study | /No11_集合.py | 751 | 4.125 | 4 | # 集合(set)是一个无序的不重复元素序列。
# 可以使用大括号 {} 或者 set() 函数创建集合,注意:创建一个空集合必须用set()而不是{},因为{}是用来创建一个空字典。
# 集合会自动去重且无序
parame1 = {"apple", "blue", "people", "people"}
print(parame1)
parame2 = set("好好学习,天天向上!!!")
print(parame2)
# 将元素 x 添加到集合 s 中,如果元素已存在,则不进行任何操作。
parame1.add("look")
print(parame1)
# 还有一个方法,也可以添加元素,且参数可以是列表,元组,字典等,语法... | false |
89a568f79f10a3bf0370d01f195813475979832a | akeeton/leetcode-python | /0283-move-zeroes.py | 1,676 | 4.1875 | 4 | """
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the
non-zero elements.
Example:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations.
"""
class Solution... | true |
5a7355772688b12e1897a208b6f3677ac36260e2 | Anz131/luminarpython | /Functions/functional programming/map.py | 397 | 4.21875 | 4 | # map to cover evey data in a list
# arr=[2,3,4,5,6]
#
# #find squares
#
# def square(num):
# return num**2
# #map(function?,iterable)
#
# squarelist=list(map(square,arr))
# print(squarelist)
# arr=[2,3,4,5,6]
#
# squarelist=list(map(lambda num:num**2,arr))
# print(squarelist)
# lst=["anu","appu","achu","kunju"... | false |
2319f0735e3516b43da4890f2682fc9d9055868f | harekrushnas/python_practice | /guess_the_number.py | 1,513 | 4.21875 | 4 | #The program will first randomly generate a number unknown to the user. The user needs to guess what that number is.
# Reference link : https://knightlab.northwestern.edu/2014/06/05/five-mini-programming-projects-for-the-python-beginner/
import random
#from colorama import*
ran = random.randint(0,1000)
#len1=len(str(... | true |
de3da113c7e0bbc9f73c2f2182539b2b0bb266c6 | frankPairs/head-first-python-exercises | /chapter_4_functions_modules/vsearch_set.py | 235 | 4.1875 | 4 | def search_for_vowels(word: str) -> set:
"""Returns any vowels found in a supplied word"""
vowels = set('aeiou')
return vowels.intersection(set(word))
print(search_for_vowels("francisco"))
print(search_for_vowels("sky"))
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.