当前位置:网站首页>How to judge whether the input content is "number"
How to judge whether the input content is "number"
2022-07-07 22:26:00 【Happy learning Python】
When you want users to enter a number , Will use input function , however input The function does not restrict what the user enters , Users can also enter string or other format content .
Run the following code :
When the user enters the correct number , Output is as follows :
When user input error , Output is as follows
If you want users to input numbers as required, you need to judge the user's input content and then output .
Because the string content cannot be converted to floating point (float), You can convert user input to floating point (float) As the result of the True still False To judge .
Run the following code
If the input is not a number , Output is as follows :
边栏推荐
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- [azure microservice service fabric] how to transfer seed nodes in the service fabric cluster
- Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
- 用语雀写文章了,功能真心强大!
- This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
- 如何实现横版游戏中角色的移动控制
- OpenGL job coordinate system
- OpenGL job - texture
- OpenGL jobs - shaders
- Time standard library
猜你喜欢
[azure microservice service fabric] start the performance monitor in the SF node and set the method of capturing the process
Index summary (assault version)
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
反爬通杀神器
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
建立自己的网站(18)
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
Reinforcement learning - learning notes 9 | multi step TD target
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]
Ueeditor custom display insert code
随机推荐
The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
MIT6.S081-Lab9 FS [2021Fall]
ByteDance Android interview, summary of knowledge points + analysis of interview questions
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
Remember an experience of using selectmany
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
使用 BlocConsumer 同时构建响应式组件和监听状态
. Net automapper use
JS number is insufficient, and 0 is added
Tsconfig of typescript TS basics JSON configuration options
Pdf document signature Guide
戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
Revit secondary development - shielding warning prompt window
C development - interprocess communication - named pipeline
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
【colmap】稀疏重建转为MVSNet格式输入
The difference between NPM uninstall and RM direct deletion
Build your own website (18)
The function is really powerful!
The whole network "chases" Zhong Xuegao