blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
7fb6abcc519fb24228df5b4f80fe24a8f7194451 | dacl010811/cursopython2021 | /Unidad6/tuplas.py | 2,048 | 4.0625 | 4 | #Tuplas son Inmutables : NO se pueden cambiar los datos que contiene dicha estructura
tupla_1 = (1,2,3,4,5,6,7,8,9,10) # tupla de enteros
tupla_2 = (True, False) # tupla de boolean
tupla_3 = (5.2, 7.4) # tupla de float
tupla_4 = ('True', "False") # tupla de String
tupla_5 = (1, 4.5, 'Hola', [1,2,3], (5,6,7) ) # ... |
f2f71d72629ccbcf59dd4a8cd4014aa7462488e1 | DavidDuncker/Federal-Election-Data-Collector-And-Analyzer | /data_crossmap.py | 6,867 | 3.765625 | 4 | def do_the_names_match(campaign, candidate):
name_from_campaign_data = campaign.name.replace(",", "").replace(".", "").split(" ")
name_from_candidate_data = candidate.name.replace(",", "").replace(".", "").split(" ")
if len(name_from_campaign_data) < 2 or len(name_from_candidate_data) < 2:
return False
if campaig... |
bccfb3e5dd2d857bb58f00a881e58cdc86bc81db | nimishbongale/leetcode-30days-solutions-scratchpad | /May/Week2/StringShifts.py | 307 | 3.546875 | 4 | class Solution:
def doshift(self,s,d,a):
if d==0:
return s[a:]+s[:a]
return s[len(s)-a:]+s[:len(s)-a]
def stringShift(self, s: str, shift: List[List[int]]) -> str:
for i in shift:
s=self.doshift(s,i[0],i[1])
print(s)
return s
|
97ca080a56126a0147129f4b8dd312c4b1448b19 | mervecnn/moduller | /ödev modül.py | 834 | 3.5 | 4 | #soru:1
def isletmeKari (x,y):
x=int(x)
y=int(y)
isletmeKari=x-y
print(isletmeKari)
def adambasiCiro (a,b):
a=int(a)
b=int(b)
adambasiCiro=a/b
print(adambasiCiro)
#soru:2
class aktif:
def hesapla(kasa,alınan,bankalar,alacak,ticari,binalar,tasitlar,demirB):
akt... |
0e5f3a76bdb945b5e693e27d7f846de43edf26d9 | raylu/advent_of_code | /2019/day1.py | 355 | 3.6875 | 4 | #!/usr/bin/env python3
import fileinput
import functools
def main():
total = 0
for line in fileinput.input():
weight = int(line.rstrip())
total += fuel_req(weight)
print(total)
@functools.lru_cache()
def fuel_req(weight):
fuel = weight // 3 - 2
if fuel <= 0:
return 0
fuel += fuel_req(fuel)
return fuel
... |
1b4aefa74716b2717aba75896b25b512c915e6d2 | Jiaruor/Web | /2018-3-28homework.py | 1,184 | 3.8125 | 4 | #!/usr/bin/env python
# _*_ coding: utf-8 _*_
#作业1.11.1.4
#求和运算
#用户输入
a = input('请输入一个数')
b = input('请输入第二个数')
a = int (a) #切换数据类型为整数
b = int (b)
print('a+b=',a+b)
#作业1.11.2.1
#编写1个python程序,完成以下要求: 从键盘获取⽤户的姓名、姓名、家庭地址 使⽤⼀个print进⾏输出
name = input('你叫什么名字')
age= input('几岁了')
id = input('你在哪里')
like = inp... |
5090dd42414149adba7328472f46d7c7a49e8d2e | lc2019/pycode-sixmonth | /day3/13.匿名函数.py | 549 | 3.984375 | 4 | def add(a, b):
return a + b
x = add(1, 3)
print(x)
fn = add # 类似别名的作用
print(id(fn), fn) # <function>
# 除了使用def还可以使用lambda
lambda a, b: a + b # 匿名函数,一次使用
# lambda当做参数传给另一个参数使用
def calc(a, b, fn):
c = fn(a, b) # fn类似别名
return c
def add(a, b):
return a + b
def sub(a, b):
return a - b
# ... |
88bfb26537cf05adabf1afb19b3ef177b50d6b12 | lc2019/pycode-sixmonth | /day2/5.冒泡.py | 700 | 3.59375 | 4 | num = [6, 5, 3, 1, 8, 7, 2, 4]
i = 0
while i < len(num) - 1:
n = 0
flag = True
# 比较过的不需要再次进行比较
while n < len(num) - 1 - i:
if num[n] > num[n + 1]:
flag = False
# 值交换
num[n], num[n + 1] = num[n + 1], num[n]
n += 1
if flag: # 如果顺序全是对的
break
... |
4e50eb079c94658e6dc59b260e19e6410e58d51b | lc2019/pycode-sixmonth | /day07/model_test.py | 322 | 3.859375 | 4 | a = 10
def test():
print('testting...')
class Person(object):
def eat(self):
print('eatting...')
p = Person()
eat = p.eat
def add(x, y):
return x + y
# 直接执行当前py文件 __name__的值是__main__
if __name__ == '__main__':
m = add(2, 3)
print('代码执行了')
print(m)
|
b1bb241d16bf14f515cea2b12dd5712829db6748 | lc2019/pycode-sixmonth | /day06/7.单例.py | 600 | 3.921875 | 4 | class Person(object):
__instance = None # 类属性
__is_first = True
# 单例模式 对象都是唯一
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
cls.__instance = object.__new__(cls)
# 如果创建不会在创建实例
return cls.__instance
def __init__(self, name, age):
if self.i... |
204fbd431f139fea9a6611268d66fef050e85a18 | lc2019/pycode-sixmonth | /day1/7.循环.py | 931 | 3.796875 | 4 | print('hello world' "\n" * 2)
# while for
# while 判断条件
# 条件成立执行代码
x = 0
while x < 2:
print('hello')
x = x + 1
sum = 0
i = 0
# while i <10:
# i +=1
# sum +=i
# print(sum)
while i < 10:
i += 1
# 加入判断条件
if i % 2 == 0:
sum += i
print(sum)
# for in 后面是可迭代对象(字符串 列表 元祖 range 集合)
for i i... |
15cb5fb6f54860902a021f6dbfda63ba8b74c11a | lc2019/pycode-sixmonth | /day1/3.输入.py | 630 | 4.15625 | 4 | # input接收用户输入 (输入提示信息)
# 默认回车结束
# res = input("请输入信息:")
# print(res)
# 数据类型转换,input接收的是str类型
# num1 = eval(input("enter a num:"))
# num2 = eval(input("enter a num:"))
# print(num1+num2)
# 内置类转换
a = '31'
b = int(a) # 将字符转为数字 '31'
print(a, b, type(a), type(b))
# x = 'hello'
# y = int(x)
# print(y)
c = '3.14'
d = '3... |
98d5f913ca78accd40c6a02cf70254e850cc8cde | lc2019/pycode-sixmonth | /day2/2.字符编码.py | 413 | 4.03125 | 4 | # chr ord
print(ord('a')) # 97
print(chr(65)) # A 数字对应的编码
# utf8 一个字符3个编码 gbk 1个字符2个编码
# in not in
word = 'hello'
x = input("enter a c:")
for c in word:
if x == c:
print("exist")
break
else:
print('not exist')
if x in word:
print("exist")
else:
print('not exist')
if word.find(x) ==... |
4b4d7c30468abdaffa46674dc39fdd3f4cdacecb | lc2019/pycode-sixmonth | /day3/7.函数调用函数.py | 1,138 | 3.875 | 4 | def test1():
print("test begin")
def test2():
print("test2 begin")
test1()
print("test2 over")
test2() # 函数调用
def add(n, m):
x = 0
for i in range(n, m):
x += i
return x
rest = add(0, 101)
print(rest)
# 阶乘
def fac(n):
x = 1
for i in range(1, n + 1):
x *= i
... |
e4c0935304986aa41023eceec875e9473dff89e2 | lc2019/pycode-sixmonth | /day9/1.thread.py | 389 | 3.640625 | 4 | # 线程
import threading
import time
def task1():
for i in range(5):
print('task1----', i + 1)
time.sleep(1)
def task2():
for i in range(5):
print('task2----', i + 1)
time.sleep(1)
if __name__ == '__main__':
t1 = threading.Thread(target=task1)
t2 = threading.Thread(tar... |
c79a80ae3193605b5155a7c4941a0a18da018e0e | medit74/MyAI | /PyDataAnalysis/Matplotlib/Exec.py | 356 | 3.578125 | 4 | '''
Created on 2018. 7. 19.
@author: Byoungho Kang
'''
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(x):
return 1/(1+np.exp(-x))
X = np.arange(-10, 10, 0.1)
Y = sigmoid(X)
plt.plot(X, Y, label="sigmoid", c="blue", ls="dotted")
plt.xlabel("x")
plt.ylabel("y")
plt.title("Activa... |
65414d4b2abcfc45fa30b4a99424f7b8d6b3fadd | medit74/MyAI | /PyDeepBasic/Backward/Exec.py | 1,099 | 3.53125 | 4 | '''
Created on 2018. 7. 30.
@author: Byoungho Kang
'''
class AddLayer:
def __init__(self):
pass # 아무것도 하지말 것.
def forward(self, x, y):
return x+y
def backward(self, dout):
dx = dout * 1
dy = dout * 1
return dx, dy
class ... |
247c9043a8d13e27a8c115206244c40442d7e41d | haiyuancheng/Python_practise_Hard_Way | /python_07/exercise_18 | 1,141 | 3.921875 | 4 | #!/usr/bin/python
#-*- coding: UTF-8 -*-
#Functions and Variables
def cheese_and_crackers(cheese_count, boxes_of_crackers): #定义函数(method)
print "You have %d cheese!" % cheese_count #打印字符串,格式化字符串
print "You have %d boxes or of crackers!" % boxes_of_crackers #打印字符串,格式化字符串
print "Man that's enough for a party... |
28f370fde0e4c2f6a74ae10a07c0cf8978aeabd4 | haiyuancheng/Python_practise_Hard_Way | /python_01/7.py | 1,384 | 3.625 | 4 | # -*- coding: UTF-8 -*-
'''
发送txt文本邮件
小五义:http://www.cnblogs.com/xiaowuyi
'''
import smtplib #import smtplib module
from email.mime.text import MIMEText #import MIMEText class
mailto_list = ['1007701905@qq.com','869596773@qq.com']
mail_host = "smtp.sina.com" # set up sever
mail_user = "haiyuancheng" # user
mail_pass... |
13f9f76bb3f686e3e6ee5ea6c97c5b0f770f1df3 | haiyuancheng/Python_practise_Hard_Way | /python_03/exercise_9 | 997 | 3.5625 | 4 | #!/usr/bin/python
#-*- coding: utf-8 -*-
#what's was that
#http://www.runoob.com/python/python-strings.html
"I am 6'2\" tall." #escape double-quote inside string
'I am 6\'2" tall.' #escape single-quote inside string
tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ ca... |
89755ff56c045d07507eb22a6c3f5e5ae64d71c8 | haiyuancheng/Python_practise_Hard_Way | /python_06/fun_01 | 934 | 4.125 | 4 | #!/usr/bin/python
#-*- coding: UTF-8 -*-
# def fnc1(x, y):
# print x + y
#
# result = fnc1(2, 3)
a = 1
def change_integer(a):
a = a + 1
return a
print change_integer(a)
print a
b = [1,2,3]
def change_list(b):
b[0] = b[0] + 1
return b
print change_list(b)
print b
"""
第一个例子,我们将一个整数变量传递给函数,函数... |
adca45349ac830362396a2350f213c3918c60b77 | Sohail795/Python_Project1 | /Project_01(Age Ask).py | 2,043 | 4.15625 | 4 | def UserInput():
User=int(input("Please Enter Your Age/Year of Birth: "))
if (User>1000 and User<1901) or (User>150 and User <1000):
print("\nYou Seems to be the Oldest ")
print("Limits for\n1. Age = 150 Max, 5 Min\n2. Year of Birth = 2020 Max, 1901 Min\n")
UserInput()
elif (... |
9b2d0d5de13f2b70ed347a7480916cb124823646 | Akilan99/numbers | /alphabet.py | 132 | 4.25 | 4 | s=input("enter the word")
if (s >= 'a' and s <= 'z') or (s >='A' and s <='Z'):
print("alphabet")
else:
print("not an alphabet")
|
163db8d96cc4ae3eee8fd7a69423ba6196a1d03b | JuanGarciaReyes/CS2302 | /lab3.py | 10,522 | 3.78125 | 4 | import os
black = 'BLACK'
red = 'RED'
class Node:
def __init__(self, item=None, left=None, right=None, parent=None, color=red):
self.item = item
self.left = left
self.right = right
self.parent = parent
self.height = 1
self.color = color
class RBTree:
... |
5b10a69a55937ef84d0c0d60c163c3c8df805de8 | xiantang/grokking_algorithms | /code/3-1.py | 206 | 3.796875 | 4 | def countdown1(i):
print(i)
countdown1(i-1)
# countdown(1)
def countdown2(i):
print(i)
if i<=1:#基线条件
return
else: #递归条件
countdown2(i-1)
a=countdown2(3)
|
7c266da32d158c8b5b82cff2debf071da3188e17 | xiantang/grokking_algorithms | /code/4-7.py | 348 | 3.84375 | 4 | array = [5,7,2,4,3,1,8,6]
from random import randint
def qsort(array):
if len(array)<=1:
return array
ran=randint(0,len(array)-1)
mid = array[ran]
array.pop(ran)
smaller = [ i for i in array if i<=mid]
bigger = [i for i in array if i>mid ]
return qsort(smaller) + [mid] +qsort(b... |
7ecb1b5464027351f51c5a0139a8a59b86521beb | Jiho1996/python_book | /HongGongPython/lambda,map,filter.py | 230 | 3.765625 | 4 | def power(item):
return item*item
def under_3(item):
return item<3
list_input_a = [1,2,3,4,5]
output = map(lambda x : x*x,list_input_a)
print(list(output))
output2 = filter(lambda x:x<3,list_input_a)
print(list(output2)) |
9759e46568e5c0e8fda7395e918a4494332ffa76 | Jiho1996/python_book | /simsim/simsim2.py | 316 | 3.546875 | 4 | import sys
str_sentence=[]
str_sentence = list(map(str,sys.stdin.readline().rstrip().split(" ")))
finding_word = sys.stdin.readline().rstrip()
print(str_sentence)
for i in range(len(str_sentence)):
if finding_word == str_sentence[i]:
print("찾고싶은 단어위치 : " , i+1)
else : continue
|
3edf267a6eb13ed6d7eea70ad9f4b87472007f80 | ActaeaPachypoda/csc496MainProject | /GUI.py | 2,247 | 3.65625 | 4 | from tkinter import *
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
dream = open('/Users/Owner/Desktop/Wordcloud/DreamSpeech.txt').read()
lear = open('/Users/Owner/Desktop/Wordcloud/KingLear.txt').read()
gettysburg = open('/Users/Owner/Desktop/Wordc... |
33ef67658f72a938a7d3e70f580edf6c61ee7e55 | nzbaen/public | /python/stack_with_max.py | 1,655 | 4.09375 | 4 | # Stack with max
# This test creates a stack and populates it with integers, issuing first
# a push (to populate the stack), then gets the max value of the stack,
# then a pop (to remove the highest value), and again gets the max value of the stack
# It works with the given numbers, and with a while loop
class StackW... |
b4299ae82535ba216726a1fd2e750530d800ee78 | DomPedrotti/python-exercises | /4.8_pandas_exercises.py | 4,996 | 3.96875 | 4 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Use pandas to create a Series from the following data:
["kiwi", "mango", "strawberry", "pineapple", "gala apple", "honeycrisp apple", "tomato", "watermelon", "honeydew", "kiwi", "kiwi", "kiwi", "mango", "blueberry", "blackberry", "gooseberry", "pa... |
1a822e355862ec519efd1b8764010350f860f803 | IrynaLy/function | /fun1.py | 332 | 3.734375 | 4 | from random import randint as rnd
a = (int(input("Бажана довжина списку")))
b = (int(input("Максимальне значення елеметів списку")))
def Єнотік (a, b):
list = []
for i in range(a):
list.append(rnd(0,b+1))
return list
print(Єнотік(a, b))
|
35d31ea4f72e6630e648333abdc53651a4710832 | xshen1122/Scripts | /pytest_new/test_chart7.py | 2,626 | 3.59375 | 4 | # coding: utf-8
from math import pi
from functools import total_ordering
from abc import ABCMeta, abstractmethod
import weakref
@total_ordering
class Shape(object):
@abstractmethod
def area(self):
pass
def __lt__(self,obj):
print ' in __lt__'
if not isinstance(obj,Shape):
... |
6f83d7dcc1a4367452b0e129427a9b38bdcd4698 | xshen1122/Scripts | /suanfa/test_bole_stack_2.py | 968 | 3.65625 | 4 | # test_bole_stack_2.py
# coding: utf-8
'''
maze = [[0]*7 for _ in range(5+2)]
产生一个7×7的二维数组,且每个元素均为0
每一个为1的点的坐标存在walls内。
di,dj是方向,分别有4个方向,[(0,-1),(0,1),(-1,0),(1,0)]
这种枚举法只适用于迷宫格子较少的情况。
'''
def init_Maze():
maze = [[0]*7 for _ in range(5+2)]
walls = [(1,3),(2,1),(2,5),(3,3),(3,4),(4,2),(5,4)]
for i in range(7):
maz... |
dad198463245693371e43f79dd395c1ad7c558fb | xshen1122/Scripts | /suanfa/test_lock.py | 1,757 | 3.921875 | 4 | # coding:utf-8
'''
Test Lock
3 threads will chang global count
'''
import threading
# create a Lock
# lock = threading.Lock()
# print lock
# print type(lock)
# print lock.locked()
# print lock.acquire()
# rlock = threading.RLock()
# print type(rlock)
# print rlock
'''
由于多线程共享进程的资源和地址空间,
因此,在对这些公共资源进行操作时,
为了防止这些公共资源出... |
c68ead0b1f7cc475996e3afb539219921181597a | xshen1122/Scripts | /suanfa/test_combine_sort.py | 914 | 4.3125 | 4 | # test_combine_sort.py
# coding:utf-8
'''
思路
注意:A列表和B列表都是已经排序完成的。
有两个list A,B,内含a1,a2,a3,a4,b1,b2,b3,b4
先取a1和b1对比,小的拿出来(比如是a1),在比较b1和a2
直到最后从小到大排列出来
需要考虑每个list的最后一个元素的处理。(没办法pop了)
'''
def combine_sort(l1,l2):
total_list=[]
tmp1 = l1.pop()
tmp2 = l2.pop()
while len(l1)!=0 or len(l2)!=0:
if tmp1 < tmp2:
... |
7da3928e833bdb1f250f64363ec0c2d44d65b931 | xshen1122/Scripts | /suanfa/test_strip.py | 604 | 3.765625 | 4 | # test_strip.py
# coding: utf-8
'''
1. strip()
2. replace()
3. isspace()
4. isdigit()
5. count()
6. unpack()
'''
str1 = "0000000 jb51.net 0000000"
print(str1.strip( '0' ).strip()) # 去除首尾字符 0
str2 = " jb51.net " # 去除首尾空格
print(str2.strip())
str1 = "欢迎访问脚本之家www.jb51.net"
print ("脚本之家旧地址:", str1)
print ("脚本之家新地址... |
65e4d222710162dc01dc5cefb0afb4e67732b7e9 | xshen1122/Scripts | /suanfa/test_suanfa_2.py | 411 | 3.65625 | 4 | # test_suanfa_2.py
# coding: utf-8
'''
need to add 0 in the beginning
'''
def find_smallest(list1):
small = list1[0]
small_index=0
for i in range(1,len(list1)-1):
if list1[i] < small:
small = list1[i]
small_index=i
return small_index
if __name__ == '__main__':
l1 = [3,5,1,0,10,9]
new = []
for i in ra... |
aff52feef6e7ab8b6d3aa2addeb92a4fa68c0f6a | arunvis2001/basics_of_python | /if_cond_1.py | 232 | 4 | 4 | is_hot = 0
is_cold = 0
if is_hot:
print('The day is hot')
print('Drink plenty of water')
elif is_cold:
print('Wear warm clothes')
print("It's a cold day")
else:
print("It's a lovely day")
print('Enjoy the day')
|
4b78aa113e05adb458ce5acb84b46a83fbb7b8d2 | arunvis2001/basics_of_python | /if_cond_3.py | 270 | 4.09375 | 4 | weight = int(input('Enter your Weight : '))
unit = input('(L)bs or (K)g : ').upper()
if unit == "L":
weight *= 0.45
print(f"Weight in Kg : {weight}")
elif unit == 'K':
weight /= 0.45
print(f"Weight in Lbs : {weight}")
else:
print('Its not right key') |
083eb14aedacf2139d196d273d5c7673d2ec305c | WolfCrazy/lesson1 | /price.py | 589 | 3.78125 | 4 | price = 100
discount = 5
def disc(price, discount, max_discount=50):
price = abs(float(price))
discount = abs(float(discount))
max_discount=abs(float(max_discount))
if max_discount>99:
raise ValueError('Максимальная скидка не может быть больше 99%')
if discount > max_discount:
dis... |
4f3016827e60a5ae86d0c5abdf61b71d89b5c4e5 | zhvnibek/leetcode_ | /problems/949_largest_time_for_given_digits.py | 725 | 3.515625 | 4 | from typing import List
from itertools import permutations
class Solution:
def largestTimeFromDigits(self, A: List[int]):
out = ""
for P in permutations(A):
if P[0] * 10 + P[1] <= 23 and P[2] <= 5:
out = max(out, f'{P[0]}{P[1]}:{P[2]}{P[3]}')
return out
class ... |
8261d6df4d0d117520075bb5a9ecc2c1bd0cc81e | zhvnibek/leetcode_ | /problems/665_non-decreasing_array.py | 623 | 3.796875 | 4 | """
https://leetcode.com/problems/non-decreasing-array/discuss/1190763/JS-Python-Java-C%2B%2B-or-Simple-Solution-w-Visual-Explanation
"""
from typing import List
class Solution:
def checkPossibility(self, nums: List[int]) -> bool:
drop = False
n = len(nums)
for i in range(1, n):
... |
66c2847dd49ad284f3af79ebced169f0fa653ad5 | zhvnibek/leetcode_ | /problems/1305_all_elems_in_2_bt.py | 1,789 | 3.5625 | 4 | from typing import List
from itertools import chain
from collections import deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
# class Solution:
# def getAllElements(self, root1: TreeNode, root2: TreeNode) -> Lis... |
662efd6f46a513957c1dbe095d3f57fba7f805ce | zhvnibek/leetcode_ | /problems/1283_smallest_divisor_thr.py | 655 | 3.65625 | 4 | import math
from typing import List
class Solution:
def sum_quotients(self, nums: List[int], divisor: int) -> int:
return sum([math.ceil(num/divisor) for num in nums])
def smallestDivisor(self, nums: List[int], threshold: int) -> int:
sq = threshold + 1
d_min = 100
d = 0
... |
e43bdd7e9f05889aa0085336551835c32dc3bffe | zhvnibek/leetcode_ | /problems/290_word_pattern.py | 674 | 3.8125 | 4 |
class Solution:
def wordPattern(self, pattern: str, str: str) -> bool:
words = str.split()
if len(words) != len(pattern):
return False
word2pat = {}
pat2word = {}
for word, pat in zip(words, pattern):
if word not in word2pat:
if pat ... |
48a70e3ad55811a7fff0e255cd60d8970563646c | zhvnibek/leetcode_ | /problems/1260_shift_2d_grid.py | 1,026 | 3.5625 | 4 | from typing import List
class Solution:
def _shift_row(self, row: List[int], k: int = 1) -> List[int]:
return [row[-1]] + row[:len(row)-1]
# def shiftGrid(self, grid: List[List[int]], k: int) -> List[List[int]]:
# for i in range(k):
# grid = [self._shift_row(row) for row in grid]
... |
f31bda50626c0cf336d5095293d34074c5bb76cb | devangsharmadj/cs50 | /tictactoe.py | 5,485 | 4.0625 | 4 | """
Tic Tac Toe Player
"""
import copy
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
def player(board):
"""
Returns player who has the next ... |
f098d5c1e51f29fd3cdc264118529be26d2d97cf | techdragon/historia | /historia/pops/logic/logic_base.py | 1,521 | 3.59375 | 4 | from random import random
class LogicBase:
def __init__(self, pop):
self.pop = pop
@property
def can_work(self):
return True
def has_good(self, good, amount):
"Returns True if the Pop has a particular Good in their inventory"
inv = self.pop.inventory.get(good)
... |
072baa354b8bcfd844d7f0cac6dc5fcadf327d8f | techdragon/historia | /historia/culture/culture.py | 1,681 | 3.84375 | 4 | from uuid import uuid4
class Culture(object):
"""
Culture.
Considerations that go into making up a Culture:
- language
- history
- food
- shelter
- education
- security
- relationships
- political and social organizations
- religions
- art
e.g. Chinese
"""
... |
4585ff1d365d3016875cc0234c6ebb18171387dc | yeniturkalp/python | /indexingAndSlicing.py | 337 | 3.796875 | 4 | # -*- coding: utf-8 -*-
import pandas as pd
notlar = pd.read_csv("grades.csv")
notlar.columns = ["isim","soyisim","SSN","test1","test2","test3",
"test4","final","sonuç"]
print(notlar)
print(notlar.loc[:5,"isim":"final"])
print(notlar.loc[::-1,"isim"])
print(notlar.loc[:5,["isim","soy... |
b52542b5f00d3bd324b05bf4afac0595b34dd9b8 | Microshak/MicroNotes | /Language/Python/Code/Count Capital Letters.py | 415 | 3.984375 | 4 | '''Write a one-liner that will count the number of capital letters in a file.
Your code should work even if the file is too big to fit in memory.
with open(SOME_LARGE_FILE) as fh:
count = # your code here
'''
import os
path = os.path.dirname(os.path.abspath(__file__))
with open(path + "/sample.txt") as fh:
... |
d0d4f79e7ceb356a94e51af7e8397c7f731e7b1a | bruno153/spex_gui | /Hardware/StepMotorControlTESTER.py | 1,005 | 3.625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 30 09:24:28 2020
Controlador dos motores de passo, versão python
para raspy
@author: rafael
"""
import gpiozero as io
from time import sleep
stepPin = io.DigitalOutputDevice(19)
dirPin = io.DigitalOutputDevice(26)
stepInterval = .005 # milliseconds
stopPin1 = io.Digit... |
9d4d2a2abdf72aac25bb784ba559574fb012cc8a | dasbairagya/Python-Basics | /basics/math_module.py | 288 | 4 | 4 | import math
x = math.sqrt(25) #calculate the square root of 25
print(x)
print(math.floor(2.5)) # floor of the room i.e lower the value # print 2
print(math.ceil(2.5)) # ceiling of the room i.e heigher the value # print 3
print(math.pow(3,2)) # calculate the the power of the 3 of 2 i.e 9
|
727524765b668aa284dbf7eac6b4aca9f0905b07 | dasbairagya/Python-Basics | /array/array_search.py | 359 | 3.765625 | 4 | from array import *
arr = array('i',[])
len = int(input("Please enter the quantity: "))
for i in range(len):
n = int(input("Enter a no. :"))
arr.append(n)
print(arr)
src = int(input("Enter the value for search: "))
k = 0
for e in arr:
if src==e:
print("Index->",k)
break
k+= 1
else:
... |
55f1223257d3b8141c2fcd9b8691be058975f441 | JK117/PythonTuition | /Python_Note_1.py | 868 | 3.96875 | 4 | # Python Note 1: Basic
# 语言简介
# 动态解释型语言(字节码编译)
# 变量、参数、函数在声明时无需说明类型
# 赋值 & 输入 & 输出
name = input('Please input your name:')
print('Your name is ' + name)
a, b, c = (int(x) for x in input().split(' '))
print(a + b + c)
# 数学运算
# Python3 中除法运算(/)默认执行精确出除(exact division)
# 取整除使用 // 作为运算符
print(3/2)
# -> 1.5
print(3//2)
#... |
8e8286c89986b6f77ada4f7d11d759ca789b39a5 | shitterlmj2016/95888_Data_Focused_Python | /W2/quiz02.py | 4,262 | 4.21875 | 4 | """
For all questions replace pass with the appropriate code to satisfy the
requirements specified in the docstring.
Topics:
- Importing packages
- List indexing
- Reading and writing files
-- Modes read, write, append, text, binary
-- File encodings
-- String vs binary reads
-- Reading by file, by line, by character... |
d33fa3e69b16a247336dfcae11ae147f68d279b2 | shitterlmj2016/95888_Data_Focused_Python | /quiz04b.py | 9,367 | 3.578125 | 4 | import numpy as np
import pandas as pd
def quiz4_q1():
"""15 Points
Create a 2-dimensional 6x4 Numpy array using arange that contains
values between 0 and 23 (inclusive). Slice out the values in
the 3rd and 4th rows and the 3rd column.
ex:
1st 2nd 3rd 4th
[[0 1 2 3] # 1st row
... |
d97d8d00225f5a6f3a692100acb66ae5f60c93fd | Lordhacker756/PyDroid | /Contacts.py | 1,082 | 3.921875 | 4 | import time
with open("Contact.txt","a") as f:
def AddCont():
print("Enter Contact Name")
name=input()
print("Enter Contact No.")
num=input()
if Check(name,num) != "0"
f.write(name,"/n")
f.write(num,"/n")
def Check(a,b):
while f.readline()!="":
if f.readline()==a:
if f.readline()==b:
... |
5019b7fd2b8df714f77719b87db2e3e38013d09f | shrouti/Projects-Portfolio | /04. Social Media/NLP - Text Mining - Sentiment Analysis/sentiment_causal_model_interpretation.py | 3,911 | 3.515625 | 4 |
# coding: utf-8
# # Import necessary dependencies
# In[1]:
import pandas as pd
import numpy as np
import text_normalizer as tn
# # Load and normalize data
# In[2]:
dataset = pd.read_csv(r'movie_reviews.csv')
# take a peek at the data
print(dataset.head())
reviews = np.array(dataset['review'... |
cb0fabaf7af7efa17d31714bfe8f1ada47f0eea1 | Suriya-Krishna/Mynewprojects | /Teams_db.py | 3,970 | 3.71875 | 4 | import sqlite3
def db_connect():
conn = sqlite3.connect('database.sqlite')
return conn
def res_print(count):
for row in count:
print(row)
conn = db_connect()
cur = conn.cursor()
#cur.execute("SELECT * from Unique_Teams")
#print(cur.fetchall())
#cur.execute("SELECT * from Matches")
#print(cur.fetcha... |
2333185c2a26ef82cbb419be35b75825a7b2ba57 | HieuPham2000/HeadFirstPython | /chapter12/generator.py | 289 | 3.796875 | 4 | # list comprehension
for i in [x*3 for x in [1, 2, 3, 4, 5]]:
print(i)
print()
# this isn't a "tuple comprehension"
# a generator
# the generator and the listcomp produce the same data
# BUT they do not execute in the same way!!!
for i in (x*3 for x in [1, 2, 3, 4, 5]):
print(i) |
bcdce8653a2c711778e6eb8b095352512c0c2b8f | iCarlosCode/cvfp | /main.py | 10,269 | 3.5 | 4 | import tkinter as tk
from tkinter import ttk
window = tk.Tk()
window.title("Calculadora Vetorial Feita às Pressas")
window.maxsize(600,1000)
window.resizable(0,0)
def obterVetorDePontos(dotA = (0, 0, 0), dotB = (0, 0, 0)):
return (dotB[0] - dotA[0], dotB[1] - dotA[1], dotB[2] - dotA[2])
def cal... |
f59e5a4f6004f78655b806acb635aff4d116966d | andrewhalle/sudoku_solver | /sudoku_solver/sudoku.py | 2,447 | 3.703125 | 4 | from sudoku_solver.csp import Problem, Variable, Constraint
class Sudoku:
def __init__(self, data=None):
if not data:
data = []
for i in range(9):
data.append([])
for j in range(9):
data[i].append(0)
if not isinstance(data,... |
799a61d40ce241fd4fb8c2e8f22020bc67ada722 | mikegoolsby/mtge_calcs | /calculateCreditSupport.py | 677 | 3.734375 | 4 | def calculateCreditSupport():
raw_input = (input("enter suboordinate tranche balances separated by a space: "))
reserve_bal = int(input("enter reserve balance: "))
tranche_bal = raw_input.split()
for i in range(len(tranche_bal)):
tranche_bal[i] = int(tranche_bal[i])
tranc... |
a3d65bfe062f6dab9de75b8f16181cea986e5a35 | aidanjgriffiths/GameOfNim-Jupyter | /Nim.py | 13,290 | 3.515625 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import random
import time
class NimGame:
def __init__(self):
self.game_mode = "Misere"
self.number_pile = random.randint(2,5)
self.computer = (0,0) # Computer's move
self.pile_comp = 0 # pile number
self.sticks_comp ... |
59dcea94dc511219c7cb647ba500d745355cd62a | pritesh1/Python-basic-OOP-templates | /Objects.py | 352 | 3.609375 | 4 | class chutya:
eyes= 'blue'
def logo(self):
print 'olo'
lund=chutya()
print lund.eyes
lund.logo()
class badachutya:
def name(self,name):
self.name=name
return self.name
def display(self):
print self.name
badalund=badachutya()
badalund.na... |
85187c282e310b4eab00a9346a14c53d9478fb33 | C3RV1/Pynity | /Core/math/math2d.py | 1,983 | 3.671875 | 4 | import math
import pygame
#import numpy
# Make an position relative to another
def relative_to(global_position, relative_origin):
return [global_position[0] - relative_origin[0], global_position[1] - relative_origin[1]]
# Make a position global knowing that is relative to relative_origin
def make_global(relativ... |
7a7bb4bf46774d9360cf1a169ea7c31b2643124e | marilynmamani/marilyn-M.Q | /distns-lengues/struture-condicional/EstCondicional.py | 1,508 | 3.890625 | 4 | def estCondicional01():
#Definir variables
print("Ejemplo estructura Condicional en Python")
montoP=0
#Datos de entrada
cantidadX=int(input("Ingrese la cantidad de lapices:"))
#Proceso
if cantidadX>=1000:
montoP=cantidadX*0.80
else:
montoP=cantidadX*0.90
#Datos de salida
print("El monto a pagar es:", montoP... |
0e9c563419eb5075506027a93598ee6053fb7932 | marilynmamani/marilyn-M.Q | /examen/Examen01/Examen01.py | 2,040 | 3.671875 | 4 | opcion=0
def Ejercicio5MMQ():
opc=int(input("Menu principal \n"
"1.promedio de notas \n"
"2.bono \n"
"3.tipos de vacunas \n"
"4.operaciones de aritmeticas \n"
"5.finish \n"
"escoja una opcion: \n"))
return opc
def Ejercicio1MMQ():
# datos de entrada
Nfinal=0.0
punidad=float(input("Ingrese nota de pr... |
44a780574fdc344519bfd955db714b47d5fb5713 | jagadeesh545/knapsack | /src/knapsack.py | 12,914 | 3.515625 | 4 | '''
This file contains support code for B551 Hw6
# File version: November 19, 2015 #
For questions related to genetic algorithms or the knapsack problem, any AI can be of help. For questions related to the support code itself,
contact Alex at aseewald@indiana.edu.
'''
import math
import copy
import random
import pic... |
46e44f1ea3c9577f4868268e20575de4943ac16c | sP4h-hash/SQL | /SCANsql.py | 10,002 | 3.546875 | 4 | #!/usr/bin/python
import sys, re, urllib, urllib2, string
from urllib2 import Request, urlopen, URLError, HTTPError
from urlparse import urlparse
# We test if the url is reachable
def URL_TESTING(Site_URL):
# Define User-Agent variable
user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.... |
4c708ae85f306721af17151d34ae567e9c1c67f2 | ScottyHall/python-practice | /functionPractice.py | 1,064 | 4.28125 | 4 | # function writing practice to illustrate reusing logic
import math
def ping():
return "Ping!"
x = ping()
print(x)
def sphere_volume(r):
"""Returns the volume of a sphere with radius r."""
v = (4.0/3.0) * math.pi * r**3
return v
print("The volume of a sphere with a radius of '2' = {0}".format(sphere_volume(2)))... |
49d67a8874ae14b9e66d5229e21bbfc04e6ee753 | vincent51689453/EIE557_Assignment | /assignment1_question3.py | 2,259 | 3.734375 | 4 | # Perceptron
# Given samples
class1 = [(-1,0,1),(0,-1,1),(1,0,1),(0,1,1,)]
print("Class1 vector{}".format(class1))
class2 = [(-2,0,1),(0,-2,1),(2,0,1),(-2,2,1,)]
print("Class2 vector{}".format(class2))
# Initial weight
#w = [1,1,1]
w = [1,-1,0]
dot_output = 0
print("Initial weight vector{}\r\n".format(w))
# Training ... |
9d4da1c68303d3256c65e535e821f2fde8f4402c | chanchanmano/QR-Healthcare-Software | /xyz.py | 1,526 | 3.625 | 4 | import tkinter as tk
from tkinter import ttk
from tkinter import *
from sqlpack import sql
import guifunc
from tkinter import messagebox
def info():
messagebox.showinfo("Information","This window requires you to enter \n the access code of your Organisation\n to access the database")
# this is a function to get the... |
7da4bc9b15acc5f12698bfcb949204de7328be31 | bishnusilwal/python-files | /6.print_last_digit_of_integer.py | 167 | 4.09375 | 4 | #Lab_Excersie_2
#Q.6 Given an integer number, print its last digit.
userInput = int(input("Enter a number"))
strNum = str(userInput)
print(int(strNum[-1]))
|
5e75411d71b8973e0a106462840c3440dae2ee50 | bishnusilwal/python-files | /12.value_of_x+=3.py | 404 | 4.40625 | 4 | #Lab_Excersie_2
#Q.12 Given x = 5, what will be the value of x after we run x+=3?
#ANS: The value of x after we run x+=3 is 8.
#Procedure: The initial value of x is 5.If you run operation x+=3 then 3 will be added to the value of x and it becomes 8.
#Now x has its value 8.And if we again run the samee operation than 3 ... |
6d1b3a2dce33d9042d62adcfe8add626bcf62084 | bishnusilwal/python-files | /10.print_even_index_number.py | 262 | 4.09375 | 4 | #Lab_Excersie_3
#Q.10 Accept string from the user and display only those characters which are present at an even index?
def evenString(wordS):
for i in range(0,len(wordS),2):
print(wordS[i])
userInput = input('Enter a word :')
evenString(userInput) |
0c9ec219f3786dadf6c8e551d32dbce7bd243367 | bishnusilwal/python-files | /6.reverse_a_string.py | 180 | 4.4375 | 4 | #Lab_Excersie_3
#Q.6 Write a Python program to reverse a string.
def reverseString(word):
return word[::-1]
userInput = input("Write a word")
print(reverseString(userInput)) |
c073fedfac4a77d468301951efc88cbf579fbb80 | rashaad18/python-challenge | /PyBank/main.py | 2,443 | 3.796875 | 4 | # PyBank main file
#imports
import os
import csv
rowCount = 0
totalProfitLoss = 0
average = 0
greatest_temp = {
"month" : "",
"money" : 0
}
decreased_temp = {
"month" : "",
"money" : 0
}
# Set the path for csv file
csv_path = os.path.join("..", "Resources","budget_data.csv")
#open csv file
w... |
d15ec7afcf9379c881a4a4b13dad3335cf1c2ad2 | Wangman1/Machine-Learning-in-Action | /My Code/chap 05/training data.py | 1,504 | 3.5 | 4 | import matplotlib.pylab as plt
import numpy as np
"""
函数说明:加载数据
"""
def loadDataSet():
# 创建数据列表
dataMat=[]
# 创建标签列表
labelMat=[]
# 打开文件
fr=open('testSet.txt')
# 逐行读取
for line in fr.readlines():
# 去回车,放入列表
lineArr=line.strip().split()
# 添加数据
dataMat.append... |
9a6a7a3f2af8d9f29d906832a8c4da2ef4d2a7fe | jfinlay24/Small-Python-Projects | /Guess-Number/guess-number.py | 1,295 | 4.15625 | 4 | import random
def guess(x):
random_number = random.randint(1, x)
guess = 0
guess_list = []
while guess != random_number:
guess = int(input(f"Guess a number between 1 and {x}: "))
if guess not in guess_list:
guess_list.append(guess)
if guess > random_number:
... |
88f2eaefd0d540fb30d68053c4d2010cfb05b4ba | Rampagy/InvertedPendulum | /MachineLearningAlgo/damppend_reward_plot.py | 1,297 | 3.640625 | 4 | '''
======================
3D surface (color map)
======================
Demonstrates plotting a 3D surface colored with the coolwarm color map.
The surface is made opaque by using antialiased=False.
Also demonstrates using the LinearLocator and custom formatting for the
z axis tick labels.
'''
from mpl_toolkits.mpl... |
fe2581ab8a0f933cf3bb76173065b4e3f8659812 | ludmila-chagas/Athena | /sprint3/grafico3.py | 448 | 3.578125 | 4 | horas_pretendidas = int(input('Quantas horas você pretende estudar? '))
horas_cumpridas = int(input('Quantas horas você estudou? '))
import numpy as np
import matplotlib.pyplot as plt
horas = ['Horas Pretendidas', 'Horas Cumpridas']
horas2 = [horas_pretendidas, horas_cumpridas]
plt.bar(horas, horas2, color=... |
f9880449b76da56391cbcec29fe4646f9bcdae8c | Ispirett/myportfolio | /word_manipulator/word_replace.py | 1,618 | 3.703125 | 4 | import os
import re
class ReplaceWord:
def __init__(self, list_dir, open_file , full_path):
self.list_dir = list_dir
self.open_file = open_file
self.full_path = full_path
def print_dir(self):
print(os.listdir(self.list_dir))
def open_doc(self):
print(open(self.... |
f87b9a96233bfaac30942fc39c97536d2de057f9 | AmeenDarwish/PythonGame-connect-4 | /4-connect-py/ex12/ai.py | 1,169 | 4.03125 | 4 | import numpy as np
import random
EMPTY_CELL = '_'
NUM_OF_COLUMNS = 7
class AI:
"""
This class represents the artificial intelligence. It can play
against another artificial intelligence or a human. It will place a
disk randomly.
:param game: Game object
:param player: current playe... |
b344c520d976d0d3dab9999cec12aeece6046d61 | HtutLynn/myanmar-website-crawlers | /shwemom_test_soup.py | 3,876 | 3.546875 | 4 | import bs4
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup as soup
from fake_useragent import UserAgent
import csv
import sys
ua = UserAgent()
headers = {'User-Agent': str(ua.random)}
# Put the desired url or website into the variable
my_url = "http://www.shwemom.com/celebrities-and-their-ph... |
5732caf17418dc5564ed9b57fa2f99ba24f8fb8b | caocmai/cs-1.3-core-data-structures | /Code/palindromes-and-strings/reversed_string_stack.py | 345 | 4.125 | 4 |
def reversed_number(number):
to_string = str(number)
number_string_stack = []
for number in to_string:
number_string_stack.append(number)
reverse_string = ""
while len(number_string_stack) > 0:
reverse_string += number_string_stack.pop()
return reverse_string
if __name__ == "__main__":
pri... |
a1a1302ab62c977ffccdf1b3c931893919435a8e | ScriptSniper/SenseHat | /GetTemperatureAndHumidity.py | 584 | 3.765625 | 4 | # Program to display the current humidity and temperature
from sense_hat import SenseHat
import math
sense = SenseHat()
# Display the humidity
sense.show_message("Humidity:")
sense.show_message(str(math.floor(sense.get_humidity())))
sense.show_message("%")
# Get the temperature (in celsius) and convert to farenheit
... |
c161df255764f7b9dfdfd7abcb6393220e868634 | GiannisDim/Bootcamp | /Python/python day 1/exercise2.py | 232 | 3.53125 | 4 | i = 50
sum = 0
while i >= 1:
x = str(i)
y = input("Enter number of "+x+" euro banknotes :")
z = i*int(y)
if i > 20:
i = i - 30
else:
i = i // 2
sum = sum + z
print("You have", sum, "euros")
|
e5e52e4a6370ab91f4e64bada7deedc1efa919c6 | GiannisDim/Bootcamp | /Python/python day 2/day2ex3.py | 370 | 3.796875 | 4 | x = input("Enter 10 digit number:")
digit = []
[digit.append(int(x[i]))for i in range(10)]
even = []
odd = []
for i in range(10):
if digit[i] % 2 == 0:
even.append(digit[i])
else:
odd.append(digit[i])
for i in range(len(odd)):
print(odd[i],end=' ')
print("\n", end=' ')
for i in range(len(... |
22fa265d90dbe90232d6b2df4397d16aed6da6b5 | GiannisDim/Bootcamp | /Python/python day 2/day2ex6.py | 271 | 3.84375 | 4 | def lis():
x = []
for i in range(3):
x.append(input("Enter a number with "+str(i+1)+" digits: "))
return x;
y = lis()
z = lis()
t = lis()
for i in range(3):
print(repr(int(y[i])).rjust(3)+"|"+repr(int(z[i])).rjust(3)+"|"+repr(int(t[i])).rjust(3))
|
c09e3a92ed0197926c8a6a6c5deba84a0283e621 | bcrtvkcs/csgo-menu-maker | /csgomenumaker/param/position.py | 411 | 3.640625 | 4 | from .sequence import Sequence
class Position(Sequence):
"""
Subclass of Sequence that accepts three scalar values.
Used for positions and angles.
"""
def __init__(self, key, *args, **kwargs):
Sequence.__init__(
self,
key,
*args,
**kwargs,
... |
9e47374f138d3ce19b934a824d4c66c23c40da37 | bcrtvkcs/csgo-menu-maker | /csgomenumaker/param/number.py | 5,984 | 3.765625 | 4 | import random
from ..misc.math import *
from .param import Param
class Number(Param):
"""
A param type which accepts only a number.
This class also accepts a few other kwargs which modify its behavior:
- choices
Only allow integers in this list.
- int
Only allow integers for this... |
bcc9d32d2d1fcd9f2b145f755141395fb60b26fa | saanhvisrivastava/project98 | /function.py | 268 | 3.625 | 4 | def swapFileData():
a=input("Enter the file: ")
b=input("Enter second file: ")
file=open(a,"r")
file2=open(b,"r")
file.write(data_b)
file2.write(data_a)
print("First file: "+ file)
print("Second file: "+ file2)
swapFileData() |
3ff37109ab38c91c0e8c4c6d1878f1ffb38161ec | sotendosredi/pyda-5-hw-1 | /DZ_1.py | 2,218 | 3.640625 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[4]:
long_phrase = 'Насколько проще было бы писать программы, если бы не заказчики'
short_phrase = '640Кб должно хватить для любых задач. Билл Гейтс (по легенде)'
len (long_phrase) > len (short_phrase)
# In[12]:
file_w = 6432623123
a = 2**20
print (file_w/a)
# In[15]:
... |
21fdc5e0595f7c65782ac32f1f75afa52d39bd30 | paulashbourne/cracking-the-coding-interview | /q8-3.py | 621 | 3.53125 | 4 | def findMagicIndex(array, offset = 0):
if len(array) == 0:
return None
elif len(array) == 1:
return offset if array[0] == offset else None
n = len(array)
mid = n / 2
if array[mid] == offset + mid:
return offset + mid
elif array[mid] < offset + mid:
# Solution cann... |
383dcd9c33b717821218e3b95bf9c544e190adcd | MRSAHAKYAN/BlackJack | /cards_weight.py | 625 | 3.703125 | 4 | from typing import List
from card import *
class CardWeight:
WEIGHTS = {
'J': 10,
'Q': 10,
'K': 10,
'A': 11,
}
@staticmethod
def _get_weight(card: Card) -> int:
# '2' ... '10' => int('2') => 2
# J => WEIGHTS => 10
if card.value.isdigit()... |
a4b406f59a0e37f30db03f35ee6352b5947d07f7 | ZaraZabil/python_basic | /Class 6/excercise_multiplication_table.py | 102 | 3.921875 | 4 | enter=int(input("Input number"))
for num in list(range(1,11)):
print(enter,'x',num,'=',enter*num)
|
a22b19b69f2f7a9b270d1081170048c8acb6d114 | ZaraZabil/python_basic | /Class 6/list_iteration_forloop.py | 389 | 4.09375 | 4 | #num_list=[1,2,3,4,5]
#for num in num_list:
# print(num*num)
#my_empty_list=[]
#num_list=[1,2,3,4,5]
#for num in num_list:
# square=num**2
# my_empty_list.append(square)
#print(my_empty_list)
my_empty_list=[]
user_num=int(input("For how many numbers you wat to square"))
for num in list(range(1,user_num+1)):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.