当前位置:网站首页>实例050:随机数
实例050:随机数
2022-08-10 22:20:00 【懒笑翻】
题目:输出一个随机数。
程序分析:使用 random 模块。
# random.uniform(a, b) # 返回a, b之间的随机浮点数, 若a <= b则范围[a, b], 若a >= b则范围[b, a], a和b可以是实数。 # random.randint(a, b) # 返回a,b之间的整数,范围[a,b],注意:传入参数必须是整数,a一定要比b小。
代码:
import random
print(random.uniform(-10, -2))结果:

边栏推荐
- 美味石井饭菜
- BM13 determines whether a linked list is a palindrome
- STL-stack
- QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll
- 配电网络扩展规划:考虑使用概率性能源生产和消费概况的决策(Matlab代码实现)
- ITK 读取一个目录中的一个序列,然后改变头信息,将多张dcm图像写成一个dcm文件。
- 2022年8月10日:使用 ASP.NET Core 为初学者构建 Web 应用程序--使用 ASP.NET Core 创建 Web UI(没看懂需要再看一遍)
- STL-deque
- 学会开会|成为有连接感组织的重要技能
- VulnHub之DC靶场下载与DC靶场全系列渗透实战详细过程
猜你喜欢

Introduction to the use of counter instructions in Rockwell AB PLC RSLogix5000

ThreadLocal comprehensive analysis (1)

DC-7靶场下载及渗透实战详细过程(DC靶场系列)

艺术与科技的狂欢,阿那亚2022砂之盒沉浸艺术季

解码2022中国网安强星丨正向建、反向查,华为构建数字化时代的网络安全防线

String类的常用方法

Nodes in the linked list are flipped in groups of k

亲测有效|处理风控数据特征缺失的一种方法

VLAN huawei 三种模式

Black cats take you learn Makefile article 13: a Makefile collection compile problem
随机推荐
链表中的节点每k个一组翻转
Shell programming specification and variables
Merge k sorted linked lists
gcc492 compile `.rodata‘ can not be used when making a PIE object; recompile with -fPIE
LeetCode Daily 2 Questions 02: Reverse the words in a string (1200 each)
Shell 编程--Sed
3598. Binary tree traversal (Huazhong University of Science and Technology exam questions)
RecyclerView滑动监听
瑞幸咖啡第二季营收33亿:门店达7195家 更换CFO
MySQL: MySQL Cluster - Principle and Configuration of Master-Slave Replication
这款可视化工具神器,更直观易用!太爱了
美味的佳肴
Nodes in the linked list are flipped in groups of k
罗克韦尔AB PLC RSLogix5000中计数器指令使用方法介绍
边缘与云计算:哪种解决方案更适合您的连接设备?
LeetCode每日两题01:反转字符串 (均1200道)方法:双指针
STL-deque
JS中使用正则表达式g模式和非g模式的区别
shell programming without interaction
QT笔记——用VS + qt 生成dll 和 调用生成的dll