Representing infinity

0 votes
I was going through the pseudocode of an algorithm and there it assigns a variable to infinity. I know this makes some sense mathematically but is there a way to actually assign a variable to infinity in python?
Jun 27, 2018 in Python by nightshade
• 880 points
655 views

1 answer to this question.

0 votes
import math
infinity = math.inf

Now you can use infinity in your program

answered Jun 27, 2018 by Hamartia's Mask
• 1,580 points

Related Questions In Python

0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,356 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,922 views
0 votes
1 answer
+3 votes
1 answer

at model.fit I'm getting an error as : ValueError: Input contains NaN, infinity or a value too large for dtype('float32').

Hi, I think your X parameter contains null ...READ MORE

answered Apr 30, 2020 in Data Analytics by MD
• 95,460 points
2,963 views
0 votes
1 answer

If there a way to have the current month by default in a KPI representing MoM% in Power BI

The PREVIOUSMONTH DAX function can be used ...READ MORE

answered Feb 16, 2022 in Power BI by CoolCoder
• 4,420 points
2,250 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP