blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
0b9f4d9edbe861fa7a621f29210822bc2ca21529 | IkagarjotSingh/mapReduce_problems | /Sorting/mapperSort.py | 678 | 3.5625 | 4 | #!/usr/bin/env python
import string
import sys
for line in sys.stdin:
line = line.strip()
line = line.lower()
words = line.split()
for word in words:
for c in string.punctuation:
word=word.replace(c,"")
word = word.strip()
if len(word)>=1:
if word[0] in ... |
2c8305b951b42695790cc95fef57b5f3751db447 | GowthamSiddarth/PythonPractice | /CapitalizeSentence.py | 305 | 4.1875 | 4 | '''
Write a program that accepts line as input and prints the lines after making all words in the sentence capitalized.
'''
def capitalizeSentence(sentence):
return ' '.join([word.capitalize() for word in sentence.split()])
sentence = input().strip()
res = capitalizeSentence(sentence)
print(res)
|
b78fea29f88fee4293581bbbfae5da0fa60065b9 | GowthamSiddarth/PythonPractice | /RobotDist.py | 1,030 | 4.4375 | 4 | '''
A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT
with a given steps. The trace of robot movement is shown as the following:
UP 5
DOWN 3
LEFT 3
RIGHT 2
The numbers after the direction are steps. Please write a program to compute the distance from cur... |
c1a94cfefd636be989ea3c0df1a2f40ecefd6390 | GowthamSiddarth/PythonPractice | /PasswordValidity.py | 1,368 | 4.3125 | 4 | '''
A website requires the users to input username and password to register.
Write a program to check the validity of password input by users.
Following are the criteria for checking the password:
1. At least 1 letter between [a-z]
2. At least 1 number between [0-9]
1. At least 1 letter between [A-Z]
3. At least 1 char... |
68d9638a9f320158b34097b0d2244fbab2560b5d | GowthamSiddarth/PythonPractice | /FilterEvenNums.py | 270 | 4.03125 | 4 | '''
Write a program which can filter even numbers in a list by using filter function.
'''
def getEvenNumsFromList(nums):
return list(filter(lambda x: x % 2 == 0, nums))
nums = list(map(int, input().strip().split(',')))
res = getEvenNumsFromList(nums)
print(res)
|
2b78532e935cc48136266b96a4a8d5070d14852b | GowthamSiddarth/PythonPractice | /EvenValuesFromTuple.py | 268 | 4.1875 | 4 | '''
Write a program to generate and print another tuple whose values are even numbers
'''
def getEvenNumsFromTuple(nums):
return tuple(x for x in nums if x % 2 == 0)
nums = list(map(int, input().strip().split(',')))
res = getEvenNumsFromTuple(nums)
print(res)
|
8ec3f47ae022e5cfedac0bf2e87697cdd26e0632 | odify/PORT-OF-PYTHON | /CLI/tags-cli/tags.py | 1,247 | 3.53125 | 4 | tags = """
#tag1 #tag2 #tag3 #tag4 #tag5 #tag6 #tag7 #tag8
#tag9 #tag10 #tag11 #tag12 #tag13 #tag14 #tag15 #tag16 #tag17 #tag18
"""
class Tag_Generator(object):
def __init__(self, tag_list):
self.tag_list = tag_list
def sort_function(self):
sorted_list = []
_split = self.tag_list.spli... |
abe7da672e9f66e91bd0e24f2de0ca47e18f5d7c | odify/PORT-OF-PYTHON | /Tools/ftp-tool/upload.py | 354 | 3.515625 | 4 | #!/usr/bin/env python3
# UPLOAD "myfile.txt"
import ftplib
FTP_HOST = " YOUR FTP HOSTNAME "
FTP_USER = " YOUR FTP USERNAME "
FTP_PASS = " PASSWORD "
ftp = ftplib.FTP(FTP_HOST, FTP_USER, FTP_PASS)
ftp.encoding = "utf-8"
filename = "myfile.txt"
with open(filename, "rb") as file:
ftp.storbinary(f"STOR {filename}... |
b7dc6234c0ceddaaa661ed6820cb2799ef962296 | odify/PORT-OF-PYTHON | /GUI/numpy-gui/main.py | 336 | 3.578125 | 4 | import numpy as np
import matplotlib.pyplot as plt
data = {'Xyz':50, 'X':10, 'Y':5, 'Z':2, }
courses = list(data.keys())
values = list(data.values())
fig = plt.figure(figsize = (2, 4))
plt.bar(courses, values, color ='red',
width = 0.25)
plt.xlabel("x-label")
plt.ylabel("y-label")
plt.title("Simple diagr... |
5c2520d900276b6b34ae7bff741ca65b03926701 | dhmquan/wallbreakers | /week2/SortCharactersByFrequency.py | 271 | 3.546875 | 4 | import collections
class Solution:
def frequencySort(self, s: str) -> str:
c = collections.Counter(s)
most_commons = c.most_common()
substrings = [item[0] * item[1] for item in most_commons]
return ''.join(substrings) |
42edf0c6ea453213156c51f96e83bfd1bc09b90f | dhmquan/wallbreakers | /week1/DetectCapital.py | 296 | 3.59375 | 4 | class Solution:
def detectCapitalUse(self, word: str) -> bool:
if len(word) < 2:
return True
tail = word[1:]
if word[0].islower():
return tail.islower()
else:
return tail.islower() or tail.isupper() |
ab39b0b20388c79b81fa51e3acaf16fc480b8a27 | sirrah23/LikedTweets | /likedtweets.py | 2,809 | 3.71875 | 4 | """
This script will obtain a random tweet that you recently like and display it
to you on the console.
"""
import json
import random
import subprocess
import tweepy
import click
"""
Read the contents of a JSON file; the file is assumed to contain OAuth
credentials.
"""
def read_credentials(filename):
with open(f... |
778fee1dd25f810a16d59b39c87c19d7a7ac4e35 | balwant3186/python-summer-training | /Day6/6.py | 147 | 3.78125 | 4 | print('#' * 40)
num = [11, 22, 33, 44, 55]
result = list(map(lambda x : x + 5, num))
print(num)
print('After use of lambda in map: ', result)
|
3c8a99c7d2f81f5bf9ad3f6b2c861241b149d4db | balwant3186/python-summer-training | /Day7/2.py | 1,250 | 3.5 | 4 | d1 = {1 : 'one', 2 : 'two'}
print(d1.values())
print(d1.keys())
d1.clear()
print(d1)
d1 = {1 : 'one', 2 : 'two'}
d2 = d1.copy()
print(id(d1))
print(id(d2))
print(d1.get(1))
print(d1.get(2))
print(d1.get('one'))
print(d1.get(33))
print(d1.items())
print(d1.keys())
print(d1)
print('After popping: ', d1.po... |
6c5a83df95bda7c7cee7cfd1c4b41499f333bebc | dentdelion/Labs | /chm/newton.py | 389 | 3.859375 | 4 | # Elizabeth Blyumska
# 21.09.2016
# var 21
# x^3 - 2x^2 + x + 1 = 0
# Newton iteration method
def f(x):
return x**3 - 2*x**2 + x + 1
def f1(x):
return 3*x**2 - 4*x + 1
def newtons_method(x0, e):
while True:
x1 = x0 - (f(x0) / f1(x0))
print x1
if abs(x1 - x0) < e:
return x1... |
9b9057d606ecda2575d938cd0e594db0d4591b39 | wxl789/python | /Day17/代码/正则表达式/4-正则元字符3.py | 996 | 3.515625 | 4 | '''
x? : ?代表0个或1个x字符 非贪婪匹配
x+ : +代表至少1个x字符 贪婪匹配
x* : *代表任意多个x字符 贪婪匹配
n、m为正整数
x{n} : 匹配n个x字符
x{n,} : 匹配至少n个x字符
x{n, m} : 匹配至少n个,最多m个x字符
x|y : 匹配x或y字符 |:代表或
(abc) : 匹配小括号中的字符 将abc作为一个整体使用
(): 还有一个组的含义
'''
import re
print(re.findall("a?", "abbaabaaac"))
print(re.findall("a+", "abbaabaaac"))
print(... |
7e576a799df097e9afe67872e3313acab43be54b | wxl789/python | /day12/11-单继承.py | 1,784 | 4.40625 | 4 |
#定义一个父类
class Cat(object):
def __init__(self,name,color="白色"):
self.name = name
self.color = color
def run(self):
print("%s-----在跑"%self.name)
#定义一个子类,继承Cat父类
"""
继承的格式:
class 子类名(父类名)
子类在继承的时候,在定义类时,小括号中为父的名字
父类的属性和方法,会继承给子类(公有)
"""
class Bosi(Cat):
def setNewName(sel... |
c2e16f82ed313970e5183ac4a248805c2ff1c35b | wxl789/python | /Day09/2-代码/异常处理/异常处理.py | 4,936 | 4.21875 | 4 | # 错误 异常
'''
程序运行或程序编写时,会遇到各种各样的错误,有些错误是因为程序编写有
问题出现的,这种错误一般称之为bug,bug是必须修复的。
有些错误是用户输入或错误使用时造成的,这种错误属于不可控的,但我们可以
通过检测用户输入或操作来做相应的处理。还有一些错误是无法在程序运行过程中
预测的,例如:网络中断,文件不存在等,这些错误可以认为是异常。
异常在程序运行中也是必须修复或处理的,否则,程序运行到该异常时,也会因为
异常而崩溃。
'''
# print("hello wordl") # 语法正确,运行正常,结论错误,必须修改
# NameError: name 'num' is not defined
# p... |
5cc975cd608316355f65da33885eb43ebac6db92 | wxl789/python | /Day16/2-代码/面向对象/10- __str__.py | 631 | 4.3125 | 4 | # __str__函数:__str__():当打印实例对象的时自动调用。
# 注:该方法必须有一个str类型的返回值
# __str__是给用户用来描述实例对象的方法
# 优点:当我们需要打印实例对象的多个属性时,可以使用__str__,
# 这种方式会简化我们的代码量。
class Person():
def __init__(self, name, age, sex):
self.name = name
self.age = age
self.sex = sex
# 在类中重写__str__方法
def __str__(self):
... |
33d51d32e67f118581e9282640a2ae5e8e03f320 | wxl789/python | /Day18/2-代码/高阶函数/3-filter().py | 528 | 4 | 4 | # filter:作用:对序列中的元素进行筛选过滤
# 格式:filter(func, iter)
# func返回值为True或False,当函数返回True,代表保留该元素;
# 当函数返回False,代表删除该元素。
# filter的返回值为一个新的序列,返回的列表中的元素类型与原列表中的元素
# 类型一致。
list1 = [1,2,3,4,5,6,7]
def func(num):
# 保留偶数
if num % 2 == 0:
return True
# 奇数
return False
res1 = filter(func, list1)
print(res1)
pr... |
14ea4608f73f210dc76b5ac89cbd36f3c57f6fbb | wxl789/python | /Day07/2-代码/基础内容/19-if-elif-else.py | 1,407 | 3.9375 | 4 | # if-elif-else
'''
语法格式:
if 条件1:
语句1
[elif 条件2:
语句2
elif 条件3:
语句3
elif 条件n:
语句n
]
[else:
语句n+1]
'''
'''
逻辑:当程序执行到if语句时,判断条件1是否成立,成立执行语句1,不成立
判断条件2是否成立,成立执行语句2,不成立继续向下判断条件3,依次类推。
当所有条件不成立时,如果有else语句,则执行else后面的语句,没有else语句,
则结束整个if判断,向下继续执行程序。
'''
# 从控制台输入
# 班级 2000-2008 一年级
# 2009-2015 小学
# 2016... |
cbf356727ec572000df535ab177a4bd2c056ff9f | wxl789/python | /Day07/2-代码/函数/7-不定长参数(元组).py | 1,209 | 4.25 | 4 | # 不定长参数
# 概念:能够在函数内部处理比形参个数多的实参
def sum1(a,b):
print(a + b)
def sum2(a,b,c):
print(a + b + c)
# 加了 (*) 的变量,可以存放多个实参。
# 加了 * 的形参,数据类型为元组类型,如果调用时未传入传入参数,默认
# 为一个空元组,如果传入了实参,将传入的实参按传入顺序依次放到元组中。
def fun1(*args):
print(args)
fun1()
fun1(1)
fun1(1,2,3)
print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&... |
7f1c138d85fbee0ebe4f327ffb8d121124101765 | wxl789/python | /day13/02-类属性.py | 333 | 4.28125 | 4 |
class People(object):
name = "tom"#公有的类属性
__age = 12#私有类属性
# def __init__(self,name):
# self.name = name
p = People()
print(p.name)
# print(p.__age)
print(People.name)
# print(People.__age)
"""
注意:
不能在类的外面通过实例对象和类对象访问私有的类属性
""" |
5cfd2f5823ca835000b3e936f4072044a58570ce | wxl789/python | /Day08/2-代码/迭代器/2-生成器.py | 1,130 | 4.28125 | 4 | '''
生成器:
generator生成器:使用yield关键字的函数被称为生成器函数。
使用yield的函数与普通函数的区别:
1、使用yield的函数返回一个生成器对象。
2、普通函数的返回值属于程序员自己设置。
yield:将一个函数拆分成多个模块,模块与模块之间为连续的。
yield可以间接控制进程或线程。
生成器可以认为是一个迭代器,使用方式与迭代器一致。
'''
# 普通函数的返回值默认为NoneType类型
def func1():
print(1)
print(2)
print(3)
# print(type(func1)) # function
# print(type(func1(... |
16752c42c19fb346530892de7ff2966d8a66e245 | wxl789/python | /Day10/2-代码/面向对象/4-通过对象调用类中的属性或函数.py | 1,771 | 4.40625 | 4 | # Wife的类
class Wife():
name = ""
height = 1.5
weight = 50.0
# 创建普通的成员方法的方式与之前创建def的方式一致,只是第一个形参默认
# 为self。
# 初始值 返回值 多个形参
def goShopping(self):
print("妻子能购物")
def makeHousework(self):
print("贤惠的做家务")
def hideMoney(self, money):
print("辛苦藏了%s的私房钱" % money)
#... |
3771af2c4b7172becf87989f817dd4880eff8721 | wxl789/python | /Day08/2-代码/函数/5-关键字参数.py | 689 | 3.84375 | 4 | # 定义一个函数,该函数有三个参数,函数内部输出三个参数
def getNameAndAgeAndSex(name,age,sex):
print(name,age,sex)
# 调用
# 函数的关键字
# 参数的关键字:在函数调用的传参过程中将形参的名称写在赋值符号之前,将值
# 写在赋值符号之后。
# 优点:1、明确实参对应的形参
# 2、允许函数调用时实参的顺序与函数定义时形参的顺序不一致,但赋值
# 对象不会错乱
# 建议:以后在函数调用时尽量使用关键字参数的形式。
getNameAndAgeAndSex("QQ",12,1)
getNameAndAgeAndSex(name="WX... |
ae19b26446439fd977091533d24440846533788a | wxl789/python | /Day05/2-代码/基础内容/21-String内嵌函数.py | 8,365 | 4.4375 | 4 | # 字符串内嵌函数
# 1、eval(str) : 将str中有效的表达式进行计算,并输出结果
print(eval("123")) # --> 123
print(eval("+123"))
print(eval("-123"))
print(eval("1 + 2")) # ---> 1+2 --> 3
# print(eval("abc"))
print(type(eval("123"))) # int
# 2、len(str) : 获取字符串长度
str1 = "abcdef"
print(len(str1)) # 6
# 3、字母大小写转换:对原字符串无影响,会产生一个新的字符串
str2 = "abCdE... |
b3dd3ad0ce61673c01d4cc9e8f55defeb8814225 | wxl789/python | /day14/银行管理系统/atm.py | 4,640 | 3.71875 | 4 | import random
from day14.银行管理系统.card import Card
from day14.银行管理系统.user import User
class ATM(object):
def __init__(self,allUsers):
self.allUsers = allUsers#卡号--用户
#开户,封装一个方法
def createUser(self):
name = input("请输入您的姓名:")
idCard = input("请输入您的身份证号:")
phone = input("请输入您的手机号... |
d52241bedee239c0d6f70d5f10d49f3189c47f90 | wxl789/python | /Day09/2-代码/文件操作/4-存储数据.py | 963 | 3.84375 | 4 | # list dict
# 存储
# pickle
'''
pickle支持存储list、dict、str等类型的数据。
pickle:实现了数据的序列化与反序列化操作。
数据的序列化操作可以实现数据的存储。
数据的反序列化操作可以实现数据的读取。
'''
# 导入pickle
import pickle
list1 = [1,2,3,4,5,7,8,9]
f1 = open(file="file.data", mode="wb")
# 将信息写入文件
# 语法格式: pickle.dump(obj,file)
# obj:写入的数据
# file:被写入的文件
pickle.dump(list1, f1)
f1.close()... |
1a235626628e01697287d88f7fcadd3f1daa5e83 | wxl789/python | /Day10/2-代码/面向对象/123431.py | 1,237 | 3.890625 | 4 | # 人射击子弹
# 默认手枪中有4发子弹,人射击4次之后就没有了,每射击一次提示目前
# 还剩几发子弹,当全部射击没之后,再执行射击的操作时,提示没有子弹了,
# 人可以再次填装n发子弹,再次射击n次之后就没有了。
class Shootingbullets():
# 人:
# 类名:Person
# 属性:手枪 gun
# 行为:fire addCount
def Person(self):
print("是否射击" )
# 枪:
# 类名:Gun
# 属性:弹夹 bulletBox
# 行为:shoot
def Gun(self):
bullet = 0
... |
ceeb459415c19f4c62f3b5e58ada508506d40827 | wxl789/python | /Day17/代码/面向对象/15-super.py | 603 | 4.09375 | 4 | # super:父类
class Father():
def __init__(self, name):
self.name = name
def drink(self):
print("F--喝酒")
class Child(Father):
def __init__(self, name, gf):
# Father.__init__(self, name)
# 使用super调用父类相关方法
# 格式:super(子类名称, self).__init__(父类的形参对应的实参)
super(Child, se... |
19c71f0c42ee6cd65a6a42df9a78fea7471306b1 | wxl789/python | /day13/14-label控件.py | 764 | 3.59375 | 4 | """
label:显示文本信息
"""
import tkinter
#创建窗口,Tk
window = tkinter.Tk()
#设置一个标题
window.title("python1805")
#设置窗口的大小和位置geometry()
"""
widthxheight+x+y
widthxheight:窗口的高度和宽度
x+y:窗口的位置
"""
window.geometry("400x400+200+20")
"""
window:父窗体
text:显示文本的内容
bg:背景色
fg:字体颜色
justify:设置换行后的对齐方式
anchor:位置 n 北 e 东 s 南 w 西 ... |
b3c0fca792c91c5906dbbb9b1de653c5e5c6954d | wxl789/python | /Day04/2-代码/基础内容/21-String内嵌函数.py | 4,198 | 4.4375 | 4 | # 字符串内嵌函数
# 1、eval(str) : 将str中有效的表达式进行计算,并输出结果
print(eval("123")) # --> 123
print(eval("+123"))
print(eval("-123"))
print(eval("1 + 2")) # ---> 1+2 --> 3
# print(eval("abc"))
print(type(eval("123"))) # int
# 2、len(str) : 获取字符串长度
str1 = "abcdef"
print(len(str1)) # 6
# 3、字母大小写转换:对原字符串无影响,会产生一个新的字符串
str2 = "abCdE... |
8e017af2f5bde639342a9cdcba00a9bbc76f4671 | BramHamaekers/CN_HTTP | /client.py | 1,761 | 3.6875 | 4 | import sys
import client_input
import client_request
import client_responds
import socket
import util
# Global variables
SOCKET: socket
# Establishes a Connection to a server
# uri: uri of the server you want to connect to
# port: port you want to use to connect to a server
def connect(uri: str, ... |
8549252afbe5aadf8cf89101cfa38a90731e40b9 | DivyaReddyNaredla/python_programs_practice | /print_addition_substraction_multiplication.py | 482 | 4.09375 | 4 | """"20-09-2019 : First Program"""
print("Welcome to python")
a=10
b=20
print("\nThe addition of a and b is ",a+b)
a=5
b=2
print("\n",a,"*",b,"=",a*b)
a=10
b=3
print("\nThe result of ",a,"+",b,"=",a+b)
print("\nThe result of ",a,"-",b,"=",a-b)
print("\nThe result of ",a,"*",b,"=",a*b)
print("\nThe r... |
6637b25522bb63a6b574a3605acbef1a27fe8a21 | DivyaReddyNaredla/python_programs_practice | /inheritamce_class.py | 389 | 3.671875 | 4 | class animal: #
def example(self,name): #Main class
print(name," is a animal") #
class monkey(animal): #inheritance
def exammonkey(self):
print("Monkey walk on ground w... |
7bbbf36378d4edf3ddeca40414f707d7e6f09e1c | DivyaReddyNaredla/python_programs_practice | /tupple.py | 955 | 3.828125 | 4 | #Tuple
'''tup=(1,2,3)
print(tup)
(a,b,c)=tup
print(a)
print(b)
print(c)
print()
for i in tup:
print(i)'''
'''tup1=(1,2,3)
tup2=(4,5,6,7)
tup3=tup1+tup2
print(tup3)
print(len(tup1))
print(len(tup2))
print(len(tup3))
print(min(tup3))
print(max(tup3))
tup1=(10,20,30,40,50)
print(tup1[1])
p... |
746f31a8a84e1e71cbab3a39b4086dbd5df9d34d | BenPidge/Sapphire-Assistant | /Code/CharacterElements/PC/Class.py | 9,742 | 3.828125 | 4 | import itertools
from Code.CharacterElements.PC import Character
class Class:
"""A python class representing a character's class."""
def __init__(self, name, traits, proficiencies, equipment, main_ability, second_ability, saving_throws, hit_dice,
languages, level, magic=None, subclass=None):... |
5da5558624dcf1ce2e97c362db055326c9c1216a | hlockwood99/Yahtzee-Project | /yahtzeee.py | 1,625 | 3.765625 | 4 | #Yahtzee class: checks the conditions
class Yahtzee:
#Count and add only a certain number, such as three twos
def singledigits(dice, num):
score = 0
for i in dice:
if i == int(num):
score += int(num)
return score
#Three kinds of the same dice
def threeofakind(dice):
score = 0
for i in dice:
i... |
0913c4747dde2b734856f2e86a5e939b53aabc91 | AkiraKotori/LeetCodePython | /algo9.py | 767 | 3.8125 | 4 | class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
x2 = x
y = 0
while x2 != 0:
y = y * 10 + x2 % 10
x2 = x2 // 10
return x == y
class Solution2:
def isPalindrome(self, x: int) -> bool:
if x < 0:
... |
8fec7e3997f9958bd458fc5a33d893a224151a7c | alvinshim/python-test | /week-01/02-data-type-1.py | 299 | 3.765625 | 4 | # 정수 integer(int)
print(1 + 1)
# 소수 float
print(1.5 + 2.1)
# 문자 string(str)
print("hello")
# 문자열 더하기
print("hello" + "1")
# 정수 소수 간 변경
print(4 // 2)
print(int(4 / 2))
print(float(2))
# 문자열 숫자 간 변경
print("1")
print(int("1"))
print(int("1.5"))
|
84bc844af2e130523df722bed94bc181e0d78073 | crofootc/Stock_Portfolio_Manager | /stock_functions.py | 1,310 | 3.5625 | 4 | import requests
from termcolor import colored
import pandas as pd
'''
The get_stock_dataframe function pulls stock data from alpha vantage and returns it as a panda dataframe
It takes two parameters, the ticker symbol and size
Size can either be full or compact but is defaulted to full
'''
def create_stock_dataframe(... |
1a0debf66615577d7fd64661332d00ea7d917d32 | PerceptumNL/KhanLatest | /exercises/progress_normalizer.py | 3,132 | 3.953125 | 4 | import itertools
import math
def exponential_fit(X, Y):
# See http://mathworld.wolfram.com/LeastSquaresFittingExponential.html
# TODO(david): This just uses the simpler fit given by equations
# (3) and (4) of the above link. Try equations (9) and (10).
# TODO(david): Use numpy when supported
... |
330135344e2c2635d55ebef32b9ed6a805619326 | gusyi/AI_project1 | /Gus/Node.py | 523 | 3.71875 | 4 | # Node for path finding in the map
class Node:
def __init__(self, q, r):
self.name = True
self.q = q
self.r = r
self.visited = False
self.last = (q, r)
def isVisited(self):
return self.visited
def visit(self, lastq, lastr):
s... |
615e85b944a61c73a1e1e0a2c99738750ebd112a | CHANDUVALI/Python_Assingment | /python27.py | 274 | 4.21875 | 4 | #Implement a progam to convert the input string to lower case ( without using standard library)
Str1=input("Enter the string to be converted uppercase: ")
for i in range (0,len(Str1)):
x=ord(Str1[i])
if x>=65 and x<=90:
x=x+32
y=chr(x)
print(y,end="")
|
a105fe7cfd70b8b8eae640aae6983f5fddb64d09 | CHANDUVALI/Python_Assingment | /cal.py | 399 | 4.375 | 4 | # Implement a python code for arithmetic calculator for operation *, / , + , -
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
choice = input("Enter choice(+,-,*,/):")
if choice == '+':
print(num1 + num2);
elif choice == '-':
print(num1 - num2);
elif choice == '*':
print(num1 * ... |
56d43149fefd40839d00303c627102d8942f8679 | CHANDUVALI/Python_Assingment | /python22.py | 125 | 3.53125 | 4 | #Implement a program to read a line in a file and print.
file = open("read_file.txt")
print(file.readline())
file.close()
|
24387412899c9b360c3b00eb0f53fe7fed1c51f9 | manetivinay/datastructure | /linkedlist/linkedlist.py | 6,043 | 3.9375 | 4 | __author__ = "akhtar"
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def create_list(self, **kwargs):
self.head = kwargs.get("head")
second = kwargs.get("second")
third = kwar... |
09420ed102c044750665be444e127ff893abee65 | monajalal/Python_Playground | /LongestWord.py | 263 | 4.03125 | 4 | def LongestWord(sen):
words = sen.split(" ")
word_dict = {}
for word in words:
if word.isalnum():
word_dict[word] = len(word)
return max(word_dict, key=word_dict.get)
# keep this function call here
print(LongestWord(input())) |
f1bf358fbb67f8cb18545aebd5afc1568e0a5c73 | monajalal/Python_Playground | /py_dict.py | 771 | 3.625 | 4 | '''
#>>> counts = dict()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'dict' object is not callable
'''
'''
>>> dict()
{}
>>> my_dict = dict()
>>> line = raw_input("hi?")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'raw_input' is not ... |
937a4f5192110dad7ced321e78d79ea70273de93 | monajalal/Python_Playground | /reverse_words.py | 221 | 3.546875 | 4 | class Solution:
# @param A : string
# @return string
def reverseWords(self, A):
word_list = A.split()
reversed_word_list = word_list[::-1]
return " ".join(reversed_word_list)
|
9b7569b2b61616699852299c80d4e8cb39cf425f | monajalal/Python_Playground | /level_order.py | 1,190 | 4.03125 | 4 | from tree_node import TreeNode
from queue import Queue
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param A : root node of tree
# @return a list of list of integers
def l... |
6c299c77b83d1f18798aacebb941d947de7236d4 | monajalal/Python_Playground | /binary_addition.py | 510 | 4.1875 | 4 | '''
Implement a function that successfully adds two numbers together and returns
their solution in binary. The conversion can be done before, or after the
addition of the two. The binary number returned should be a string!
Test.assert_equals(add_binary(51,12),"111111")
'''
#the art of thinking simpler is POWER
def ad... |
c31e3132c6b879755457b7d6e2124e50a44e6843 | rheyns/problem-sentiment-doodle | /pair_gen.py | 918 | 3.5 | 4 | from random import randint
def randpairs(probs):
"""
Takes a list of problems and returns a list of random (non-duplicate) pairs
"""
maxidx = len(probs) - 1
randidxs = []
for i in range(len(probs)):
randidx = randint(1, maxidx)
if randidx <= i:
randidx -= 1
... |
ee42fb543840a39b6bcd9df241c42d88b2b31abf | eduardowmu/Easiest-Ordered-List-in-python | /lista_3.py | 976 | 4.09375 | 4 | #Criar uma lista de 5 numeros inteiros, definidos pelo usuário
#e exibir seus valores nas respectivas posições
valores = list()#declarando uma lista
#looping de 0 a 4 (5 numeros)
for i in range(0, 5):
#numero a ser inserido na lista
numero = int(input(f'Insira o {i+1}º numero: '))
#se for o primeir... |
391d022f1d714aecf065352435e92cd45af311c6 | cafeciaojoe/crazyflie-capstone | /cfdemos/heartbeat.py | 2,923 | 3.546875 | 4 | #!/usr/bin/env python3
"""
Author: Sam Nolan
This example demonstrates a drones precise ability to represent the beating of
a heart while flying. The drone moving back and forward represents the lub-dub
of heartbeat
"""
import time
import cflib.crtp
from cflib.crazyflie.log import LogConfig
from cflib.crazyflie.conso... |
977a424cb3c5f672c2350470e6557622caf0a94f | aldemirneto/Exercicios-Uri | /Exercícios/uri1049.py | 802 | 3.765625 | 4 | resultado = str
animal1 = str(input())
if animal1 == 'vertebrado':
animal2 = str(input())
if animal2 == 'ave':
animal3 = str(input())
if animal3 == 'carnivoro':
resultado = 'aguia'
else:
resultado = 'pomba'
else:
animal3 = str(input())
if anima... |
ca2878d4d4c4d33646e67192c7e3a38396be22d4 | aldemirneto/Exercicios-Uri | /Exercícios/1180.py | 321 | 3.5625 | 4 | num = int(input())
referencia = 0
menorvalor = 9999
posicao = 0
numeros = input().split()
for c in range(0, len(numeros)):
referencia = int(numeros[c])
if referencia < menorvalor:
menorvalor = referencia
posicao = c
print('Menor valor: {}'.format(menorvalor))
print('Posicao: {}'.format(posicao))... |
a20a14e929093fcb293b77ea0af997be3ff88f2d | aldemirneto/Exercicios-Uri | /Exercícios/1094.py | 718 | 3.671875 | 4 | total = totalc = totalr = totals = pctc = pctr = pcts = 0
c = int(input())
for i in range(0, c):
numero, tipo = input().split(' ')
total += int(numero)
if tipo == 'S':
totals += int(numero)
if tipo == 'C':
totalc += int(numero)
if tipo == 'R':
totalr += int(numero)
pctc = (t... |
f8177d39e4baafc1d3c40ea35703f472e95e4072 | aldemirneto/Exercicios-Uri | /Exercícios/uri1050.py | 420 | 3.78125 | 4 | ddd = int(input())
cidade = str
if ddd == 61:
cidade = 'Brasilia'
elif ddd == 71:
cidade = 'Salvador'
elif ddd == 11:
cidade = 'Sao Paulo'
elif ddd == 21:
cidade = 'Rio de Janeiro'
elif ddd == 32:
cidade = 'Juiz de Fora'
elif ddd == 19:
cidade = 'Campinas'
elif ddd == 27:
cidade = 'Vitoria'
... |
cb520fd0513804c37ef40b90ea2d31a89b4ff5c5 | aldemirneto/Exercicios-Uri | /Exercícios/1071.py | 229 | 3.609375 | 4 | s1: int
s1 = s2 = 0
c = int(input())
d = int(input())
if c > d:
maior = c
menor = d
else:
maior = d
menor = c
for i in range(menor+1, maior, 1):
if i % 2 != 0:
print('ponto')
s1 += i
print(s1)
|
d3e98a67f07508c23ce9e50d715e7fb3406795cb | aldemirneto/Exercicios-Uri | /Exercícios/1143.py | 86 | 3.6875 | 4 | c = int(input())
for i in range(0+1, c+1):
print('{} {} {}'.format(i, i**2, i**3)) |
2d4df3b4883c22699c4b55e2ef75a429cdc1d53c | YaraSilvst/Atividades | /ei.py | 1,186 | 3.90625 | 4 | opcaoVoto = []
eleitores = 0
qtdCandidatos = 0
def menu():
op = 10
while op != 0:
print("-------------------------\n")
print(" DIGITE UMA OPÇÃO \n")
print("-------------------------\n")
print(" 1 - Cadastrar Candidato \n")
print(" 2 - Cadastrar Eleitor \n")
... |
248ceae3c20cb00c15628b129026decf5af19b8a | YaraSilvst/Atividades | /exemplo_eleicao.py | 6,545 | 3.90625 | 4 | # DESAFIO
# Fechar possiveis brechas pra erro.
# Adicionar o nome ao eleitor.
# Adicionar um menu se a pessoa quer cadastrar um candidato ou eleitor
# No menu tbm tem a opção de votar ou ver apuração de votos
# Dica coloque um campo no eleitor pra poder indicar quem vai votar
from random import *
opcaoVoto = [{
... |
2e2f7e640abd43041a5ed65a71499b32d9ee7712 | yourlabs/cli2 | /cli2/table.py | 4,843 | 3.53125 | 4 | """
Table module for cli2.
This Table module behaves like a list, and is pretty simple. Its purpose is to
tabulate data and it's going to brute force output sizes until it finds a
match.
As such, it's not a good module to display really a lot of data because it
sacrifies performance for human readability.
"""
import... |
edbbdaad463095de27208b6d63a3c120a20b1fc4 | LucasMoretti8/PythonTeste | /aula16.py | 598 | 4 | 4 | '''
lanche = ('Hamburger', 'Suco', 'Pizza', 'Pudim', 'Batata Frita')
for comida in lanche:
print(f'Eu vou comer {comida}')
print('Comi pra caramba!')
for cont in range(0, len(lanche)):
print(f'Eu vou comer {lanche[cont]} na posição {cont}')
print('Comi pra caramba!')
for pos, comida in enumerate(lanche):
... |
7b1abc22368c541e04c95e0c38a0daf16bf57bc3 | jasperalani/Python | /guessing game.py | 1,078 | 4 | 4 | import random
x = 1;
while x:
diff = input("Choose difficulty:\nEasy (e)\nMedium (m)\nHard (h)\n");
diff = str.lower(diff);
if(diff == "e"):
break;
elif(diff == "m"):
break;
elif(diff == "h"):
break;
def game(d):
if(d == "e"):
tries = 10;
maxNum = 10;
... |
cce21967d8f50cdc3ac1312886f909db26cae7cf | bjgrant/python-crash-course | /voting.py | 1,033 | 4.3125 | 4 | # if statement example
age = 17
if age >= 18:
print("You are old enough to vote!")
print("Have you registered to vote yet?")
# else stament example
else:
print("Sorry, you are too young to vote!")
print("Please register to vote as soon as you turn 18!")
# if-elif-else example
age = 12
if age < 4:
... |
0efc11ea4177989652d50c18eaeca9cf25988c18 | bjgrant/python-crash-course | /cars.py | 594 | 4.53125 | 5 | # list of car makers
cars = ["bmw", "audi", "toyota", "subaru"]
# sorts the list alphabetically
cars.sort()
print(cars)
# sorts the list in reverse alphabetic order
cars = ["bmw", "audi", "toyota", "subaru"]
cars.sort(reverse=True)
print(cars)
cars = ["bmw", "audi", "toyota", "subaru"]
# Print the list contents sorted,... |
36dde3af2677f484d9a967ec366029c35554c837 | bjgrant/python-crash-course | /pizzas_4_11.py | 301 | 4 | 4 | # types of pizza
pizzas = ["plain", "pepperoni", "grandma"]
friend_pizzas = pizzas[:]
pizzas.append("sausage")
friend_pizzas.append("meatball")
print("My favorite pizzas are:")
for pizza in pizzas:
print(pizza)
print("My friends favorite pizzas are:")
for pizza in friend_pizzas:
print(pizza) |
fc7eb758462991f9a0fe9bba70048ff183328a5a | Nesar13/Python | /Homeworks/hw3.py | 4,869 | 3.609375 | 4 | '''
Created on: 2/17/16
@author: Nesar Ahmed
Pledge: "I pledge my honor that I have abided by the Stevens Honor System."
CS115 - Hw 3
'''
# Be sure to submit hw3.py. Remove the '_template' from the file name.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' PROBLEM 0
' Implement the... |
839cfe20af967a077979e3bf39ace38deec7dbae | Nesar13/Python | /Labs/lab3.py | 960 | 3.5 | 4 | '''
Created on Feb 12, 2016
"I pledge my honor that I have abided by the Stevens Honor System"
@author: nahmed3 (Nesar Ahmed)
'''
def subset_with_values(target, lst):
#gets the possible numbers that add up to the target
if target ==0:
return [True,[]]
if lst ==[]:
return [False,[]]
use... |
51c2db04519619bccbe5cf9ee744c897ebdc128c | WolfBerwouts/opengrid-1 | /opengrid/library/regression.py | 17,155 | 3.59375 | 4 | # -*- coding: utf-8 -*-
"""
General analysis functions.
Try to write all methods such that they take a dataframe as input
and return a dataframe or list of dataframes.
"""
import datetime as dt
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.formula.api as fm
from statsmodels... |
486bb9536445700bd08803a45f4873018f287618 | Awesome94/Space-Allocator | /src/fellow.py | 421 | 3.53125 | 4 | """Class definition of Fellow
It inherits directly from Person
"""
from .person import Person
class Fellow(Person):
"""Fellow
"""
def __init__(self, first_name, last_name, wants_accommodation, \
person_id, has_living_space=None, has_office=None):
super(Fellow, self).__init__(first_nam... |
5bfeeb9948c267f0d0a4029800ef0cd8157a3689 | Japoncio3k/Hacktoberfest2021-5 | /Python/sumOfDigits.py | 225 | 4.1875 | 4 | num = int(input("Enter a number: "));
if(num<0):
print('The number must be positive')
else:
total = 0;
while num!=0:
total += num%10;
num = num//10;
print("The sum of the digits is: ", total); |
4302cbc5c72d651c47054798ef881cd0f4320819 | ErvinsLazdins/RTR108 | /py4e/task_3_1.py | 259 | 3.59375 | 4 | hrs = float(input("Enter Hours:"))
rph = float(input("Enter rate:"))
if hrs<40:
pay = hrs*rph
if hrs>=40:
virsstundas = hrs-40
pamatalga = (hrs - virsstundas)*rph
bonuss = (hrs-40)*(rph*1.5)
pay = pamatalga + bonuss
print("%.2f"%pay)
|
8fcda08eeb62e72edaf3d1938bf956eac2ab34d8 | dfuent/Scrapers_Sandbox | /Python Web Scraper_dfuentes.py | 2,543 | 3.515625 | 4 | def yearly_baseball_stats(fin_year = 2020, n_years = 10):
#dependencies
import pandas as pd
import time
from selenium import webdriver
from bs4 import BeautifulSoup
import datetime
import os
t_1 = time.time()
#navigate to baseball-reference.com to extract batter stats
... |
df8cbb3a3075b84d32450e44fe2336f5974563e1 | DoubleCs25/Extra-Credit-OddOdd | /OddOdd.py | 512 | 4 | 4 | #Write a function that takes in a list
#and returns the sum of any numbers that occur in odd index, AND
#the value of the number is odd
def OddOdd(values):
Toggle = True
SumToReturn = 0
for value in values:
if(Toggle==True):
if(value%2 == 1):
SumToReturn = SumToReturn+value
Toggle = not Toggle
return Su... |
24a7072d5fc05a2681d6a32633dc194e1021663f | MACRocketry/2018-AltSimulator | /altFilter.py | 7,035 | 3.625 | 4 | '''
Altitude Filter
By: Matthew D'Alessandro
matplotlib must be installed
'''
import csv #imports native csv library to access data
import random #imports native ranom library to genenrate random error
import matplotlib.pyplot as plt #library which generates plots
import statistics as st #native library... |
374b633db6ea93e424e51359aa96e0df935c3606 | nanatkim/pygames | /jogodavelha.py | 1,893 | 3.78125 | 4 | def jogar():
m = ['.','.','.',
'.','.','.',
'.','.','.']
a = 0
jogando = True
while(jogando):
print("\t\t\t Exemplo")
print(" {} | {} | {}\t\t 0 | 1 | 2".format(m[0], m[1], m[2]))
print("---+---+---\t\t---+---+---")
print(" {} | {} | {}\t\t 3 | 4 |... |
be05601e56f237ee1cbb86b3f32d8343909163d0 | tarantoj/chexers-brs | /flying_solo/utils/board.py | 7,001 | 3.875 | 4 | import math
class Board:
"""
Helper class for representing and manipulating a game board
"""
COLOURS = ["red", "green", "blue"]
STARTING_HEXES = {
"red": {(-3, 3), (-3, 2), (-3, 1), (-3, 0)},
"green": {(0, -3), (1, -3), (2, -3), (3, -3)},
"blue": {(3, 0), (2, 1), (1, 2), (0... |
7a1580b0f4c83c9b5cd36268771329aaa9d5e980 | alexey-oblaukhov/Reed-Muller-classification | /Codewords_16_analysis.py | 12,215 | 4.09375 | 4 |
import itertools
#Function which generates a basis vector
def e(i):
return 2**i
#Function which generates a 3-flat with shift 'a' and basis {b1,b2,b3}
def flat(a,b1,b2,b3):
return [a ^ v for v in [0,b1,b2,b3,b1^b2,b1^b3,b2^b3,b1^b2^b3]]
#Function for the symmetric difference of lists A1, A... |
742295130726658e1b2fb2c63772e02015877081 | kangkang09/python_class | /Day2/p2.py | 165 | 4 | 4 | sum = 0
count = 0
while(True):
a = raw_input('enter your number ')
if a == 'done':
break
if a[0] == '#':
continue
sum += int(a)
count += 1
print sum/count
|
110f462b9afd7945a4b0ef9d579f47f180068c4c | kangkang09/python_class | /Day3/p1.py | 124 | 3.65625 | 4 | def getSum(n):
array = range(n+1)
print array
return sum(array)
n = int(raw_input('enter your number '))
print getSum(n) |
9d156f7c7084b5ca06f1f3a2881b93af27abbe73 | figlax/OctetSTL | /OctetSTL.py | 35,998 | 3.671875 | 4 | from stl import mesh
import math
import numpy as np
from matplotlib import pyplot
from mpl_toolkits import mplot3d
def make_lattice(strut_width, chamfer_factor, pitch, x, y, z, closed=True):
"""
This function creates a closed cuboct lattice.
:param strut_width: float lattice strut width
:param chamfer... |
3753948c7b585848b704680ce17228bbecc21311 | Gobi03/Python_mylibrary | /基本操作/関数定義.py | 258 | 3.890625 | 4 | def add(x, y):
ans = x + y
return ans
n = add(3, 5)
print n #=> 8
def func():
return 3, "ABC"
n, s = func()
print n, s #=> 3 ABC
# lambda expression
myfunc = lambda x, y: x + y
print myfunc(3, 5) #=> 8
|
e2dae736096342530b5a4812eb069b2693cfb691 | Gobi03/Python_mylibrary | /Graph/BinaryIndexedTree.py | 306 | 3.546875 | 4 | # 要テスト
# BinaryIndexedTree
N = 42
bit = [0]*(N+1)
# O(logN)
# int * int -> unit
def add(a, w):
x = a
while x <= N:
bit[x] += w
x += x & -x
# O(logN)
# int -> int
def sum(a):
ret = 0
x = a
while x > 0:
ret += bit[x]
x -= x & -x
return ret
|
4a524241dc4c57880336b6a50ed79a088a428b69 | ParulProgrammingHub/assignment-1-arvind89 | /ques12.py | 90 | 3.890625 | 4 | #compute the value of n+nn+nnn....
n=input("enter the number")
p=n + n*n + n*n*n
print(p)
|
119b04bfcd4182fa06ff08295a4b34e0124310e2 | lostoli/dotfiles | /bin/weather.sh | 901 | 3.5 | 4 | #!/bin/python
import urllib.request, json
try:
import httplib
except:
import http.client as httplib
#city = "293396" #Tel Aviv
city = "2654675" #Bristol
#city = "3855974" #Esquel (arg)
#city = "3838859" #Rio Gallegos (arg)
api_key = "2412452cd19fbd5e588235e02df97996"
#conn = False
def have_internet():
... |
4eb7c91e1931f84fb79c1e00590192c74ed7627c | martinstiles/TDT4310-Master-Thesis-Recommendation-Tool | /src/cleaning/cleaner.py | 4,245 | 3.53125 | 4 | """
Pipeline for data cleaning. The resulting data from this process will be on the format:
{
thesis_id:
[
cleaned_title, # 2D array with every title as tokens
# 3D array with description tokens on the format:
cleaned_description,
... |
1d52ec1e83e2f428223741dde50588025375dd26 | derekhua/Advent-of-Code | /Day10/Solution.py | 1,859 | 4.125 | 4 | '''
--- Day 10: Elves Look, Elves Say ---
Today, the Elves are playing a game called look-and-say. They take turns making sequences by reading aloud the previous sequence and using that reading as the next sequence. For example, 211 is read as "one two, two ones", which becomes 1221 (1 2, 2 1s).
Look-and-say sequence... |
eb7037eca42d1d6e9ff91231fbbd81d67d781aa7 | derekhua/Advent-of-Code | /Day23/Solution.py | 3,902 | 3.734375 | 4 | '''
--- Day 23: Opening the Turing Lock ---
Little Jane Marie just got her very first computer for Christmas from some unknown benefactor. It comes with instructions and an example program, but the computer itself seems to be malfunctioning. She's curious what the program does, and would like you to help her run it.
... |
d99ded2d5a7ff34240481143ea8949b2fea584ec | somecrypticname786521/coba_kalkulator | /simple_calc/SimpleCalc.py | 937 | 3.90625 | 4 | class SimpleCalc:
def run(self):
self.__init()
expression = input("Masukkan operasi matematika yang diinginkan: ")
print(expression)
hasil = self.__compute(expression)
print("hasil: " + str(hasil))
def __init(self):
"""
Mengeluarkan kalimat pembukaan
... |
f4c60fc58c8fe4116224c83f4013e1b4c02adb7d | JaviFigueroaRUM05/ProyectoAI | /problems.py | 5,548 | 4.1875 | 4 | #
# Authors: aimacode
#
from search import *
from utils import *
import romania
class Problem:
"""The abstract class for a formal problem. You should subclass
this and implement the methods actions and result, and possibly
__init__, goal_test, and path_cost. Then you will create instances
of your sub... |
324c95fde7d4ba43b74fc9c7a67f526f33fc6abb | gkswkcjswo00/pytuon_gift | /bus.py | 234 | 3.546875 | 4 | a = ("감사합니다")
y = ("반갑습니다")
c = ("안녕하세요")
p = int(input("나이는?"))
if p > 19:
print(a)
elif 12 < p < 20:
print(y)
elif 7 < p < 13:
print(c)
else:
print("무료입니다.")
|
425688eb2f5677154ff1055e4dd7e25373673b95 | 1r0dm480/TallerURJC | /iniciacionPy/math.py | 642 | 3.890625 | 4 | _author__ = 'HackMadrid'
# maths
# suma
print("suma 4 + 9")
suma = 4 + 9
print(suma)
print("--------\n")
# multiplicacion
print("producto 5 * 5")
mult = 5*5
print(mult)
print("--------\n")
breakpoint();
# area triangulo
print("area de un triangulo")
b=12
h=8
area = (b*h)/2
print(area)
print("--------\n")
# area rect... |
b343bc914f593a361ebd6b43e8831bb4ff3ef7d6 | smile901122/ms-offer-python | /PrintMinNumber.py | 378 | 3.953125 | 4 | import functools
def PrintMinNumber(numbers):
if not numbers:
return ""
num = [str(i) for i in numbers]
cmp2key = functools.cmp_to_key(lambda s1, s2: int(s1 + s2) - int(s2 + s1))
num.sort(key=cmp2key)
m = ''
for i in num:
m += i
return int(m)
if __name__ == '__main__':
a... |
b3fe89e25f5a14e6a851b0b7f338fbd7159567c4 | Vicky30-max/python | /calc.py | 1,200 | 3.890625 | 4 |
'''def add(x,y):
z=x+y
return z
def sub(x,y):
z=x-y
return z
def mul(x,y):
z=x*y
return z
def div(x,y):
z=x/y
return z
a=int(input("enter 1stnumber:"))
b=int(input ("enter 2nd number:"))
ch=int(input("choices 1/2/3/4:"))
if ch==1:
print("The addition is" + str(add(a,b)))
elif ch=... |
7fb218b1b2ded679fc85c27ad3280fc57df06812 | orlandoacosta99/python | /ciclo_4/frutiadero/frutas.py | 2,375 | 3.796875 | 4 | class Frutas:
sabor = ''
pelada = False
cantidad = 0
__TIPOS__ = {'banano': [5, 100],
'manzana': [6, 50],
'pera': [5, 70],
'piña': [60, 1500],
'papaya': [130, 2200]
}
def __init__(self, sabor, cantidad):
s... |
4747547993296e18eedbe201ced241c2075e3719 | JuanSaldana/100-days-of-code-challenges | /day-21/Snake.py | 4,891 | 3.859375 | 4 | from random import choice
from time import sleep
from turtle import Turtle, heading, position
from typing import Union
class SnakeHeadings:
UP = 90
DOWN = 270
LEFT = 180
RIGHT = 0
class Snake:
# Snake class
def __init__(self, color="white", length=3):
self.head = None
self.bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.