blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
cf3f6a9fd202034cf4e33e01e986127356f51ec5
NishkarshRaj/Programming-in-Python
/Module 4 Assignments/Assignment18.py
1,601
4.4375
4
#Assignment 18 from abc import ABC, abstractmethod ''' Parent Class Payment ''' class Payment(ABC): VAT = 1.15 #15% VAT def __init__(self,purchasecost): self.purchasecost = purchasecost @abstractmethod def final_payment(self): pass ''' Subclass Cash Payment ''' class Cash(Payment): ...
d8b2dad498b2d00c96c87ac6586413b9ea025002
NishkarshRaj/Programming-in-Python
/Module 1 Assignments/assignment26.py
738
4.09375
4
institute="ABC Training Institue" java_course={"John","Jack","Jill","Joe"} python_course={"Jake","John","Eric","Jill"} print("Number of students enrolled in python course are",len(python_course)) print("Number of students enrolled in Java course only are",len(java_course-python_course)) print("Number of students enroll...
457240c124da43d03566f099fc56386f48acdb2e
NishkarshRaj/Programming-in-Python
/Module 1 Assignments/assignment23.py
1,254
4.03125
4
customer_details = {1001:"John",1004:"Jill",1005:"Joe",1003:"Jack"} flag=0 print("a) Customer Details") for k in customer_details: print("Name of the ",k,"Id customer is",customer_details[k]) print("b) Number of customers") print("Number of customers are:",len(customer_details)) print("c) Print customer names in as...
d31a5ca4e2dce94395236cc14a875ba4655ff59e
NishkarshRaj/Programming-in-Python
/Module 3 Assignments/Lakshika's Work/Assignment3.py
1,512
4.09375
4
print("InfoTech Systems Users") import sqlite3 con = sqlite3.connect("ass.db") #Connection IP cur = con.cursor() '''1) Create a table "Users" from Python code. ''' statement='''create table Users(UserId number(10) primary key,UserName varchar(30) not null,Password varchar(20) not null,UserType varchar(20) check (UserT...
097f648a315bad83e32f0c25ad78ad633bd09289
rutik0309/Passport-GUI-in-Python-Tkinter
/try.py
2,442
3.53125
4
from tkinter.ttk import Combobox from tkinter import * import sqlite3 as db class appoint(): def __init__(self): self.app=Tk() self.app.maxsize(900,700) self.app.minsize(900,700) self.app.title('Passport Seva') font11 = "-family Calibri -size 15 -weight bold -sla...
a166e7f5640e5841bf3006919911e72ad1036740
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_7_高级语法(类对象-实例对象-类方法-实例方法-类属性-实例属性-静态方法)/001_类对象_实例对象_类属性_实例属性.py
1,580
4.21875
4
# python2中分经典类和新式类写法不一样:经典类里面要写object,新式类不用写, # python3未区分,直接不写,因为python3中默认继承object类,都是新式类 # 类对象:就是一个类,只有一个 # 实例对象:类对象的实例化,可以有多个 # 类属性:属于类,实例对象共有的属性可以放在类属性中,可以直接通过类访问或者实例访问,比如country属性 # 实例属性:属于实例特有,每个实例的属性都不相同,比如name属性 # 类属性在内存中只保存一份 # 实例属性在每个对象中都要保存一份 # 应用场景: # 通过类创建实例对象时,如果每个对象需要具有相同名字的属性,那么就使用类属性,用一份既可 # obj...
0bbbc9ad20933ce36c512f876417aca90f59dbdf
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_2_高级语法(装饰器-闭包-args-kwargs)/010-args_and_kwargs_1_含义.py
1,370
4.03125
4
# -*- coding: utf-8 -*- # *args: 允许函数 传入多个不定量个数的非关键字参数,传入方式元组 # 传进的所有参数都会被args变量收集,它会根据传进参数的位置合并为一个元组(tuple), # args是元组类型,这就是包裹位置参数传递 # **kwargs: 允许函数传入多个不定量个数的关键字参数,传入方式字典 # 关键字参数:用于函数的调用,通过“键-值”的形式 # kwargs是一个字典(dict),收集所有关键字参数,包裹关键字参数传递 # *和**代表多个的意思,多个参数 # 传入位置参数和关键字参数 # 一个关键字直接使用等号,多个关键字参数加使用字典,前面加** def may_f...
60b1032ae9083a593251714ba73f9712910314f8
FelixZFB/Python_advanced_learning
/01_Python_basic_grammar_supplement/009_oop-面向对象编程(看下面02文件夹解释更清晰明了,来自TLXY_study_note)/13_3_1_魔法函数_init_call__str__.py
459
4
4
# 7. 类的常用魔术函数 class A(): def __init__(self): print("我是init哈哈哈哈,我被调用了") def __call__(self): print("我是call哈哈,我又被调用了一次") def __str__(self): return "我是str哈哈,我又被调用了字符串函数" # __init__ 就是一个魔法函数,自动调用 a = A() # 实例当函数使用,自动调用__call__函数 a() # str,返回字符串函数 print(a)
9436736f77545d61985d59dd3d6b54f5ed53834a
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/002_多线程_多进程_协程_进阶汇总/002_多进程/009案例测试文件夹[复件]/sandwich_orders_7_8.py
408
3.84375
4
# coding=utf-8 # һб # ϸ˵P113 sandwish_orders = ['beef', 'banana', 'apple'] finished_sandwiches = [] while sandwish_orders: current_sandwiche = sandwish_orders.pop() print("I made your " + current_sandwiche + " sandwish") finished_sandwiches.append(current_sandwiche) for finished_sandwiche in finished_san...
5650f49229e4e079fd1f9cecc96774b17cd267fc
FelixZFB/Python_advanced_learning
/01_Python_basic_grammar_supplement/005_Python常用内置函数/006_partial_偏函数用于进制转换.py
604
4.28125
4
# 偏函数最常用地方:进制转换 # 进制转换int函数,包含关键字参数base from functools import partial # 把字符串转化为十进制数字,base默认转换为十进制 print(int("123")) print(int("123", base=10)) print(int("123", base=8)) print("------------") # 使用偏函数生成一个新函数,第一个参数为原函数名int,第二个参数为关键字参数base # 实现上面字符串转换为各种进制的功能 int2 = partial(int, base=2) print(int2("1010")) int8 = part...
357fa0948f3f2bbd9b04c80dfafe004aa3fc906e
FelixZFB/Python_advanced_learning
/01_Python_basic_grammar_supplement/007_Python重点基础知识补充2(已分类添加到开发技巧总结项目中)/001_Python运算符补充.py
264
3.75
4
# -*- coding: utf-8 -*- # Page44 # // 求整除数 print(7 // 2) # 结果:3 # % 求余数 print(7 % 2) # 结果:1 # 运算顺序 print(2 * 5 ** 2) # 先计算后面5 ** 2 = 25, 再计算前面的2 * 25 # 改变运算顺序使用括号 print((2 * 5) ** 2)
7dd5044ebaf63436f75c1a277c173f4662e13de7
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_1_常用爬虫相关知识和函数补充汇总(来自爬虫开发与项目实战,已分类添加到开发技巧总结中)/003-字符串和列表相互转换(网址取部分值作为文件名).py
409
3.515625
4
# 字符串和列表的转换 l1 = ['a', 1, 'b', 2] l2 = [str(i) for i in l1] print(l2) l3= ''.join(l2) print(l3) l4 = list(l3) print(l4) # 用网址最后几位编号作为图片的名称 root_url = 'https://b.porngals4.com/media/galleries/1/16/83073-1479192302/abella-danger-karlee-grey-the-seduction-of-abella-danger-5493431-2781391748.jpg' l = list(root_url) filen...
11d30722b9e1bcefe29127ad51752c47d12b6d81
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_9_高级语法(魔法属性-init-module-class-call)/002_魔法属性__call__str__方法.py
760
4.09375
4
# __call__方法:实例化对象后面加括号,触发执行。 # 注:__init__方法的执行是由创建对象自动触发的,即:对象 = 类名() ; # 而对于 __call__ 方法的执行是由对象后加括号触发的,即:对象() 或者 类()() class Foo(object): def __init__(self): pass def __call__(self, *args, **kwargs): print("__call__") def __str__(self): return "获取对象描述时候自动调用" obj = Foo() # 自动执...
0d6a4ceba395b0bd273f6efbd6b54fb28133f19b
FelixZFB/Python_advanced_learning
/04_Python_expand_knowledge_解析相关_正则XPathBS4CSS/001_re_正则表达式/015_P_分组重命名_关键字参数_大量分组相同匹配.py
898
3.890625
4
# -*- coding:utf-8 -*- import re # P重命名了解,一般位置匹配够用了 # (?P<name>分组的内容) ?P<name> 用于给分组起别名,类似于关键参数 # (?P=name)或者(\g<name>) 引用别名为name分组匹配到的字符串, 引用上面的关键字参数的组,匹配一模一样的字符 # 分组重命名匹配,如果相同标签或字符的分组特别多,使用\1 \2 \3就会容易找不到位置 # 因此,可以对每个分组重命名,分组里面加上?P<name>即可 # 后面使用该分组时,分组里面使用?P=name # 注意,前后相同匹配都需要使用分组,小括号 html_str = '<body><div>...
f965538b7800022f318bef4c1a54b2f6626b1abe
FelixZFB/Python_advanced_learning
/04_Python_expand_knowledge_解析相关_正则XPathBS4CSS/001_re_正则表达式/017_re.sub_匹配查找替换_替换值支持函数调用_替换值增减或改变.py
434
3.953125
4
# -*- coding:utf-8 -*- import re # 定义一个函数,tem参数就是正则匹配的结果 def add(temp): strNum =temp.group() num = int(strNum) + 1 return str(num) # add自动调用上面的add函数,匹配的值处理后返回一个值 # 返回值替换掉字符串中的值 ret = re.sub(r'\d+', add, 'python = 999') print(ret) print('*' * 50) ret = re.sub(r'\d+', add, 'python = 99') print(ret) print(...
dfb2cee8ee85eb39a841052a7395d21257c79424
FelixZFB/Python_advanced_learning
/04_Python_expand_knowledge_解析相关_正则XPathBS4CSS/005_lxml_BS4解析(来自TLXY_study_note)/67_12_bs4_lxml_查找解析_findall查找所有标签_遍历文档树_提取标签属性attrs.py
1,171
4.28125
4
# 遍历文档树 html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title"><b>The Dormouse's story</b></p> <p class="story">Once upon a time there were three little sisters; and their names were <a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>, <a href="http://exam...
dbbf351ccbbf01033fa2e59eb6cadf2ea7759b02
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/002_多线程_多进程_协程_进阶汇总/002_多进程/001_多进程_简单使用_multiprocessing.Process.py
1,045
3.515625
4
# -*- coding:utf-8 -*- import multiprocessing import os from time import sleep, ctime def sing(): for i in range(3): print("正在唱歌...%d" % i) sleep(1) print("process1 id: ", os.getpid()) def dance(): for i in range(3): print("正在跳舞...%d" % i) sleep(1) print("pro...
e61fc0677e38fca504a7b7f7a25e7b3755945e8e
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/002_多线程_多进程_协程_进阶汇总/007_ch01_爬虫开发多进程_分布式进程(来自Spider_development_study_note)/1.4.3_1 queue.Queue_多进程通信_基本队列_先进先出.py
179
3.8125
4
# 基本队列,先进先出 import queue import time q = queue.Queue() for i in range(5): q.put(i) print(i) while not q.empty(): print(q.get()) time.sleep(2)
0f3015e387600a79bbc7a8361502c1a0ab4cce93
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/002_多线程_多进程_协程_进阶汇总/003_协程_迭代器_生成器/006_斐波拉契数列_简单实现_占用大量内存.py
1,205
3.921875
4
# -*- coding:utf-8 -*- # 数学中有个著名的斐波拉契数列(Fibonacci), # 数列中第一个数为0,第二个数为1, # 其后的每一个数都可由前两个数相加得到: # 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... # 初始数据 a = 0 b = 1 # 生成 nums = list() nums.append(a) # a是前一个数,b是后一个数 a, b = b, a+b # a=1 b=0+1 nums.append(a) a, b = b, a+b # a=1 b=1+1 nums.append(a) a, b = b, a+b # a=2 b=1+2 num...
76d29c7afd57da04565a6ba253d019c8262554e4
FelixZFB/Python_advanced_learning
/04_Python_expand_knowledge_解析相关_正则XPathBS4CSS/001_re_正则表达式/011_re.match_匹配检测_变量名是否有效.py
817
3.65625
4
# -*- coding:utf-8 -*- import re names = ['name1', '_name', 'name_1_1', '2_name', '_name_', '#_name_','name?_', 'name!'] for name in names: # 注意:\w等价于[A-Za-z0-9_],但是可以匹配中文字符 # 变量名字母或者下划线开头(不能数字开头) # 字母数字下划线结尾 # [a-zA-Z_]:判断第一位一定只能是字母或者下划线 # [a-zA-Z0-9_]*:第二位开始只能是字母数字下划线,可以出现0次或多次 # $:检测到字符串的结尾...
90a1ef812e7f519ad501eb4783a4ede1be7f2088
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/002_多线程_多进程_协程_进阶汇总/002_多进程/009案例测试文件夹[复件]/counting.py
170
3.65625
4
# coding=utf-8 # ѭӡֱָֹ֣ current_number = 1 while current_number <= 10: print(current_number) current_number += 1
8733771b411720e7fe508116260f5283aa3fd225
FelixZFB/Python_advanced_learning
/08_Python_interview_testing/005_字符串123转换为数字123的多种方法.py
723
3.75
4
# 使用ord函数,将str类型或unicode类型转换为ascii数值 # ord返回值为十进制整数,是int类型 def atoi(s): num = 0 for v in s: num = num * 10 + ord(v) - ord('0') print(num) return num atoi("123") # 上面函数第一次执行时:num=0 v=1 num = 0*10 + 49 - 48 = 1 # 上面函数第二次执行时:num=1 v=2 num = 1*10 + 50 - 48 = 12 # 上面函数第三次执行时:num=12 v=2 num = 12*1...
975bd6d3b8353236e827694206812f7a74ff8130
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_11_高级语法(迭代器与生成器_yield_iterator)/005_为什么要用yield生成器函数_补充range_xrange.py
3,314
4.15625
4
# -*- coding:utf-8 -*- # 为什么用这个生成器,是因为如果用List的话,会占用更大的空间, # 比如说取0,1,2,3,4,5,6............1000 # 下面举例,只取到10, 1000结果太长了 for n in range(10): a=n print(a) # 相当于return a print("*" * 100) # 生成器实现 def foo(num): print("starting...") while num<10: num=num+1 yield num for n in foo(0): print...
87368e54976e6694a47fe583489b230c65ef6a58
FelixZFB/Python_advanced_learning
/02_Python_advanced_grammar_supplement/001_2_高级语法(装饰器-闭包-args-kwargs)/011-语法糖之装饰器_4_装饰器本身带参数.py
1,103
3.609375
4
# -*- coding:utf-8 -*- def set_level(level_num): def set_func(func): def call_func(*args, **kwargs): if level_num == 1: print("-----权限级别1-----") elif level_num == 2: print("-----权限级别2-----") return func() return call_func retu...
ceafa6b0812ae36a4c0500c799b4b0ce1849f95f
azsami/Tkinter
/calculator.py
3,443
4.34375
4
from tkinter import * root = Tk() root.title("Simple Calculator for adding") e = Entry(root,width=35,borderwidth = 5) e.grid(row=0,column=0, columnspan=3, padx=5, pady=5) #e.insert(0,"Enter Your Email: ") def button_click(number): current = e.get() e.delete(0, END) e.insert(0, str(current)+...
ed6de78479a3666ec1decd0daaaa4cb1a6e48c63
tsarg88/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
1,115
4.25
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. Initial commit ''' def count_th(word, count=0): # Defining n1 length of the...
93b1689b6fb123feb6cfde94b84c139d01041e1c
gaylonalfano/30-days-of-python
/Day26-python-databases-sql-alchemy/pickle_basics.py
1,691
4.34375
4
""" NOTES: - DO NOT CREATE A FILE CALLED pickle.py! - Pickles can save STATE so you can pickle some data and pass it around and when you open it back up it maintains the original state. This is different from a .txt or .csv, since if you later change a data type then the CSV won't know/remembe...
a9d193ea7d63941e55e90d0443488f56717da5ba
beizaa/8.hafta_odevler-Fonksiyonlar
/week8_huiswerk/week8_6.py
1,995
4.09375
4
#6. Kullanıcıdan 2 basamaklı bir sayı alın ve bu sayının okunuşunu #bulan bir fonksiyon yazın. Örnek: 97 ---------> Doksan Yedi a = int(input("Please enter a two digit number: ")) def the_reader(a): if a in dict1: print(dict1[a]) else: pass dict1 = {10:'ten', 11:'eleven', 12:...
c970697fe782170e32d1ade787fc98affca9f000
Samuel1P/Python_OOPs
/ClassesSection/addind_bound_method_to_obj.py
426
3.640625
4
class Time: def __init__(self, hour, min): self.hour = hour self.min = min ind_time = Time(23, 13) us_time = Time(1,25) print (ind_time.__dict__) def say_time(self): print (f"Time here is {self.hour}:{self.min}.") print (ind_time.__dict__) from types import MethodType my_bound = MethodType(...
d9888cd8f21871984438df4c63587920060e7568
Samuel1P/Python_OOPs
/older_stuff/Employee_Basic_Email.py
496
3.765625
4
class Employee: def __init__(self, fname, lname, age): self.fname_ = fname self.lname_ = lname self.age = age def basic_details(self): return f"{self.fname_} {self.lname_} is {self.age} years old." def get_email(self): return f"{self.fname_}{self.lname_}@email.com"...
67690da4912bae30f1f7b5bd64c192f4b9555cf9
Samuel1P/Python_OOPs
/InheritanceSection/overriding.py
525
3.71875
4
class Person: def __repr__(self) -> str: return f"{self.__class__.__name__}()" def whoami(self): print("I am a Person") def my_species(self): print("I am of species homo sapiens") def my_role(self): return self.whoami() class Student(Person): def whoam...
2d0b7f98fd2113957abc2935f243197d3f991902
Samuel1P/Python_OOPs
/older_stuff/oops_inheritance.py
864
3.71875
4
class phone: promo1 = 0.90 promo2 = 0.70 def __init__(self, brand, model, price): self.brand = brand self.model = model self.price = price def get_offer(self, offer): new_price = self.price if offer == 1: new_price = self.price * self.promo1 e...
950b3f0d2345e16beb8693d56a650888df9b56a5
cataluna84/hpp-book
/high_performance_python_2e/11_less_ram/probabilistic_datastructures/utils.py
383
4.21875
4
def trailing_zeros(number): """ Returns the 1-based index of the first bit set to 1 from the right side of a 32bit integer >>> trailing_zeros(0) 32 >>> trailing_zeros(0b1000) 4 >>> trailing_zeros(0b10000000) 8 """ if not number: return 32 index = 0 while (numb...
88c2575241326264e87c29a09cfa1e8fc021f3ec
htmtri/pythonstuff
/hw/4.5.12.py
1,152
3.921875
4
def stars(m_dict,tv_dict): result = {} for (key,val) in m_dict.items(): for i in range(0,len(val)): if not val[i] in result: result[val[i]] = [key] else: result[val[i]].append(key) result[val[i]].sort() for (key,val) in tv_dict....
1b88eed2af0890676e4a2c6f2841c04089d3b121
htmtri/pythonstuff
/hw/5.2.5.py
1,050
4.125
4
#Write a function called count_capital_consonants. This #function should take as input a string, and return as output #a single integer. The number the function returns should be #the count of characters from the string that were capital #consonants. For this problem, consider Y a consonant. # #For example: # # count_c...
42633fe363775e684ac5820d9654ef8081846da7
uBaHTT/Lesson1
/22.09/task_3.py
746
3.609375
4
import RPi.GPIO as GPiO GPiO.setmode(GPiO.BCM) GPiO.setup(22, GPiO.OUT) p = GPiO.PWM(22, 1000) try: while True: inputStr = input("Enter dutycycle between 0 and 100 ('q' to exit) > ") if inputStr.isdigit(): value = int(inputStr) if value >= 101: print("The...
86d18f0143b328716f7eddb5bdad1e127840a776
Kamogelo98/pythonProblems
/is_palindrome.py
633
4
4
""" is_palindrome(word) method that takes in a string word and returns the true if the word is a palindrome, false otherwise. A palindrome is a word that is spelled the same forwards and backwards.""" def is_palindrome(word): length = len(word) first = 0 last = length - 1 status = 1 while(first < ...
9f21f7e7b796d52b4c0ee26cfee001af18284cef
FB-18-19-PreAP-CS/math-helper-helenasimmons
/math_helper_simmons_helena.py
6,285
4.3125
4
import math def dist_formula(x1,y1,x2,y2): ''' returns the distance between two sets of coordinates >>> dist_formula(8,2,3,2) 5.0 >>> dist_formula(3,7,5,7) 2.0 >>> dist_formula(2,3,4,5) 2.83 >>> dist_formula(10,0,0,4) 10.77 >>> dist_formula(-7,-2,6,9) ...
c732c0fbc0d02c4b21f9b6970f78054a70787211
naeem-akhtar/Wikipedia-web-scraper
/main.py
2,384
3.515625
4
#dependencies import operator import json from tabulate import tabulate import sys from functions import * # all functions reside in this file #get data from wiki wikipedia_api_link = "http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=" wikipedia_link = "http://en.wikipedia.org/wiki/" ...
69ad6bbd1577769b0cc977a5ea568c92049da6df
Miroslav2019/wordgen
/wordgen/functions.py
2,190
3.671875
4
#This is the functions file #For the main script see the file 'main.py' #To configure see the file 'config.py' import random as rnd import config as kon def choose_consonant_list(): '''see config.py for how consonants are grouped.''' if rnd.random() > kon.THRESHOLD: if rnd.random() > kon.THRESHOLD: ...
3b51093546028e35e28f1eef25f0971dcfce4d3d
carlodevnet/CorsoDEVASC2021A
/Modulo3/Unit Testing/UnitTest_Circumfrence.py
1,838
3.53125
4
# Importiamo il modulo math per avere accesso alle librerie necessarie import math # Importiamo la libreria unittest per eseguire i test import unittest # This is the UNIT in the Unit Test # cioè la porzione di codice che stiamo testando # La formula per calcolare la circoferenze è raggio * 2 * 3,14 (pi-greco) def cal...
75713ca625dd6c52dbf71deb8c2480bdeaa5e3cd
garciparedes/python-getting-started
/reminders.py
946
3.8125
4
from time import sleep, time def main(): reminders = list() while True: command = input() for reminder in reminders: if reminder[1] - time() >= 0: continue reminder[0] = True reminders.sort() if command == "q": break e...
b437070baf452724cf22beae35a328c14682c659
manakupadhyay/Python-Programs
/lists.py
2,339
4.625
5
# LISTS IN PYTHON # to create an empty list empty_list = [] empty_list_2 = list() # ---------- languages = ['C++', 'Java', 'JavaScript', 'Python',8] # print(min(languages)) print(languages) print(languages[2]) # print the second index print(languages[0:3]) # print from 0(inclusive) to 3(exclusive...
82ce1edd698822a90d232e05abb368ab08b656e6
manakupadhyay/Python-Programs
/numbers.py
353
4.09375
4
# NUMBERS IN PYTHON... print(5/3) print(5//3) # for floor division print(5**2) # for 5 raise to power 2 print(abs(-2)) print(round(3.711)) var_1 = 10 var_2 = "20" print(float(var_1) + float(var_2)) # this is type casting in python... print(type(var_1)) # this is type casting in pyth...
a3372cb004284958c458083aef225d4fd337c132
ximua00/DM_Techniques
/Assignment_2/Syntax/preprocessing_balance.py
1,387
3.515625
4
'''Preprocessing: Class unbalance''' import pandas as pd import numpy as np import time import pickle def class_balance(dataset, k = 10): '''Function deals with class imbalance: deletes negative examples i: dataset; k - number of observations to keep per query o: dataset filtered ''' print ('-'*20) print ('...
edb98e6477ef5f4359f7353a65e2d339d9d32870
drawjk705/us-congress
/us_congress/_utils/unique.py
481
3.5
4
from typing import Collection, List, Set, TypeVar T = TypeVar("T") def getUnique(items: Collection[T]) -> List[T]: """ Get all unique elements in a list Args: items (List[T]) Returns: List[T]: list with distinct items """ uniqueList: List[T] = [] seenItems: Set[T] = set...
c17485695b775dd7a1d8b60ed19a53c18e820753
jpjung2/AutomateTheBoringStuff
/Chapter5_Dictionaries_and_Structuring_Data/dictionary_2.py
654
4.25
4
""" Looking at Dictionary creation, comparison, copying, and adding and removing elements to and from dictionaries """ temp = {} temp1 = {'key': 'value'} print(temp == temp1) temp2 = {'one': 1, 'two': 2, 'three': 3} temp3 = {'three': 3, 'two': 2, 'one': 1} print('temp2 == temp3', temp2 == temp3) temp4 = temp3...
4bca4c2db912159b196b8ae712d8960c02d3c0d8
TheCodex498/TheDatabase
/01-Python Projects/02-Python Projects/GuessMe.py
1,444
4.03125
4
""" Guess Me! My second take at Python Games! """ from random import randint secretNumber = randint(0, 100) numberOfGuesses = 0 print("****************WELCOME TO GUESS ME!!****************") print("I'm thinking of a number between 1-100, and your job is to guess it!") print("Enter a number between 1-100"...
42099fb54fd2ba82c08b8d743c30806e885e8fa1
shirisha24/file
/student.py
126
3.671875
4
with open("student.txt","r") as file : a=file.readlines() for line in a: word=line.split() print(word)
7a588af912215490ccd32769b37611f65cf0614c
maneshreyash/Neural_Networks
/NeuralNet.py
10,933
4.1875
4
##################################################################################################################### # CS 6375 - Assignment 2, Neural Network Programming # This is a starter code in Python 3.6 for a 2-hidden-layer neural network. # You need to have numpy and pandas installed before running this c...
bdd6a74c0017cbc233ac93e12cc8030837131470
monsterzzz/torchStart
/titanic.py
499
3.90625
4
# import pandas # df = pandas.DataFrame([["a",2,"c"], ["b",4,"a"], ["c",7,"b"], ["d",4,"d"]]) # df.columns = ["col1","col2","col3"] # df.index = ["i1","i2","i3","i4"] # col1 = pandas.get_dummies(df["col1"],drop_first=True) # col3 = pandas.get_dummies(df["col3"],drop_first=True) # print(df) # df = pandas.concat([df,...
eff366deae29f79cd25b0d637c8e23fcfd693708
jorgegomzar/PythonCourse
/Dia 4/Soluciones ejercicios 6/ejercicio6.1.py
356
3.5
4
import turtle import math x = 1080 y = 720 h = math.hypot(x,y) ang = math.degrees(math.atan(y/x)) s = turtle.Screen() turtle.setup(x,y) t = turtle.Turtle() t.resizemode('user') t.turtlesize(3, 3) t.penup() t.setx(-x/2) t.sety(y/2) t.pendown() t.right(ang) t.forward(h) t.penup() t.right(180 - 2*ang) t.sety(y/2) t.pendo...
15ea86d4f18aeb8f4b7908495a04082d3e202036
jorgegomzar/PythonCourse
/Dia 2/Soluciones ejercicios 3/ejercicio3.7.py
219
3.734375
4
# Utilizo el mismo código que el 6, no leí bien el enunciado anterior y acabe resolviéndolo ya con uno x = 1 c = 0 while c < 10: print(x, x+1, x+2, x+3, x+4, x+5, x+6, x+7, x+8, x+9, sep='\t') c = c + 1 x = x + 10
76c9ef5fb3c290175b5ed92970f5618fe0738b84
jorgegomzar/PythonCourse
/Dia 3/Soluciones ejercicios 5/ejercicio5.1.py
275
3.890625
4
def buscaCero(n1, n2, n3): if n1 == 0 or n2 == 0 or n3 == 0: return True else: return False n1 = int(input('Introduce el primer número: ')) n2 = int(input('Introduce el segundo número: ')) n3 = int(input('Introduce el tercer número: ')) print(buscaCero(n1, n2, n3))
afc2eb691fb3177d731c865b54764fd3c297f3d1
jorgegomzar/PythonCourse
/Dia 1/Soluciones ejercicios 1/ejercicio3.py
206
3.90625
4
import math base = int(input('¿Qué base? ' )) potencia = int(input('¿Qué potencia de '+str(base)+'? ')) print(str(base)+' elevado a la potencia '+str(potencia)+' es '+str(int(math.pow(base,potencia))))
2954a22df6ec679fa5c83f181b96ab7ef065d023
jorgegomzar/PythonCourse
/Dia 4/Soluciones ejercicios 6/ejercicio6.4.py
268
3.984375
4
import turtle turtle.setup(800, 600) c1 = turtle.Turtle() x = 50 colores = ['red', 'green', 'blue'] for i in range(3): c1.pendown() if i < 3: c1.pencolor(colores[i]) c1.circle(x) c1.right(90) c1.penup() c1.forward(x) c1.left(90) x = 2 * x turtle.mainloop()
730d44d86b0a24384fb60b7ff050bd67d88ae2b4
jorgegomzar/PythonCourse
/Dia 3/Soluciones ejercicios 5/ejercicio5.6.py
164
3.8125
4
def getContinue(): finalizar = False while not finalizar: ans = input('¿Quiere continuar? (s/n) ') if ans == s or ans == n: finalizar = True getContinue()
f02621452623d630f18ba0c783fb5eb1c241aded
wellstseng/stockflow
/ctrls/Reader.py
1,036
3.5625
4
#!/bin/python # -*- coding: utf-8 -*- import csv from settings import * from os.path import join class Reader(): '''To Read file''' def __init__(self, number): self.path = join(TSEC_DATA_PATH, number + '.csv') try: csvfile = open(self.path, 'rb') self.csvreader = csv.re...
f8ae770ed06295f542cba4e641dc7d26c14da194
gl5212008/algorithm
/算法/merge_sort.py
1,368
3.640625
4
import random from cal_time import * # def merge_two_list(li1, li2): # i = 0 # j = 0 # ans = [] # while i < len(li1) and j < len(li2): # if li1[i] < li2[j]: # ans.append(li1[i]) # i += 1 # else: # ans.append(li2[j]) # j += 1 # while i <...
1272df8c58de6af3a425eed47fcbfd1e352a316e
IsadoraFerrao/Python-beginners
/for-random.py
245
3.546875
4
# for algo in grupo #funcao algo #for num in '987654': # print(num) #for num in 'isadora': # print(num) import random for sorteio in range(2): #quantos sorteios desejo num_sorted=random.randint(10,50) print(num_sorted)
e0533cd28227e68c7630fb17479e07ad35e53601
IsadoraFerrao/Python-beginners
/dedezinha-multiplos.py
239
3.984375
4
import random numero = random.randint(1,100) if(numero%3 == 0 and numero%5 == 0): print("Dedezinha Querida") elif(numero%3 == 0): print("Dedezinha") elif(numero%5 == 0): print("Querida") else: print(f"Numero = {numero}")
2903ce8d2ba38d9a0ada903a3cf483ca9ce84e42
IsadoraFerrao/Python-beginners
/list.py
471
3.640625
4
cursos = ['ingles', 'port', 'hist', 'python', 'alemao'] notas = [7.5, 4, 8, 2, 10] cursos_e_notas = cursos+notas #unindo duas listas #print(cursos[0:3]) #3 primeiros valores #print(cursos_e_notas) #print(cursos[1:-2]) #cursos.append('karate') #add elemento cursos.extend(notas) #unindo listas #.insert(0, 'karate') #ad...
7467ff9ca5b14f6372b4241b9e5f84ad32a4234a
p45922ap0819/json
/text4.py
650
3.6875
4
# -*- coding: utf-8 -*- import sqlite3 conn = sqlite3.connect('test1.db') c = conn.cursor() print("Opened database successfully") c.execute("INSERT INTO SCHOOL (ID,NAME,AGE,COUNTRY,PHONE) \ VALUES (1, '王曉明', 15, 'China', 012345678 )"); c.execute("INSERT INTO SCHOOL (ID,NAME,AGE,COUNTRY,PHONE) \ VALUES (2, 'Al...
e5a01f7ac45ba2156e48348134b7cdf1d4feeefb
wegesdal/udacity-ml
/Supervised_Learning/project2_analyzing_student_data.py
1,509
4
4
# Importing pandas and numpy import pandas as pd import numpy as np # Reading the csv file into a pandas DataFrame data = pd.read_csv('student_data.csv') # Printing out the first 10 rows of our data data[:10] # Importing matplotlib import matplotlib.pyplot as plt # Function to help us plot def plot_points(data): ...
f8137076318aa192f55f0334f29d325505cdba17
wegesdal/udacity-ml
/Supervised_Learning/linear_regression3.py
957
3.96875
4
# Add import statements from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression import numpy as np import pandas # Assign the data to predictor and outcome variables # Load the data train_data = pandas.read_csv('data2.csv') X = np.reshape([train_data['Var_X']], (20, 1)) y...
076a63b653e51fcf42c4ff2d6851037f67d08f86
SonNinh/travelling_salesman
/prim_mst.py
3,937
3.609375
4
from math import sqrt import sys from time import time from matplotlib import pyplot # from mpl_toolkits.mplot3d import Axes3D def get_distance(node_a, node_b): return sqrt((node_a[0]-node_b[0])**2 + (node_a[1]-node_b[1])**2) class Graph(): def __init__(self, vertices, ls_of_nodes): self.v = vertic...
144e7dd92550625043fc5fd5d22e27252fb5cb7d
GYD102/dcp
/p002/p002v0.py
497
3.5625
4
#!/usr/bin/env python3 def p002(l): pi = 1 for m in l: pi *= m return [pi / i for i in l] def p002_without_division(l): p = 1 out = [] for m in l: for i in range(len(out)): out[i] *= m # out = [m * x for x in out] out.append(p) p *= m ret...
a6ddc22e5261cdf36260eb3887d86532d7815185
linuxfranklin/benjamin
/BMI calculator.py
502
4.3125
4
height=float(input("Enter your height:")) weight=float(input ("Enter your weight:")) bmi=weight/ (height**2) bmi_rounded=round(bmi) if bmi_rounded<18 : print(f"You are under Weight BMI={bmi_rounded}") elif bmi_rounded<=22 : print(f"you have a normal weight BMI={bmi_rounded}") elif bmi_rounded<=28 : print(f...
bf0677c67f320be107052c34a6b02590bd8c3bcc
jleakakos-cyrus/euler
/python/problem10.py
960
3.984375
4
# Problem 10 # Find the sum of all the primes below two million. NUMBER = 2000000 TEST = 10 def isprime(n): '''check if integer n is a prime, and add it to the list of prime factors if it is not already in there''' # make sure n is a positive integer n = abs(int(n)) # 0 and 1 are not primes if n < 2...
fe27883fea7e38cb623c9c7b89e5931f340c0ca5
jleakakos-cyrus/euler
/python/problem25.py
844
3.859375
4
# Problem 25 # What is the first term in the Fibonacci sequence to contain 1000 digits? def fibonacci(value, fiboSequence=[]): if (value == 1): return [1] elif (value == 2): return [1, 1] if (len(fiboSequence) == 0): fiboSequence.append(1) fiboSequence.append(1) v1 = fiboSequence[len(fiboSeque...
d62ce8fd4fe0ed4bf6ffeba2983dc8fdb611725d
jleakakos-cyrus/euler
/python/problem6.py
378
3.859375
4
# Problem 6 # What is the difference between the sum of the squares and the # square of the sums for the first 100 natural numbers? firstTen = range(1, 11) numbers = range(1, 101) def sumOfSquares(list): return sum([x**2 for x in list]) def squareOfSum(list): return sum(list)**2 if __name__ == '__mai...
60ae306b37f6aaa4e770cbdaa54a5c0479b73ae4
ophiaYang/Mathematical-modeling-contest
/非线性规划.py
1,131
3.5
4
import numpy as np from scipy.optimize import minimize # 目标函数 def objective(x): return (x[0] - 1)**2 + (x[1] - 2.5)**2+np.log(x[0]) # 约束条件 def constraint1(x): return x[0] - 2 * x[1] + 2 #不等约束 def constraint2(x): return -x[0] - 2 * x[1] + 6 #不等约束 def constraint3(x): re...
cd8b232638f4436f1850340eb68aab706cff6aa8
Jwhistlecraft/PythonWeek1
/Intermediate.py
1,344
3.9375
4
#black jack def hands(hand1,hand2): difference = hand1 - hand2 if hand1 > 21 and hand2 > 21: print("both players are bust with a hands of %d and %d" %(hand1,hand2)) elif hand1 > 21 and hand2 <= 21: print("player1 is bust with %d" %(hand1)) elif hand2 > 21 and hand1 <= 21: prin...
b2c8d4a7083a2dc1e2277761248bf44069eea602
jk983294/morph
/book/lightgbm/feature/categorical_feature.py
566
3.625
4
import lightgbm as lgb import numpy as np data = np.random.randint(0, 10, size=(500, 3)) label = np.random.randint(2, size=500) # binary target # specific feature names and categorical features # LightGBM can use categorical features as input directly. # It doesn’t need to convert to one-hot coding, and is much fast...
a9a7097f44a4e066c6d304fd9af5bd61e158eb9b
Irfan-NXP/ninjaxpress-training
/Pert-2.py
575
4.0625
4
# name = input("Enter Name: ") # print("Your Name is "+ name) # Operasi terhadap tipe data (String) #a = "Hello World!" #b = "Have a Nice Day!" #c = a + " " + b #print(len(a)) #print(a[0:5]) #a = a.replace('World', 'Ninja') #nama = 'Irfan' #alamat = 'Jakarta' #profile = 'Name saya {} dan saya tinggal di {}'.format...
0f93c60f16260aa2cad46f9616e1934d29ae560c
Taomengyuan/Demo
/Pythonbasic/08-文件和异常练习/demo01_2.py
296
4.09375
4
#编写一个用户自定义异常,当用户输入的文本长度小于6个字符时,抛出这个异常 class CustExcp(Exception): pass try: i=input("Enter the text:") if len(i)<6: raise CustExcp() except CustExcp: print("CustomException:Expected length at least 6!")
dea72182c40c93921cb7d3cb6def959ddda33825
Taomengyuan/Demo
/Pythonbasic/myproject1/day0402/m2.py
393
3.6875
4
class Calc(): def mul(self,x,y): z=x*y return z def div(self,x,y): if y!=0: z=x/y return z else: print("除数为零") return 0 print("我是模块:",__name__) if __name__ == "__main__": c=Calc() a=c.mul(10,20) print("两数相乘:",a) b=...
1d37231f95c6da0ffbe253876fc1c3edef06a99c
Taomengyuan/Demo
/Pythonbasic/myproject2/package1/calculator.py
2,734
3.890625
4
class calcu(): def add(self,x,y): self.x=x self.y=y self.res1=x+y return self.res1 def sub(self,x,y): self.x=x self.y=y self.res2=x-y return self.res2 def mul(self,x,y): self.x=x self.y=y self.res3=x*y return s...
9c4f029b0b34ddb132e143d7bbaa547d31e88677
Taomengyuan/Demo
/Pythonbasic/07-元组和字典练习/demo01.py
281
3.859375
4
#给定一个整数,编写程序生成一个字典,这个字典包括(i,i*i),其中i是一个1到n之间(包含1和n)的整数。这个程序会打印出整个字典 n=input("请输入一个整数:") n=int(n) d=dict() for i in range(1,n+1): d[i]=i*i print(d)
71fad52725d1b063f7f979fd81b9a7095c6e0cb5
Taomengyuan/Demo
/engineer_management/project77/engineer_management/version5/testengineer/testengineer.py
24,537
3.703125
4
#2、可以输入多个工程师的信息 import copy import csv class Testengineer(): def __init__(self): #存储输入的每个工程师信息 self.enginfor=dict() #暂存每个工程师信息准备插入到list1当中 #创建一个字典用于deepcopy()操作 self.dict1=dict() #存储所有工程师信息,每个元素为一个字典 self.list1=list() # 工程师信息初始化 self.init_data...
2a62f66e52c3f8378e83643f4a7def8c8ba637e0
Taomengyuan/Demo
/Pythonbasic/day1-5/demo15.py
320
3.859375
4
#continue与while循环 #输入三个数据,如果输入的是正数进行累加 #如果输入的是一个负数不进行相加 i=0 sum1=0 while i<3: i=i+1; print("第%d个数据:" %i) num=input() num=int(num) if num<0: continue sum1=sum1+num print("所有正整数之和为%d"%sum1)
e226260d69dc73a7e0536f07c41d076be1e87a1e
Taomengyuan/Demo
/engineer_management/engineer_management/engineer_management/version1/v1_2.py
782
3.65625
4
#v1_2:使用函数实现 def menu(): print("1.输入软件测试工程师资料") print("2.删除指定测试工程师资料") print("3.查询软件测试工程师资料") print("4.修改软件测试工程师资料") print("5.计算测试工程师的月薪水") print("6.保存新添加的工程师资料") print("7.对测试工程师信息排序(1 编号升序,2 姓名升序,3 工龄降序)") print("8.输出所有测试工程师信息") print("9.清空所有测试工程师数据") print("10.输出软件测试工程师数据表") ...
af11a55bbd03f24473b325f6611f8a8dc5a90487
Taomengyuan/Demo
/Pythonbasic/09-类和对象练习/demo00_2.py
493
4.125
4
#对象作为返回值 class Triangle(): def create_triangle(self,a,b,c): self.a=a self.b=b self.c=c print("The triangle is created!") def pri_sides(self): print("side a:",self.a) print("side b:",self.b) print("side c:",self.c) t1=Triangle() t1.create_triangle(10,20,2...
647af7d668bc3ae505b005bd7b214a2887846fb5
Taomengyuan/Demo
/Pythonbasic/06-字符串和列表练习/demo1.py
242
3.765625
4
#1、编写一个程序,找出所给字符串中重复的字符。 str="hello python!" first_time=[] duplicate=[] for i in str: if i not in first_time: first_time.append(i) else: duplicate.append(i) print(duplicate)
dee29de75c4dae739ae8cd943e91a7cf321e6533
Taomengyuan/Demo
/Pythonbasic/09-类和对象练习/demo00.py
489
3.890625
4
#定义类结构:定义一个student类 class Student(): def fill_details(self,name,branch,year): self.name=name self.branch=branch self.year=year def pri_detials(self): print(self.name) print(self.branch) print(self.year) #创建一个对象,并使用对象的方法 s1=Student() s1.fill_details('lily','engli...
6d10de73f338e9b3a70584bccee129f3cf975d57
Taomengyuan/Demo
/Pythonbasic/pythonProject/05-函数练习/demo04.py
738
4.0625
4
#默认值参数练习1 #函数定义,默认值参数name,默认值是python ''' def hellob(name="python"): print("你好,%s"%name) #调用函数,提供默认值参数 hellob("Java") #调用函数,不给出参数 hellob() ''' #默认值参数练习2 #声明带多个默认值参数的函数,默认值参数必须放在参数列表最后 #函数定义 def student(name,age,address="北京",nation="汉族"): print("姓名:%s,年龄:%d,住址:%s,民族:%s"%(name,age,address,nation)) #调用函数,给出全部参数 ...
4211786e68dbd71ff89ca2155f5a09f3d10a9d2c
Taomengyuan/Demo
/Pythonbasic/myproject2/package2/test_v1_1.py
3,209
3.578125
4
import unittest import package1.calculator class TestCalculator(unittest.TestCase): def setUp(self): print("==========================") print("对calculator类中函数功能测试开始:") self.c1 = package1.calculator.calcu() def test_add1(self): #print("==========================") #prin...
385e9c0b4ec76cb2a09525dfa2b8e15256670e8d
Taomengyuan/Demo
/csv/exportData/demo1.py
599
3.53125
4
import csv f1=open('E:/Python/demo/csv/importData/zhengshuData.csv','r') f2=open('E:/Python/demo/csv/importData/fudianshuData.csv','r') f3=open('E:/Python/demo/csv/importData/zifuchuanData.csv','r') data1=csv.reader(f1) #print(data1) zhengshu=[] for mydata in data1: print(mydata) zhengshu.append(mydata) print...
4d655512dd7bf81370e7445e5ba3f7422a0c8b12
Taomengyuan/Demo
/Pythonbasic/pythonProject/06-class类练习/demo12.py
878
3.78125
4
#定义一个父类AAA class AAA: #定义父类构造函数 def __init__(self,n): self.name=n def funa(self): print("类AAA中的函数") print("姓名:",self.name) #定义一个父类BBB class BBB: #定义父类构造函数 def __init__(self,a): self.age=a def funb(self): print("类BBB中的函数") print("年龄:",self.age) ...
ef28b7a4ca814bf5444a17da71073726d733a871
Taomengyuan/Demo
/engineer_management/engineer_management/engineer_management/version1/v1_3.py
904
3.75
4
#v1_3:加上基本判断功能(按照整数判断) def menu(): print("1.输入软件测试工程师资料") print("2.删除指定测试工程师资料") print("3.查询软件测试工程师资料") print("4.修改软件测试工程师资料") print("5.计算测试工程师的月薪水") print("6.保存新添加的工程师资料") print("7.对测试工程师信息排序(1 编号升序,2 姓名升序,3 工龄降序)") print("8.输出所有测试工程师信息") print("9.清空所有测试工程师数据") print("10.输出软件测试工...
ee6b1a1ae400db8097d1a1b456851aeb978f9a32
MushroomRL/mushroom-rl
/mushroom_rl/utils/callbacks/callback.py
783
3.8125
4
class Callback(object): """ Interface for all basic callbacks. Implements a list in which it is possible to store data and methods to query and clean the content stored by the callback. """ def __init__(self): """ Constructor. """ self._data_list = list() d...
0bb13baa19c27892e5f4d32621f60384ed6a0594
MushroomRL/mushroom-rl
/mushroom_rl/solvers/car_on_hill.py
2,127
3.671875
4
def step(mdp, state, action): """ Perform a step in the tree. Args: mdp (CarOnHill): the Car-On-Hill environment; state (np.array): the state; action (np.array): the action. Returns: The resulting transition executing ``action`` in ``state``. """ mdp.reset(stat...
d04e7643f547d0ece05d6a21875856ebec60445f
MushroomRL/mushroom-rl
/mushroom_rl/utils/folder.py
1,005
3.5
4
import errno import os from os.path import join as join_paths def mk_dir_recursive(dir_path): """ Create a directory and, if needed, all the directory tree. Differently from os.mkdir, this function does not raise exception when the directory already exists. Args: dir_path (str): the path ...
f7b5afd82383a2e5e49ee7831a1fc7ec74c96291
MushroomRL/mushroom-rl
/mushroom_rl/utils/value_functions.py
3,978
3.625
4
import numpy as np def compute_advantage_montecarlo(V, s, ss, r, absorbing, gamma): """ Function to estimate the advantage and new value function target over a dataset. The value function is estimated using rollouts (monte carlo estimation). Args: V (Regressor): the current value function...
e5e7e840cb49e4cc034f548fdb0a7ccf3ed58c9e
ngode1/Dice-Apply
/run.py
1,794
3.59375
4
from selenium import webdriver browser = webdriver.Firefox() # LOGGING IN browser.get('https://www.dice.com/dashboard/login') username = browser.find_element_by_id("email") password = browser.find_element_by_id("password") username.send_keys("email address") # enter email address here password.send_keys("password") ...
479c0d540e732dad84baa63b2b2b7a4f3607cc43
Storyyeller/vivint-solutions
/bookreturn/oldrun
332
3.625
4
#!/usr/bin/python # To solve this problem, make the './run' executable handle any # appropriate command line arguments and stdin and output the # solution to stdout. s = raw_input() floor = 0 for i, c in enumerate(s): if c == '+': floor += 1 else: if floor == 0: print i+1 f...
532fe4d217cd7aec0c1db6429b03738f839726ce
GauthamHari/Python
/Homework1/GuessNumber.py
1,167
4.125
4
__author__ = 'GAUTHAM HARI' name = input("Hi, What is your name? ") print("Hello " + name + "! Let's play a game!") print("Think of a random number from 1 to 100, and try to guess it!") count = 0 min = 0 max = 100 guess = 50 while(True): answer = input("Is it " + str(guess) + "? (yes/no) ") count += 1 if(an...
f91108becc3925f15a5e4e93c39a8899d8ba8ed7
viggoKloberg/Viggo_Kloberg_TE19C
/prog 1/if-satser/9.9 inlämning3.py
115
3.828125
4
celcius = float(input("ange temperatur i celcius:")) kelvin = celcius+273.15 print(f"{celcius}c° är {kelvin}k°")
85995ffd043334f224449e2d256b2b4ed0dcbbf9
KENTIVO/rest-multi-factor
/rest_multi_factor/encryption/abstract.py
1,038
4.125
4
"""Abstract Encryption class for general purposes.""" __all__ = ( "AbstractEncryption", ) from abc import ABCMeta, abstractmethod class AbstractEncryption(metaclass=ABCMeta): """ Abstract Encryption Handler. This class is used to ensure that regardless of what encryption method is applied. ...
a84f5d90106e5297346ae33b5f085c6acb55b3e8
mohith10/Python-Files
/Pig_Latin.py
248
3.78125
4
pyg = 'ay' original = raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): print original else: print 'empty' word=original.lower() first=word[0] new_word=word+first+pyg new_word=new_word[1:len(new_word)] print new_word