blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
c75d93e681c3249f20724da3ac8f6719b683021f | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_332.py | 743 | 4.125 | 4 | def main():
temp = float(input("What is the temperature in degrees? "))
scale = input("What is the scale: Celsius (C) or Kelvin (K)? ")
if scale == "C":
if temp <= 0:
print("At this temperature, water is a solid.")
elif (temp > 0) and (temp < 100):
print("At this temp... | true |
0eb4be20b6512b4652c20a39b17e828f3659b886 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_329.py | 842 | 4.25 | 4 | def main():
temperature = float(input("Please enter the temperature:"))
units = input("Please enter 'C' for Celcius or 'K' for Kelvin:")
if units == "K":
ctemp = temperature - 273.2
if ctemp <= 0:
print ("At this temperature, water is a (frozen) solid.")
elif ctemp > 0 an... | true |
299a71e6e3a87d14fbc031789b76b0907d2bfcf5 | sabias-del/TrainBrainPython | /list_comprehension.py | 456 | 4.25 | 4 | # Генераторы списков
listone = [2, 3, 4]
listtwo = [2 * i for i in listone if i > 2]
print(listtwo)
# Передача кортежей и словарей в функции
def powersum(power, *args):
"""Возвращает сумму аргументов, возведённых в указанную степень."""
total = 0
for i in args:
total += pow(i, power)
return ... | false |
f8ce16390e17c424df40e7612d2d166037abe398 | AndyLee0310/108-1_Programming | /HW026.py | 591 | 4.34375 | 4 | """
計算出最小公倍數
輸入說明:
兩個正整數
輸出說明:
這兩個正整數的最小公倍數。
Sample input:
2
3
Sample output:
6
((維基百科,最小公倍數:
https://zh.wikipedia.org/wiki/%E6%9C%80%E5%B0%8F%E5%85%AC%E5%80%8D%E6%95%B8
"""
def number(x,y):
if x > y :
maxnum = x
else:
maxnum = y
while(True):
if ((maxn... | false |
9bf77702fe2c812f96a6e4adbb3d3061dabfff40 | AndyLee0310/108-1_Programming | /HW018.py | 1,791 | 4.125 | 4 | """
請使用 while loop或for loop
第一個輸入意義為選擇三種圖形:
1 三角形方尖方面向右邊
2 三角形方尖方面向左邊
3 菱形
第二個輸入意義為畫幾行
(奇數,範圍為 3,5,7,9,....,21)
input
1 (第一種圖形,三角形尖方面向右邊)
9 (共 9 行)
--------------------------
output
*
**
***
****
*****
****
***
**
*
---------------------------
input
2 (第二種圖形,三角形尖方面向左邊)
5 (共 5 行)
----------... | false |
e57a1246ce35b0a2bad2cd2002c18995ddd7d640 | GMwang550146647/network | /0.leetcode/0.基本数据结构/4.散列/4.2.解决散列冲突:数据项链chaining.py | 947 | 4.125 | 4 | #例如python的字典结构
'''
1.解决冲突hash函数实现示例):
问题:在数列【26,77,93,17,31,54】数列中查找是否存在某个数
解决:利用hashfunc= num%11的方法把数放在十一个槽中,每个槽都是一个数组
'''
class hashTable:
def __init__(self,arr,volumn=11):
self.hashTable=[[] for i in range(11)]
self.volumn=volumn
self.initHashtable()
print(self.hashTable... | false |
8b61c267e2e4b0da7c2d3565709cdd0dce617ddb | GMwang550146647/network | /python基本语法/1.基本方法/1.0基本语法/9.闭包.py | 913 | 4.1875 | 4 | '''
闭包:
1.函数中定义的函数
2.外部函数把内部函数返回
3.这内部函数引用外部函数的值
作用:
1.保存并返回闭包时的状态(外层函数变量)
实现原理:
由于函数还没去除引用,所以其对应的内存尚未被消掉
'''
'''1.调用外层函数的值'''
def outterfunc(c):
a=100
def inner_func():
b=99
print(a,b,c)
print(locals())
return inner_func
x=outterfunc(10)
x()
'''2.调用同级函数'''
def outfun(c):
a=10... | false |
4f63d8015f9941746f8d00760d7de222308dd31a | GMwang550146647/network | /1.networkProgramming/2.parallelProgramming/3.coroutines/2.pythonCoroutines/2.Awaitables.py | 2,275 | 4.15625 | 4 | """
三种 Awaitable Objects
1.Coroutines
2.Tasks
3.Futures
"""
import asyncio
import concurrent.futures
"""
1.Coroutines
async 包装的函数都会转换成一个Coroutines函数,如果没有await,函数不会调用,会返回Coroutines对象
"""
def coroutines():
"""用于直接运行的任务"""
async def nested():
return 42
async def main():
# Nothing happens i... | true |
9c93463506fcd2ddf6ba8b205ab3a7f27ebaf944 | Azure-Whale/Kazuo-Leetcode | /Array/238. Product of Array Except Self.py | 2,176 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File : 238. Product of Array Except Self.py
@Time : 10/21/2020 10:37 PM
@Author : Kazuo
@Email : azurewhale1127@gmail.com
@Software: PyCharm
'''
class Solution:
"""
The solution is to create two lists within same length as the given array, since each... | true |
9944355759d50508317cfbe562587bf93c874357 | Smoearn/katas | /python/kt7/short_word.py | 663 | 4.1875 | 4 | # def find_short(s):
# container = s.split(' ')
# max_lengt = len(s)
# for i in container:
# if len(i) < max_lengt:
# max_lengt = len(i)
# return max_lengt # l: shortest word length
def find_short(s):
return min([len(x) for x in s.split(' ')])
print(find_short("bitcoin take ... | false |
ad4e5783ab8452552b9e606143057fab8bfcdf84 | Hunters422/Basic-Python-Coding-Projects | /python_if.py | 290 | 4.25 | 4 | num1 = 12
key = True
if num1 == 12:
if key:
print('Num1 is equal to Twelve and they have the key!')
else: print('Num1 is equal to Twelve and they do no have the key!')
elif num1 < 12:
print('Num1 is less than Twelve!')
else:
print('Num1 is not eqaul to Twelve!')
| true |
f1b18f3fc959db741f9d42643a149d175dd1f162 | zeejaykay/Python_BootCamp | /calculator.py | 1,753 | 4.34375 | 4 |
# using while loop to continuously run the calculator till the user wants to exit
while(True):
print("\n Zaeem\'s Basic Calculator\n")
print("Please enter two numbers on which you wish to perform calculation's and the operand\n") # displaying instructions
num_1 = input("Please enter the 1st number:\n") ... | true |
88e69cba39a474480bfb14b421a2e600392199b9 | TrendingTechnology/rnpfind | /website/scripts/picklify.py | 1,863 | 4.25 | 4 | """
Picklify is a function that works similar to memoization; it is meant for
functions that return a dictionary. Often, such functions will parse a file to
generate a dictionary that maps certain keys to values. To save on such overhead
costs, we "picklify" them the first time they are called (save the dictionary in
a... | true |
03ce63b031ca790b622d518b4b8813642fdf46b6 | Gafficus/Delta-Fall-Semester-2014 | /CST-186-14FA(Intro Game Prog)/N.G.Chapter5/N.G.Project2.py | 954 | 4.53125 | 5 | #Created by: Nathan Gaffney
#21-Sep-2014
#Chapter 5 Project 1
#This program tell the user where they would go.
directions = {"north" : "Going north leads to the kitchen.",
"south" : "GOing south leads to the dining room.",
"east" : "Going east leads to the entry.",
"west" : "Go... | true |
4fc3b1c621eeaf45191631dd72e5f2a34251efc3 | odora/CodesNotes | /Python_100_examples/example1.py | 1,947 | 4.28125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2019/1/26 16:45
@Author : cai
examples come from http://www.runoob.com/python/python-exercise-example1.html
"""
# ============== Example 1 ======================================
# 有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
# ===================... | false |
64f04193517dea19c5cced41fbceb9093f5f229a | javabyranjith/python | /py-core/string/string-fn.py | 295 | 4.15625 | 4 | name = 'Ranjith'
print(len(name))
print(name.count('a'))
print(name.upper()) # original string won't be modified
print(name.lower())
print(name.find('j'))
print(name.find('H')) # find returns index
print(name.find('an'))
print(name.replace('ji', 'gi'))
print('jith' in name) # checks contains
| false |
dc04fb45db7a16bae44deaebf0e4c7729f46c6ca | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 10 Tuples/Code/Lab 10.6 Tuples are Comparable.py | 488 | 4.125 | 4 | __author__ = 'Kevin'
# 08/04/2015
# Tuples are Comparable
# The comparison operators work with tuples and other sequences. If the first item is equal, Python goes on to the
# next element, and so on, until it finds elements that differ.
print (0, 1, 2) < (5, 1, 2)
# True
print (0, 1, 2000000) < (0, 3, 4)
# True
prin... | true |
3a7ecaea275e0022dc6bb928872e6d9a11360ef7 | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 9 Dictionaries/Code/Lab 9.10 Two Iteration Variables.py | 844 | 4.28125 | 4 | __author__ = 'Kevin'
# 06/04/2015
# We loop through the key-value pairs in a dictionary using *two* iteration variables.
# Each iteration, the first variable is the key and the second variable is the corresponding value for the key.
jjj = {'chuck': 1, 'fred': 42, 'jan': 100}
for aaa,bbb in jjj.items():
print aaa... | true |
b9516444d75abd0141d923136db6dfe47c7ad99d | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 8 Lists/Code/Lab 8.10 Building a list from scratch.py | 448 | 4.4375 | 4 | __author__ = 'Kevin'
# 05/04/2015
# BUILDING A LIST FROM SCRATCH
# We can create an empty list and then add elements using the append method
stuff = list()
print stuff
stuff.append("book")
print stuff
other_stuff = []
print other_stuff
other_stuff.append("other book")
print other_stuff
# The list stays in order ... | true |
18a316129cc590ba81d98d033617cd7776154603 | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 7 Files/Code/Lab 7.1 Opening a File.py | 849 | 4.125 | 4 | __author__ = 'Kevin'
# 24/03/2015
# Opening a File
# Before we can read the contents of the file, we must tell Python which file we are going to work with and what we will
# be doing with the file
# This is done with the open() function
# open() returns a 'file handle' - a variable used to perform operations on the ... | true |
51ce3c640601771132427ca633d37b66e0d86302 | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 3 Conditional/Week 3.3 Try and Except.py | 340 | 4.25 | 4 | # You surround a dangerous section of code with try and except
# If the code in the try works - the except is skipped
# If the code in the try fails - it jumps to the except section
astr = 'Hello Bob'
try:
istr = int(astr)
except:
istr = -1
print "First",istr
astr = '123'
try:
istr = int(astr)
except:
istr = -1
... | true |
1c323c793a58d3736ccbec00ffbccb447f7ca21c | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 9 Dictionaries/Code/Lab 9.8 Definite Loops and Dictionaries.py | 376 | 4.4375 | 4 | __author__ = 'Kevin'
# 06/04/2015
# Even though dictionaries are not stored in order, we can write a for loop that goes through all the entries in a
# dictionary - actually it goes through all of the keys in the dictionary and looks up the values
counts = { 'chuck' : 1 , 'fred' : 42, 'jan': 100}
for key in counts:
... | true |
44df3f26086799bea3f88ec4e814ee785fba53ef | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 8 Lists/Code/Lab 8.1 Lists Introduction.py | 1,057 | 4.1875 | 4 | __author__ = 'Kevin'
# 01/04/2015
# A List is a kind of Collection
# - A collection allows us to put many values in a single "variable"
# - A collection is nice because we can carry all many values around in one convenient package.
friends = ['Joseph', 'Glenn', 'Sally']
carryon = ['socks', 'shirt', 'perfume']
print f... | true |
151748740604378d807b3bc5fd24e1be09c73350 | kevmct90/PythonProjects | /Python-Programming for Everybody/Week 6 Strings/Code/Lab 6.15 Making everythin UPPERCASE.py | 350 | 4.21875 | 4 | __author__ = 'Kevin'
# 23/03/2015
# You can make a copy of a string in lower case or upper case.
# Often when we are searching for a string using find() - we first convert the string to lower case
# so we can search a string regardless of case.
greet = 'Hello Bob'
nnn = greet.upper()
print nnn
# HELLO BOB
www = gree... | true |
4ff057f5206a6d6509d5de02f88c51b495ae9bda | ScoJoCode/ProjectEuler | /problem19/main.py | 881 | 4.15625 | 4 | import time
start = time.time()
def isLastDay(day,year,month):
if day==31 and (month==1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12):
return True
if day==30 and (month ==4 or month == 6 or month == 9 or month == 11):
return True
if month == 2 and day==28:
if ... | true |
ce602fd6526a830a0bab118951cb9a16c21efd8e | shivam0071/exploringPython | /Python_2018/Customizing_String_Formatting.py | 1,024 | 4.28125 | 4 | # Customizing String Formatting
_formats = {
'ymd' : '{d.year}-{d.month}-{d.day}',
'mdy' : '{d.month}/{d.day}/{d.year}',
'dmy' : '{d.day}/{d.month}/{d.year}'
}
class Date:
def __init__(self, year, month, day):
self.year = year
self.month = month
self.day = day
def __format__(self, code)... | false |
3d698dbd2f2e42af6f8abdd40e96d43c5bcf409a | LiawKC/CS-Challenges | /GC08.py | 627 | 4.21875 | 4 | weight = float(input("What is your weight"))
height = float(input("What is your height in m"))
BMI = weight / height**2
print(BMI)
if BMI < 18.5:
print("Bro head to mcdonalds have a big mac or 2 you're probably anorexic")
if BMI < 25 and BMI > 18.5:
print("Ok, you're average but don't get fat or we... | true |
ed224eb604a4783850d5dbecb0b25f0c582fcdc8 | sgetme/python_turtle | /turtle_star.py | 1,104 | 4.1875 | 4 |
# first we need to import modules
import turtle
from turtle import *
from random import randint
# Drawing shape
# I prefer doing this with a function
def main():
# set background color of turtle
bgcolor('black')
# create a variable called H
H = 1
# set speed of turtle
... | true |
980e284b513a95820bae35101c10120b4dd1e208 | MohamedNour95/Py-task1 | /problem9.py | 240 | 4.5 | 4 | PI = 3.14
radius = float(input('Please enter the radius of the circle:'))
circumference = 2 * PI * radius
area = PI * radius * radius
print("Circumference Of the Circle = "+ str(circumference))
print("Area Of the Circle = "+ str(area)) | true |
4ec65a6426dfa1e36d68db08cdeb274fca9840d3 | miliart/ITC110 | /nth_fibonacci_ch8.py | 1,116 | 4.25 | 4 | # A program to calculate the nth spot in the Fibonacci
# Per assignment in the book we start at 1 instead of which is the result of 0 plus 1
# by Gabriela Milillo
def main():
n= int(input("Enter a a spot in the Fibonacci sequence: "))#variable n is the user input
#per the book Fibonacci sequence starts at ... | true |
4a430ff5e8d1f8fdea9d8cad3f5656a39211ced9 | mdhatmaker/Misc-python | /interview-prep/geeks_for_geeks/stack_and_queue/queue_using_two_stacks.py | 1,372 | 4.15625 | 4 | import sys
# https://practice.geeksforgeeks.org/problems/queue-using-two-stacks/1
# Implement a Queue using 2 stacks s1 and s2.
###############################################################################
class Stack:
def __init__(self):
self.stack = []
def push(self, x):
self.stack.app... | false |
10fdb82b732b524a4a9526758e8579e468f9aae0 | mdhatmaker/Misc-python | /interview-prep/geeks_for_geeks/bit_magic/rotate_bits.py | 1,506 | 4.40625 | 4 | import sys
# https://practice.geeksforgeeks.org/problems/rotate-bits/0
# https://wiki.python.org/moin/BitwiseOperators
# Given an integer N and an integer D, you are required to write a program to
# rotate the binary representation of the integer N by D digits to the left as well
# as right and print the results in ... | true |
9dcbb78a4064439289522558200e106eb204d665 | mdhatmaker/Misc-python | /interview-prep/geeks_for_geeks/divide_and_conquer/binary_search.py | 1,507 | 4.1875 | 4 | import sys
# https://practice.geeksforgeeks.org/problems/binary-search/1
# Given a sorted array A[](0 based index) and a key "k" you need to complete
# the function bin_search to determine the position of the key if the key
# is present in the array. If the key is not present then you have to return -1.
# The arg... | true |
52fa21fa353bc13fb7439569009b710fa37b6a46 | mdhatmaker/Misc-python | /interview-prep/geeks_for_geeks/tree_and_bst/print_bottom_view.py | 2,329 | 4.34375 | 4 | import sys
from BinaryTree import BinaryNode, BinaryTree
from StackAndQueue import Stack, Queue
# https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1
# Given a binary tree, print the bottom view from left to right.
# A node is included in bottom view if it can be seen when we look at the tree fr... | true |
5c29aa549d09b85456b9ee25e5895d9aefd369dd | pi-bansal/studious-happiness | /DP_Practice/Tabulation/how_sum.py | 887 | 4.125 | 4 | def how_sum(target_sum, numbers):
# Expected return is an array of integers that add up to target_sum
if target_sum == 0:
# Zero using empty array
return []
# Init the table with null values
sum_table = [None] * (target_sum + 1)
# Seed value for 0
sum_table[0] = []
for ind... | true |
d25cbf0e3769be7d5e4e4a71d2b4deaebd721052 | pi-bansal/studious-happiness | /DP_Practice/memoization/how_sum_basic.py | 645 | 4.125 | 4 | def how_sum(target_sum, numbers):
"""Function that return a subset of numbers that adds up to the target_sum"""
if target_sum == 0:
return []
if target_sum < 0:
return False
for num in numbers:
remainder = target_sum - num
return_val = how_sum(remainder, numbers)
... | true |
3c4a36e49bff8e952264bf32b54f59a734ef7535 | vv1nn1/dsp | /python/q8_parsing.py | 1,679 | 4.625 | 5 | # The football.csv file contains the results from the English Premier League.
# The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of
# goals scored for and against each team in that season (so Arsenal scored 79 goals
# against opponents, and had 36 goals scored against them). Write a program t... | true |
d92f3b6c81eff37101c26324694e872272f8762c | leerobert/python-nltk-intro | /code/process.py | 1,022 | 4.125 | 4 | # Sample code for processing a file containing lines of raw text
import nltk
raw = open("reviews.txt").read() # read in the entire file as a single raw string
tokens = nltk.word_tokenize(raw) # tokenizes the raw string
text = nltk.Text(tokens) # generate the text object
# Cleaning the text of punctuation
impo... | true |
e8b0861e65e8dde5a5eeb13f52763988cb0ac317 | szhao13/interview_prep | /stack.py | 498 | 4.125 | 4 | class Stack(object):
def __init__(self):
"""Initialize an empty stack"""
self.items = []
def push(self, item):
"""Push new item to stack"""
self.items.append(item)
def pop(self):
"""Remove and return last item"""
# If the stack is empty, return None
# (it would also be reasonable to throw an excepti... | true |
2c5569c99d54e1fa5aa523b6071862f237bc6334 | DemondLove/Python-Programming | /CodeFights/28. alphabetShift.py | 951 | 4.3125 | 4 | '''
Given a string, your task is to replace each of its characters by the next one in the English alphabet; i.e. replace a with b, replace b with c, etc (z would be replaced by a).
Example
For inputString = "crazy", the output should be alphabeticShift(inputString) = "dsbaz".
Input/Output
[execution time limit] 4 s... | true |
fc2a2ca8d11b1c90f35118263132230e1b544ebb | DemondLove/Python-Programming | /CodeFights/42. Bishop and Pawn.py | 1,450 | 4.125 | 4 | '''
Given the positions of a white bishop and a black pawn on the standard chess board, determine whether the bishop can capture the pawn in one move.
The bishop has no restrictions in distance for each move, but is limited to diagonal movement. Check out the example below to see how it can move:
Example
For bishop... | true |
ce389515649fc3224a7175abeb1ed89ff8b5743e | makassigithub/core-python | /Book/chapter6.py | 2,867 | 4.25 | 4 | #6.1 Écrivez un programme qui convertisse en mètres par seconde et en km/h une vitesse fournie
#par l’utilisateur en miles/heure. (Rappel : 1 mile = 1609 mètres)
#mp = float(input("enter speed :\n"))
#print("the equivalent in km/h is: ", (mp*1609)/1000)
#print("the equivalent in m/ is: ", ((mp*1609)/1000)*1000/3600)... | false |
08cc42adae9c5077db60e1f49607b7a8c0fb9ddf | jaredscarr/data-structures | /linked_list.py | 2,235 | 4.125 | 4 | # -*- coding: utf-8 -*-
class Node(object):
"""Construct Node object."""
def __init__(self, val):
"""Initialize node object."""
self.val = val
self.next = None
class LinkedList(object):
"""Handle creation of a linked list."""
def __init__(self, iterable=None):
"""In... | true |
e3c870a1069eee7c09d0d2c66f7e1d7a04f8127c | jiangyu718/pythonstudy | /base/integrative.py | 509 | 4.15625 | 4 | listone = [2, 3, 4]
listtwo = [2*i for i in listone if i > 2]
print(listtwo)
def powersum(power, *args):
'''Return the sum of each argument raised to specified power.'''
total = 0
for i in args:
total += pow(i, power)
return total
exec('print(powersum(2,3,4))')
exec('print(powersum(2,10))')
eva... | true |
3ceab3ad04a845fcf81f46c24b4b612c7d7e3dc9 | booji/Exercism | /python/prime-factors/prime_factors.py | 707 | 4.28125 | 4 | import math
def prime_factors(natural_number):
factors = []
i = 2
# Find all prime '2' the remainder will be odd.
while natural_number%i == 0:
natural_number = natural_number // i
factors.append(i)
# Go up to sqrt(natural_number) as prime*prime cannot be greater then
# natural_... | true |
790d11daed36af486c57a4cb4a017798b1a9dcc4 | SimonCCooke/CodeWars | /SmallestInteger.py | 446 | 4.1875 | 4 | """Given an array of integers your solution should find the smallest integer.
For example:
Given [34, 15, 88, 2] your solution will return 2
Given [34, -345, -1, 100] your solution will return -345
You can assume, for the purpose of this kata, that the supplied array will not be empty."""
def findSmallestInt(arr):
... | true |
38f7f4defa13ac0cc35d78a54b90d7764f9e6116 | kwaper/iti0102-2018 | /pr08_testing/shortest_way_back.py | 1,586 | 4.25 | 4 | """Find the shortest way back in a taxicab geometry."""
def shortest_way_back(path: str) -> str:
"""
Find the shortest way back in a taxicab geometry.
:param path: string of moves, where moves are encoded as follows:.
N - north - (1, 0)
S - south - (-1, 0)
E - east - (0, 1)
W - west ... | true |
04ec308573556b4c9e216035cc5f2d65a9eaeb97 | SaifAlsaad/simplecalculator | /My-first-simple-calculator.py | 1,036 | 4.46875 | 4 | print("Welcome to Saif's calculator")
num1=input("Enter any number: ")
op=input("Choose any symbole + - * ** / % // == != < > <= >= = : ")
num2=input("last step to see the results: ")
num1=float(num1)
num2=float(num2)
if op=="+":
pls=num1 + num2
print(pls)
elif op=="-":
sub=num1-num2
print(sub)
elif op=... | false |
17f70272ddf81483bcf5b5c36377659a43174a8d | amiraHag/Python-Basic | /basic datatypes/variables.py | 584 | 4.4375 | 4 | #print any text using print function
print("Hello World!")
"""store value in variables"""
x=5
y=6
z= x+y
print(z)
""" know the type of the variable by using type()"""
print(type(z))
#make operations on numbers
x= 3+4*5
print(x)
# arithmatic operators four basic - + * /
# ** power ()parenthesis- use to identify whi... | true |
d2fd5afd38c0191cdc657af4e99e62da817b7f0f | theshevon/A2-COMP30024 | /adam/decision_engine.py | 2,458 | 4.1875 | 4 | from math import sqrt
from random import randint
class DecisionEngine():
"""
Represents the agents 'brain' and so, decides which node to move to next.
"""
EXIT = (999, 999)
colour = None
exit_nodes = None
open_node_combs = None
init_node... | true |
8273da9ef7fb33ab57d238d677465cebd66a07b0 | narokiasamy/internship1 | /06-20-19/temperatureConverter.py | 548 | 4.25 | 4 | # temperature must be typed with corresponding temperature scale unit! (ex: 32F or 68C)
temperature = str(input("temperature reading: "))
# temperature conversions
if "C" in temperature:
removeLetter = int(temperature.rstrip("C"))
fahrenheitCalculation = (int((removeLetter * 1.8) + 32))
print (str(fahrenheitCalc... | true |
a220c8cf2ae254f3a399cdfe17542ca9f508780d | sucman/Python100 | /11-20/14.py | 1,419 | 4.125 | 4 | # -*- coding:utf-8 -*-
'''
将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5。
程序分析:对n进行分解质因数,应先找到一个最小的质数k,然后按下述步骤完成:
(1)如果这个质数恰等于n,则说明分解质因数的过程已经结束,打印出即可。
(2)如果n<>k,但n能被k整除,则应打印出k的值,并用n除以k的商,作为新的正整数你n,重复执行第一步。
(3)如果n不能被k整除,则用k+1作为k的值,重复执行第一步。
'''
a = int(raw_input("请输入数字:"))
print "{} = ".format(a),
while a not in [1]: # 循环保证递归
... | false |
260ebcd387e66bf0a17576468d5e6e1c3b6cee61 | manerain/savy | /proj02/proj02_02.py | 598 | 4.4375 | 4 | # Name:
# Date:
# proj02_02: Fibonaci Sequence
"""
Asks a user how many Fibonacci numbers to generate and generates them. The Fibonacci
sequence is a sequence of numbers where the next number in the sequence is the sum of the
previous two numbers in the sequence. The sequence looks like this:
1, 1, 2, 3, 5, 8, 13.... | true |
0baa5692dce09d548d9ad6f39460dd38de1dc809 | tainaracamila/PizzaPricePredictions | /main.py | 1,408 | 4.40625 | 4 | """
Prevendo o Preço da Pizza
Suponha que você queira prever o preço da pizza.
Para isso, vamos criar um modelo de regressão linear para prever o preço da pizza, baseado em um atributo da pizza
que podemos observar. Vamos modelar a relação entre o tamanho (diâmetro) de uma pizza e seu preço.
Escreveremos então um prog... | false |
11f2fae0b317c7ce7e83c410dd210aa747e2b2a0 | NgyAnthony/python-course | /Chapter 3/Exercises/3.2-4.py | 283 | 4.15625 | 4 | words = ["Hello", "my", "same", "is", "Anthony", "Okayy", "Heyyy"]
def count_words():
count = 0
for word in words:
if word.count(str()) == 6:
count +=1
print(word, "is 5 str long.")
print(count, "words with 5 in length.")
count_words() | false |
c3b48b91fdaea9a19a2ae641fef982b5fcf19eec | xleon/CursoCiudadRealPython | /7_listas.py | 544 | 4.4375 | 4 | """
Ejemplos para trabajar con listas
"""
LIST = [1, 2, 3, 4, 5, 'seis', 'otra cosa']
print(LIST)
print(LIST[0])
print(LIST[4])
print(LIST[2:5])
print(LIST[:3])
print(LIST[2:])
SIZE = len(LIST)
print('tamaño de la lista:', SIZE)
del LIST[2]
print(LIST)
LIST[2] = 'TRES'
print(LIST)
# concatenar dos listas
LIST += ... | false |
795b38a4447f17041c48356e241316673a205584 | xleon/CursoCiudadRealPython | /16_herencia.py | 891 | 4.375 | 4 | """ Herencia de clases """
class Vehicle:
def __init__(self):
self.wheels = 0
self.name = self.__class__.__name__
print('Constructor de', self.name)
def move(self):
return 'moving'
class Car(Vehicle):
def __init__(self):
super().__init__()
self.wheels = 4
... | false |
756807939ce427d376446b51d12d229acc3099cc | rajunrosco/PythonExperiments | /CollectionFunctions/CollectionFunctions.py | 2,174 | 4.125 | 4 | import os
import sys
from functools import reduce
def FilterTest():
keylist = ["a","a|ps4","b","b|ps4","b|win64","c","c|win64"]
# filter list with lambda function that returns all strings that contain "ps4"
# filter() takes a function evaluates to "true", items that you want in the list
# in the case ... | true |
f2a5dc0eb57b10d0ccc0acc17c6b5bf3b060c585 | anuragdogra2192/Data_structures_with_python3 | /arrays/TwoSumII_unique_pairs.py | 1,839 | 4.21875 | 4 | '''
Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order,
find two numbers such that they add up to a specific target number.
Let these two numbers be numbers[index1] and numbers[index2]
where 1 <= first < second <= numbers.length.
Return the indices of the two numbers,
... | true |
c529568c0c22bc9cbee2c64265c8c32147c310e8 | anuragdogra2192/Data_structures_with_python3 | /arrays/ReturnAnArrayOfPrimes/Return_array_of_primes.py | 870 | 4.34375 | 4 | """
Write a program that takes an integer argument and
returns all the primes between 1 and that integer.
For example, if the input is 18, you should return [2, 3, 5, 7, 11, 13, 17]
Hint: Exclude the multiples of primes.
"""
#Given n, return all primes up to and including n.
def generate_primes(n):
p... | true |
20099604968983eb02c4ec2b0f9c67600afcf002 | anuragdogra2192/Data_structures_with_python3 | /strings/integer_to_string.py | 899 | 4.28125 | 4 | """
Integer to string
Built-in functions used in the code
1) ord()
The ord() function returns an integer representing the Unicode character.
ord('0') - 48
ord('1') - 49
:
:
ord('9') - 57
2) chr()
Python chr() function takes integer argument and return the string representing a character at... | true |
66ca2398e71e7faf0042e69596658d19d25a9409 | anuragdogra2192/Data_structures_with_python3 | /LargeAssociationItems.py | 2,558 | 4.28125 | 4 | """
My approach: DFS
Question:
In order to improve customer experience, Amazon has developed a system to provide recommendations to the customer
regarding the item they can purchase. Based on historical customer purchase information, an item association can be defined
as - If an item A is ordered by a customer, then ... | true |
1bb0230e9ca9ae6404d40e7fd5a6091f4cbdb503 | 600rrchris/Python-control-flow-lab | /exercise-2.py | 490 | 4.3125 | 4 | # exercise-02 Length of Phrase
# Write the code that:
# 1. Prompts the user to enter a phrase:
# Please enter a word or phrase:
# 2. Print the following message:
# - What you entered is xx characters long
# 3. Return to step 1, unless the word 'quit' was entered.
word = input('Enter "Please enter a word or ... | true |
525fa36066c159ccd4a5f921f006ad71dbc47777 | saurav-singh/CS260-DataStructures | /Assignment 3/floyd.py | 1,718 | 4.375 | 4 | #!usr/bin/env python
#
# Group project: Floyd's algorithm
# Date: 03/13/2019
#
# It should be noted that this implementation follows the one in the textbook
"""{Shortest Paths Program: shortest takes an nXn matric C of arc costs and produces nXn matrix A of lengths of shortst paths and an nXn matrix P giving a point i... | true |
7d52d970e8a6ff398aa99e553afb9b0afc0e1592 | dimDamyanov/Py-Fundamentals | /02. EXCERCISE - Basic Syntax, Conditional Statements and Loops/03.py | 280 | 4.15625 | 4 | year = int(input())
if year == 88:
print('Leo finally won the Oscar! Leo is happy')
elif year == 86:
print('Not even for Wolf of Wall Street?!')
elif year != 86 and year < 88:
print('When will you give Leo an Oscar?')
elif year > 88:
print('Leo got one already!')
| false |
0725be1066a074d73d764b67b8fe589b41b33cd7 | rosewambui/NBO-Bootcamp16 | /fizzbuzz.py | 278 | 4.1875 | 4 | """function that checks the divisibility of 3, 5 or both"""
"""a number divisible by both 3 and 5 id a divisor 15, divisibility rule"""
def fizz_buzz(num):
if num%15==0:
return "FizzBuzz"
elif num%5==0:
return "Buzz"
elif (num%3==0):
return "Fizz"
else:
return num
| true |
6b596be7dbe7be8359e78e6bec3dba581d1762c7 | mhorist/FunctionPractice | /FunkyPractice06.py | 246 | 4.3125 | 4 | # Write a Python program to reverse a string.
def strRevers(charString):
rstr = ''
index = len(charString)
while index > 0:
rstr += charString[index - 1]
index = index - 1
print(rstr)
strRevers("abc def ghi jkl") | true |
2db7e00677625efb1119dab3fd48a6de2c3d1567 | eflagg/dictionary-restaurant-ratings | /restaurant-ratings.py | 1,861 | 4.40625 | 4 | # your code goes here
import random
def alphabetize(filename):
"""Alphabetizes list of restaurants and ratings
Takes text file and turns it into dictionary in order to print restaurant_name with
its rating in alphabetical order
"""
username = raw_input("Hi, what's your name? ")
print "Hi %s!"... | true |
f9668b8dd8c559e8a2338449fee23c5c60ad30da | ProjectOnePM/ProjectOneEjercicios | /Unidad 2 - IF/TP2_Ejer03.py | 358 | 4.21875 | 4 | print "-Calculo ascendente de 3 numeros-"
N1=input("ingrese 1 numero")
N2=input("ingrese 1 numero")
N3=input("ingrese 1 numero")
if (N1<N2<N3):
print N1,"<",N2,"<",N3
elif(N1<N3<N2):
print N1,"<",N3,"<",N2
elif(N2<N1<N3):
print N2,"<",N1,"<",N3
elif(N2<N3<N1):
print N2,"<",N3,"<",N1
elif(N3<N1<N2):
print N3,"<",N1... | false |
cc4760ce06911c819e85c5d2b5ea941de649f0d4 | princecoker/codelagos-Python-Class-Assignment-1.0 | /out of school assignment 2.py | 801 | 4.3125 | 4 | #this calculator tells what year you will be 100 years
#algorithm
#get name and age
#calculate birthyear
#add 100 to year of birth
#display year in 100 years time
name = str(input('what is your name: '))
age = int(input('How old are you: '))
birthyear = 2018 - age
futuredate = int(birthyear + 100)
print (na... | false |
8629533b3301fd37e7cd41c4cfaecbf9677efe92 | boxa72/Code_In_Place | /khansoleAcademy.py | 1,414 | 4.25 | 4 | """
Prints out a randomly generated addition problem
and checks if the user answers correctly.
"""
import random
MIN_RANDOM = 10 # smallest random number to be generated
MAX_RANDOM = 99 # largest random number to be generated
THREE_CORRECT = 3 # constant for the loop
def main():
math_test()
def math_... | true |
c6f84ddc221e0d4df3f237cc47647eb567aae0c4 | neutron-L/PycharmProjects | /IntroductionToPragrammingUsingPython/ch03/Ex19.py | 526 | 4.125 | 4 | import turtle
import math
x1, y1, x2, y2 = eval(input("Enter the coordinates of point1 and point2 like x1, y1, x2, y2: "))
turtle.penup()
turtle.goto(x1, y1)
turtle.pendown()
turtle.write("("+ str(x1) + ", " + str(y1) + ")")
# degree = math.degrees(math.asin((y2-y1)/math.sqrt((x2-x1)**2 + (y2-y1)**2)))
# print(degre... | false |
30c32e1a5cd8c9468a7d3583f77524de86885683 | JessicaGarson/Deduplicate_playtime | /dedupe.py | 1,373 | 4.40625 | 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 |
3634e3d694a98a2dd178c9f431874a53ffe8cc20 | 0xlich/python-cracking-codes-examples | /caesar.py | 1,178 | 4.25 | 4 | # Caesar Cypher
import pyperclip
#The string to be encrypted
#print ('Please enter the message: ')
#message = input()
message = 'fVDaOPZDPZDHTHgPUNDKVVN'
# The encryption key
key = 7
#Wheter the program encrypts or decrypts:
mode = 'decrypt' # Set to either 'encrypt' or 'decrypt'
#Every possible symbol
SYMBOLS = ... | true |
d566fbf02375e2a53983be614c73f58cfec61951 | gitbrian/lpthw | /ex15.py | 569 | 4.21875 | 4 | #imports the argv module
from sys import argv
#assigns variables to the arguments in argv
# script, filename = argv
# print "The script running this is named %r." % script
#assigns the open file to the variable 'txt'
# txt = open(filename)
# prints the filename of the text file
# print "Here's your file %r:" % filen... | true |
70814dacb3ee3278d6eb848f1395d81ac80b04cb | SyedIbtahajAhmed/Python-Basic | /LCM And HCF Calculator.py | 1,285 | 4.15625 | 4 | #========================
#========================
def gcd(a,b):
"Calculates GCD Of Two Numbers"
if(b==0):
return a
return gcd(b, a%b)
#========================
#========================
def lcm(a,b):
"Calculates LCM Of Two Numbers"
y = (a*b)/gcd(a,b)
return(y)
#===========... | false |
53fe312095c05dc9d24e255d4062b24862c2e27c | ejudd72/beginner-python | /notes/numbers.py | 807 | 4.1875 | 4 | from math import *
print(2)
# parenthesis for order of operation
print(3 * (4 + 5))
# division
print(3/1)
# modulus operator
print(10 % 3)
# numbers inside variables
my_num = 5
print(20 % my_num)
# convert number to string (you need to do this to concatenate strings and numbers)
my_num = 6
print("I have " + str(m... | true |
88acce823bf11faaf330eccb89f8a8e0f66fbbfa | Areeba-Seher04/Python-OOP | /2 INHERITANCE/2 Inheritance.py | 1,036 | 4.28125 | 4 | #class Person(object):
class Person: #Parent class
def __init__(self,name,age):
self.name = name
self.age = age
def get_name(self):
return self.name
def get_age(self):
return self.age
class Employee(Person): #Child class
'''
**Ch... | true |
ec1451e3c75e5c1726a49298cc43beaee0ab23a8 | Areeba-Seher04/Python-OOP | /3 FUNCTIONS arg,kwarg/3.arg in function call.py | 421 | 4.28125 | 4 | #ARG IN FUNCTION CALL
#We can also use *args and **kwargs to pass arguments into functions.
def some_args(arg_1, arg_2, arg_3):
print("arg_1:", arg_1)
print("arg_2:", arg_2)
print("arg_3:", arg_3)
args = ("Sammy", "Casey", "Alex") #args is a tuple
some_args(*args) #pass all arguments in a function
args... | true |
f495dd4e59b615d52f4ecc260c5075466f2c1f8a | UrduVA/Learn-Python | /while_Infi.py | 206 | 4.1875 | 4 | x = 0
while x != 5:
print(x)
x = int(input("Enter a value or 5 to quit: "))
##0
##Enter a value or 5 to quit: 1
##1
##Enter a value or 5 to quit: 2
##2
##Enter a value or 5 to quit: 5
| true |
8d6bcffee5cdace0ddc5e79be117999ad094c349 | hanchettbm/Pythonprograms | /Lab12 updated.py | 2,590 | 4.4375 | 4 | # 1. Name:
# -Baden Hanchett-
# 2. Assignment Name:
# Lab 12: Prime Numbers
# 3. Assignment Description:
# -This program will display all the prime numbers at
# or below a value given by the user. It will prompt the
# user for an integer. If the integer is less than 2,
# then the pro... | true |
4d5ab2cd112c035e56366aa849c49822cb8c279e | Nick-Cora/Compiti_Vacanze | /compiti sistemi/highScore.py | 652 | 4.125 | 4 | def highScore(lis):
last = lis[-1]
max_score = max(lis)
if len(lis) < 3:
raise Exception("not enough list items")
else:
three_max = []
while len(three_max) < 3:
three_max.append(max(lis))
lis.remove(max(lis))
return (f"Last score: {last} \n... | false |
bdb0b23ae85a83b6499fb2aa7d9274af9bbc6d00 | ramutalari/python | /src/test/forloop_Example.py | 272 | 4.4375 | 4 | #Example 1:
x = ['India','UK','Europe','Australia']
for i in x:
print(i)
#Example-2
for i in range(1,21):
print(i)
#Example-3
for i in [1,50,'london']:
print(i)
for j in ('INDIA',2,5,6):
print(j)
for k in {'Glasgow','Edinburg','Leeds'}:
print(k)
| false |
20290067dda6e0cc8d3d4661ecaaa73428186d19 | guozhaoxin/mygame | /common/common.py | 2,043 | 4.21875 | 4 | #encoding:utf8
__author__ = 'gold'
# import win32api,win32con
import tkinter as tk
from tkinter import filedialog,messagebox
import pygame
import sys
def chooseFile():
'''
this method is used to let the player choose a file to continue a saved game
:return: str,represent a file's absolute path the player... | true |
e82f7506d994eb1c852647d29b58c459979a04d4 | ndminh4497/python | /Exercises 33.py | 237 | 4.15625 | 4 | def sum_of_three(a,b,c):
if (a == b or a == c or b == c):
sum = 0
return sum
else:
sum = a + b + c
return sum
print(sum_of_three(2, 1, 2))
print(sum_of_three(3, 2, 2))
print(sum_of_three(2, 2, 2))
print(sum_of_three(1, 2, 3)) | false |
05c93e469cffe38bc2c5541ac53874c69a60463e | carolinapbf/Cursos | /Introducao a python/Metodo.py | 853 | 4.3125 | 4 | a= "Ana"
b= "Carolina"
Nome= a+" " +b
print(Nome.lower())#AS letras da string ficam todoas em minusculo
print(Nome.upper())#AS letras da string ficam todoas em maiusculo
print(Nome)
#\n da uma quebra de linha ja para retirar o caracter especial usa-se o metodo .strip()
# usando o metodo string=string.metodo()
#conve... | false |
05e60dc3c9487cb3911731ec5aefa2c02f43f7d5 | carolinapbf/Cursos | /Curso Completo Python/DeclaracoesAlinhadas e escopo.py | 631 | 4.21875 | 4 | x = 25
def printer():
x = 50
return x
print(x) # aparece 25, pois não chamei a função
print(printer())#vai retorna 50 pois chamei a função e ele não pede nenhum parametro
f = lambda x:x**2 # x é local aqui:
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
pri... | false |
c856254295dfe0dfe2e8cd40554bf127a8dfef32 | UAL-AED/lab5 | /aed_ds/queues/adt_queue.py | 745 | 4.375 | 4 | from abc import ABC, abstractmethod
class Queue(ABC):
@abstractmethod
def is_empty(self) -> bool:
''' Returns true iff the queue contains no elements. '''
@abstractmethod
def is_full(self) -> bool:
''' Returns true iff the queue cannot contain more elements. '''
@abstractmethod
... | true |
6f26cbdbc4352a6a01f735f41ede7dcd3cf847e8 | lewie14/lists_sorting | /lists2.py | 2,684 | 4.28125 | 4 | list1 = range(2, 20, 2)
#Find length of list1
list1_len = len(list1)
print(list1_len)
#Change the list range so it skips 3 instead of 2 numbers
list1 = range(2, 20, 3)
#Find length of list1
list1_len = len(list1)
print(list1_len)
print()
#------------------------------------------------------
#indexes
employees =... | true |
5feadeba85d180dca1c7a7f0445a32692dc3b9c6 | MichaelrMentele/LearnPythonTheHardWay | /ex18.py | 566 | 4.25 | 4 | def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_one(arg1):
print "arg1: %r" % arg1
def print_none():
print "I got nothin'."
print_two("Zed","Shaw")
print_two_again("Zed","Shaw")
print_one("Fir... | true |
2d0c41f4f1e73659d39f318038f6bf7344d66112 | durgeshiv/py-basic-scripting-learning | /com/durgesh/software/slicing.py | 768 | 4.21875 | 4 | x='LetsSliceThisString'
# we have defined a string as above, lets try to slice it and print 'ThisString'
# [] -> is the syntax for slicing
#
slicedString = x[9:] # Here, this starts at index 9 and : means we haven't specified end
# index thus everything until end would be taken
print(slicedString) # give o/p as 'Thi... | true |
a3bd72a4f86653946331505e4b8157675cc3e153 | irskep/mrjob_course | /solutions/wfc_job.py | 1,293 | 4.125 | 4 | """
Write a job that calculates the number of occurrences of individual words in
the input text. The job should output one key/value pair per word where the key
is the word and the value is the number of occurrences.
"""
from collections import Counter, defaultdict
from mrjob.job import MRJob
class MRWordFrequencyCou... | true |
98815d02b2b32a065ef7daf466ee5e503e4aed62 | meghasn/py4_everyone_solution | /question9.py | 255 | 4.34375 | 4 | #using a while loop read from last character of a string and print backwards
word=input("enter the string:")
index=len(word)-1
while index>=0:
a=word[index]
print(a)
index=index-1
#enter the string:banana
#a
#n
#a
#n
#a
#b | true |
5dbf1aba29216b6f6d444eecac10c86717de5dfe | sm-wilson/euler | /1-100/009.py | 420 | 4.15625 | 4 | # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
# a^2 + b^2 = c^2
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
for c in range(334,500):
for a in range(1, int((1000-c)/2)):
... | false |
8020336c54f223edc92891c3689c880483e6085f | wingateep/Sprint-Challenge--Algorithms | /recursive_count_th/count_th.py | 894 | 4.28125 | 4 | '''
Your function should take in a single parameter (a string `word`)
Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters.
Your function must utilize recursion. It cannot contain any loops.
'''
def count_th(word):
# TBC
#base case
count = 0 # sets ... | true |
b7f45c60fd07b48dde5572e9d0f728d13fec1bee | da-foxbite/KSU121 | /Python/lab1 [1-19]/t6.py | 494 | 4.125 | 4 | # 141, Суптеля Владислав
# Дата: 19.02.20
# 6. Даний рядок. Отримайте новий рядок, вставивши між кожними двома символами вихідної рядки символ *. Виведіть отриманий рядок.
string = input("「Введите строку」: ")
str2 = ''
for i in range(0, len(string)):
if i % 2 == 0:
str2 += string[i]+'*'
else:
s... | false |
7bdd6912148e971df2cc6fde278be91dcedbac01 | Song-Q/Learn-python | /recur.py | 600 | 4.28125 | 4 | #为解决递归调用使用尾递归优化
#然后python并没有对尾递归做优化,实际过深的递归还是存在栈溢出
#计算n!
def fact(n):
return fact_iter(n, 1)
def fact_iter(num, product):
if num==1:
return product
return fact_iter(num-1, num*product)
#practice 汉诺塔
#将递归问题拆解为二阶递归,考虑最后一步干什么,重复的步骤,和最后之前一步干什么
def hanoi(n, a, b, c)
if n == ... | false |
9cc9fa08a66e0d79b46790ed5232c66f934933f0 | rachelmccormack/PythonRevision-Tutoring | /Homework/Solutions/furtherFileReading.py | 875 | 4.15625 | 4 | """
A list of words is given in a file words.txt
For this file, please give the number of times each word appears, in the form {word:number}
Please display the longest word
How many words are in the list? (Don't peek) What percentage of the words are unique?
"""
file = open("words.txt")
words = file.readlines()
file.c... | true |
ac0792f282322dc080a62a79f83b57aad55a4d38 | rachelmccormack/PythonRevision-Tutoring | /Homework/shoppinglist.py | 795 | 4.21875 | 4 | # Fill out Shopping List Program
print("Welcome to the shopping list program...")
shoppingList = []
finalise = False
def finaliseList():
print("Your final list is: ")
for item in shoppingList: print(item)
print("Thank you!")
return True
"""
Here we need functions for adding to the li... | true |
cefe128d5308652f4d34d798336ef8e9219b273d | zekeriyaolke/phyton-introduction | /HomeWork/Final.py | 2,050 | 4.15625 | 4 | class RecipeItem:
def __init__(self, name, quantity):
self.name = name
self.quantity = quantity
class Recipe:
def __init__(self, name, items):
self.name = name
self.items = items
def cook(self):
recipeItems = [f"{i.name}({i.quantity})" for i in self.ite... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.