Example #1
0
def game(dice,
         faces):  #number of dice and faces are defined withon function 'Game'
    result = 0
    for roll in range(
            0,
            dice):  #roll is initialised taking values between 0 to dice input
        result += rt(1, faces)
    return result
def RWT():
    RT = rt(1, 5)
    if RT == 1:
        tm.sleep(2)
    if RT == 2:
        (1.2)
    if RT == 3:
        tm.sleep(0.8)
    if RT == 4:
        tm.sleep(2.4)
    if RT == 5:
        tm.sleep(1)
Example #3
0
def adding():
    ran = rt(0, 9)
    a = input('Введи название товара (например: ' + examples[ran] + ')\n> ')
    b = input('Введи стоимость\n> ')
    try:
        int(b)
    except ValueError:
        print('Ошибка: ЧИСЛО!! ВВАДИ ЧИСЛОООООО!!!!1!')
        exit()
    c = input('Введи количество (в граммах или миллилитрах)\n> ')
    try:
        int(c)
    except ValueError:
        print('Ошибка: ЧИСЛО!! ВВАДИ ЧИСЛОООООО!!!!1!')
        exit()
    list_of_titles.append(a)
    list_of_prices.append(int(b))
    list_of_quantity.append(int(c))
Example #4
0
#Aashay Bhoyar
#grno-11810789
rollno-04(M div)
#outcome of rolling of a dice using function
# #import random
from random import randint as rt
out=0
faces=6
dice=3
for roll in range(0,dice):
    out+=rt(1,faces)
print(out)
def game(dice, faces):
    result = 0
    for roll in range(0, dice):
        result += rt(1, faces)
        return result
def game(dice, faces):  #function defining
    result = 0
    for roll in range(0, faces):  #for loop
        result += rt(1, faces)
    return result
Example #7
0
import random
from random import randint as rt


def game(dice, faces):
    result = 0


for roll in range(0, dice):
    result += rt(1, faces)
return result
result = game(1, 6)
print(result)
x = x - 1
print("factorial is", fac)
import matplotlib.pyplot as plt
import numpy as np
from random import randint as rt
# x coords, y coords, red and circles
x = [rt(0, 100) for i in range(1000)]
y = plt.plot
plt.hist(x, 100)

plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.show()
Example #9
0
def game(dice, faces):
    result = 0
    for roll in range(0, dice):
        result += rt(1, faces)
    result = game(2, 6)
    print(result)
Example #10
0
if not os.path.exists('config') or os.path.getsize('config') <= 10:
    os.system('type nul>config')
    print('Now we need to configure something.')
    while True:
        temp = []
        temp.append(input('Enter a task name: '))
        temp.append(input('Enter a time (in format HH:MM:SS), when you need to send the message: '))
        temp.append(vk.utils.resolveScreenName(screen_name=input('Enter a link of person, who you need to receive the message: ').split('/')[-1])['object_id'])
        temp.append(input('Enter the message for him:'))
        datetimes.append(temp)
        choice = input('User added. Do you want to add another one? (yes/no): ')
        if choice.lower() in 'no': break
        
else:
    with open('config', 'rb') as config_file:
        datetimes = load(config_file)

try:
    while True:
        for task in datetimes:
            # task[0] - task name, task[1] - time of executing, task[2] - user_id, task[3] - message
            if task[1] == datetime.now().time().strftime('%H:%M:%S'):
                vk.messages.send(user_id=task[2], random_id=rt(0, 131767), message=task[3])
                slp(1.5)

except KeyboardInterrupt:
    exiting()i

            
            
# print(aaa)


# 导入模块中的变量或者函数

# from py27_10day.work1 import n
# print("work中导入的n:",n)

# from py27_10day.pack01.work2 import number
# print("work2下面的number:",number)
#
# from py27_10day.pack02.work3 import n3
# print("work3下面的n3",n3)
#
#
# from keyword import kwlist
# print("keyword中的kwlist",kwlist)
#
# from random import randint,random,uniform
# print(randint(1,100))


# 导入的时候给模块或者变量起别名
from random import randint as rt, random as rm
print(rt(1, 100))

from py27_10day import work1 as wk1
print(wk1.n)


Example #12
0
def game(dice, faces):  #defining a fun
    result = 0
    for roll in range(0, dice):  #for loop
        result += rt(1, faces)
    return result
Example #13
0
def roll_dices(n=2):  #摇骰子
    total = 0
    for i in range(n):
        total += rt(1, 6)
    return total