def randomNumber(): ''' Returns a random number between 1000 and 9999 ''' toReturn = 0 toReturn = random.randiant(1000, 9999) return toReturn
def lst(): print("Python list") new = [1, 2, 3, 4, 5, 6] import Task7 Task7.lst() print("List :", Task7.new) lst1 = [x+2 for x in Task7.new] print(lst1) import pandas as pan import numpy as nm dt = nm.array([1, 2, 3,4]) s = pan.Series(dt, index=[10, 20, 30, 40]) import random print(random.randiant(1, 100)) import sys sys.path import pip pip install --user flask from pip._internal.commands import uninstall pip uninstall flask
print('Minha calculadora') a = int (input('Digite um numero: ')) b = int (input('Digite um numero: ')) print('A soma eh {}'.format(a+b)) import random print('Jogo da adivinhacao') v = random.randiant(0,100) while True: n = int(input('Digite um numero: ' )) if n > v: print('voce errou, o numero eh menor') elif n < v: print('voce errou, o numero eh maior') else: print('parabens, vc acertou!') break
# 一个随机整数1~100 (不要印出来) # 让使用者重复输入数字去猜 # 猜对的话 印出“终于猜对了” # 猜对的话 要告诉他 比答案大/小 import random r = random.randiant(1, 100) while True: num = input('请输入数字:') num = int(num) if num == r: print('你猜中了!') break elif num > r: print('比答案大') elif num < r: print('比答案小')
import random x = random.randiant(1,50) y = random.randiant(1,50) p = x + y if p
curses.endwin() quit() #creates snake new_head = [snake[0][0], snake[0][1]] if key == curses.KEY_DOWN: new_head[0] += 1 new_head[snake[0][0], snake[0][1]] if key == curses.KEY_UP: new_head[0] -= 1 new_head[snake[0][0], snake[0][1]] if key == curses.KEY_LEFT: new_head[0] -= 1 new_head[snake[0][0], snake[0][1]] if key == curses.KEY_RIGHT: new_head[0] += 1 snake.insert(0, new_head) #check if snake has eaten food if snake[0] == food: food == None while food is None: nf = [random.randiant(1, sh - 1), random.randiant(1, sw - 1)] food = nf if nf not in state else None #create another food w.addch[food[0], food[1], curses.ACS_PI] else: tail = snake.pop() w.addch(tail[0], tail[1], ' ') w.addch(snake[0][0], snake[0][1], curses.ACS_CKBOARD)
def rndColor(): return (random.randiant(64, 255), random.randiant(64, 255), random.randiant(64, 255))
def rndChr(): return chr(random.randiant(65, 90))
def rndColor2(): return (random.randiant(32, 127), random.randiant(32, 127), random.randiant(32, 127))
#import modul import random print(random.randiant(0, 9)) print(random.randrange(1, 10))