

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I represent an infinite number in Python?
A number equivalent to infinity can be assigned to a float variable by putting 'inf' as argument to float() function
>>> a=float('inf') >>> a inf
It is also possible to achieve same effect by assigning inf constant in math module
>>> import math >>> a=math.inf >>> a inf
- Related Questions & Answers
- How can I represent immutable vectors in Python?
- How can I represent python tuple in JSON format?
- How we can come out of an infinite loop in Python?
- How to stop an infinite loop safely in Python?
- Index into an Infinite String in Python
- How i can replace number with string using Python?
- In MySQL, how can we represent the time value as an integer?
- How can I delete an element in Selenium using Python?
- How can I display an image using cv2 in Python?
- How to create an infinite loop in C#?
- How to run an infinite loop in Tkinter?
- How can I convert a Python tuple to an Array?
- How can I apply an offset on the current time in Python?
- How can I write an SQL IN query with a Python tuple?
- How can I round down a number in JavaScript?
Advertisements