Lv.1
本人真实昵称为Iron_boy
签名:我是一个C++编程狂,下面是我送给大家的一副对联: 上联: 年糕永远也没有想到,自己居然输给了口罩; 中联: 口罩永远也没有想到,自己居然成为了年货; 下联: 我们永远也没有想到,为国做贡献是睡懒觉! 横批: 【出乎意料】
在 【Python作品分享】Hatefulball Pong 2.0【作品秀】 中回复
因为字数限制关系,说不下去了,虽然我只写了200多字。注意运行要在第三方软件上,下载pygame包。
好了,祝大家游玩愉快!☺
2020-01-22T17:49:04 点赞:1
在 【宇軒小课堂】如何用Python做出一个简单的倒计时 中回复
在正版Python里面没有easygui模块呀,程序直接报错:
Traceback (most recent call last):
File "C:/Users/peter g/Desktop/~-PETER-~g/编程/Python/作品/非管理员勿打开!!/11.py", line 1, in <module>
import easygui
ModuleNotFoundError: No module named 'easygui'
2020-01-23T12:00:06 点赞:0
在 【Python作品分享】help【教程贴】 中回复
操作方法我再明确一下:
代码:help()
输出:
Welcome to Python 3.7's help utility!
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at ……
To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
help>
现在输入“modules”,注意不要换行再输入,打完了之后按回车键。
电脑输出:
Please wait a moment while I gather a list of all available modules...
__future__ atexit http sched
__main__ audioop hyperparser scrolledlist
_abc autocomplete idle search
_ast autocomplete_w idle_test searchbase
_asyncio autoexpand idlelib searchengine
_bisect base喵 imaplib secrets
_blake2 bdb imghdr select
_bootlocale binascii imp selectors
_bz2 binhex importlib setuptools
……
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
help>
这时输入turtle,它会停一停,然后打出一个有字的方框:
Squeezed text (8126 lines).
这是Python官方版的回答,双击它会问是否要打开,确认之后出现的是跟海龟编辑器里一样的回答:
Help on module turtle:
NAME
turtle
DESCRIPTION
Turtle graphics is a popular way for introducing programming to
kids. It was part of the original Logo programming language developed
by Wally Feurzig and Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it
t……
内容过长,其他的我就不说了,你知道什么模块就打它的名字进去吧!
2020-01-26T13:25:25 点赞:1
在 【Python作品分享】help【教程贴】 中回复
输入random,它会弹出:
Help on module random:
NAME
random - Random variable generators.
DESCRIPTION
integers
--------
uniform within range
sequences
---------
pick random element
pick random sample
pick weighted random sample
generate random permutation
distributions on the real line:
------------------------------
uniform
triangular
normal (Gaussian)
lognormal
negative exponential
gamma
beta
pareto
Weibull
distributions on the circle (angles 0 to 2pi)
---------------------------------------------
circular uniform
von Mises
General notes on the underlying Mersenne Twister core generator:
* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence.
* The random() method is implemented in C, executes in a single Python step,
and is, therefore, threadsafe.
CLASSES
_random.Random(builtins.object)
Random
SystemRandom
class Random(_random.Random)
| Random(x=None)
|
| Random number generator base class used by bound module functions.
|
| Used to instantiate instances of Random to get generators that don't
| share state.
|
| Class Random can also be subclassed if you want to use a different basic
| generator of your own devising: in that case, override the following
| methods: random(), seed(), getstate(), and setstate().
| Optionally, implement a getrandbits() method so that randrange()
| can cover arbitrarily large ranges.
|
| Method resolution order:
| Random
| _random.Random
| builtins.object
|
| Methods defined here:
|
| __getstate__(self)
| # Issue 17489: Since __reduce__ was defined to fix #759889 this is no
| # longer called; we leave it here because it has been here since random was
| # rewritten back in 2001 and why risk breaking something.
|
| __init__(self, x=None)
| Initialize an instance.
|
| Optional argument x controls seeding, as for Random.seed().
|
| __reduce__(self)
| Helper for pickle.
|
| __setstate__(self, state)
|
| betavariate(self, alpha, beta)
| Beta distribution.
|
| Conditions on the parameters are alpha > 0 and beta > 0.
| Returned values range between 0 and 1.
|
| choice(self, seq)
| Choose a random element from a non-empty sequence.
|
| choices(self, population, weights=None, *, cum_weights=None, k=1)
| Return a k sized list of population elements chosen with replacement.
|
| If the relative weights or cumulative weights are not specified,
| the selections are made with equal probability.
|
| expovariate(self, lambd)
| Exponential distribution.
|
| lambd is 1.0 divided by the desired mean. It should be
| nonzero. (The parameter would be called "lambda", but that is
| a reserved word in Python.) Returned values range from 0 to
| positive infinity if lambd is positive, and from negative
| infinity to 0 if lambd is negative.
|
| gammavariate(self, alpha, beta)
| Gamma distribution. Not the gamma function!
|
| Conditions on the parameters are alpha > 0 and beta > 0.
|
| The probability distribution function is:
|
| x ** (alpha - 1) * math.exp(-x / beta)
| pdf(x) = --------------------------------------
| math.gamma(alpha) * beta ** alpha
|
| gauss(self, mu, sigma)
| Gaussian distribution.
|
| mu is the mean, and sigma is the standard deviation. This is
| slightly faster than the normalvariate() function.
|
| Not thread-safe without a lock around calls.
|
| getstate(self)
| Return internal state; can be passed to setstate() later.
|
| lognormvariate(self, mu, sigma)
| Log normal distribution.
|
| If you take the natural logarithm of this distribution, you'll get a
| normal distribution with mean mu and standard deviation sigma.
| mu can have any value, and sigma must be greater than zero.
|
| normalvariate(self, mu, sigma)
| Normal distribution.
|
| mu is the mean, and sigma is the standard deviation.
|
| paretovariate(self, alpha)
| Pareto distribution. alpha is the shape parameter.
|
| randint(self, a, b)
| Return random integer in range [a, b], including both end points.
|
| randrange(self, start, stop=None, step=1, _int=<class 'int'>)
| Choose a random item from range(start, stop[, step]).
|
| This fixes the problem with randint() which includes the
| endpoint; in Python this is usually not what you want.
|
| sample(self, population, k)
| Chooses k unique random elements from a population sequence or set.
|
| Returns a new list containing elements from the population while
| leaving the original population unchanged. The resulting list is
| in selection order so that all sub-slices will also be valid random
| samples. This allows raffle winners (the sample) to be partitioned
| into grand prize and second place winners (the subslices).
|
| Members of the population need not be hashable or unique. If the
| population contains repeats, then each occurrence is a possible
| selection in the sample.
|
| To choose a sample in a range of integers, use range as an argument.
| This is especially fast and space efficient for sampling from a
| large population: sample(range(10000000), 60)
|
| seed(self, a=None, version=2)
……不说了,太长了
2020-01-26T13:26:54 点赞:1