当前位置:网站首页>实例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))
结果:
边栏推荐
- 2021IDEA创建web工程
- 德科立科创板上市:年营收7.3亿 市值59亿
- 常用代码扩展点设计方式
- 金山云CEO王育林离职:正值冲刺港股之际 雷军曾送金砖
- 计算需要的MIPI lane数目
- An article to teach you a quick start and basic explanation of Pytest, be sure to read
- Black cat takes you to learn Makefile Part 11: When the header file a.h changes, how to recompile all the .c files that depend on the header file a.h
- pytorch tear CNN
- make & cmake
- 过滤器
猜你喜欢
August 10, 2022: Building Web Applications for Beginners with ASP.NET Core -- Creating Web UIs with ASP.NET Core
A shell script the for loop statements, while statement
边缘与云计算:哪种解决方案更适合您的连接设备?
An article to teach you a quick start and basic explanation of Pytest, be sure to read
Nodes in the linked list are flipped in groups of k
ArcGIS应用基础知识
【开源教程5】疯壳·开源编队无人机-飞控固件烧写
金山云CEO王育林离职:正值冲刺港股之际 雷军曾送金砖
如何成为一名正义黑客?你应该学习什么?
virtual address space
随机推荐
How many threads does LabVIEW allocate?
RecyclerView滑动监听
RK3399 platform development series explanation (kernel-driven peripherals) 6.35, IAM20680 gyroscope introduction
测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?
CFdiv2-Common Number-(奇偶数二分+规律)
68: Chapter 6: Develop article services: 1: Content sorting; article table introduction; creating [article] article services;
file IO-buffer
VLAN huawei 三种模式
make & cmake
字节跳动原来这么容易就能进去...
QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll
基于交流潮流的电力系统多元件N-k故障模型研究(Matlab代码实现)【电力系统故障】
新一代网络安全防护体系的五个关键特征
3598. Binary tree traversal (Huazhong University of Science and Technology exam questions)
高数_复习_第5章:多元函数微分学
美味的佳肴
uni-app微信小程序——下拉多选框
OneNote tutorial, how to organize notebooks in OneNote?
JS use regular expressions in g model and non g difference
阿里云架构师金云龙:基于云XR平台的视觉计算应用部署