infinite

Prevent writing an infinite loop

Prevent writing an infinite loop Question: This code takes user input and stores it into a file ,and then it saves the time the user visited in another separate file. import date time Today = date time.date time.now() name = input(‘Whats your name :’) filename = ‘guests’ with open (filename, ‘a’) as file_object: file_object.write(name +’.n’) …

Total answers: 2

Poetry stuck in infinite install/update

Poetry stuck in infinite install/update Question: My issue is that when I execute poetry install, poetry update or poetry lock the process keeps running indefinitely. I tried using the -vvv flag to get output of what’s happening and it looks like it gets stuck forever in the first install. My connection is good and all …

Total answers: 2

Can you run two infinite loops, one with an input, at the same time in python?

Can you run two infinite loops, one with an input, at the same time in python? Question: I’ve seen some posts about running infinite loops in python but nothing covering this specific topic. I was wondering if you could run code that asked the user a question for an input, whilst another infinite loop was …

Total answers: 1

Handling infinite loops in ctypes function with Python

Handling infinite loops in ctypes function with Python Question: Let’s say I have a several functions defined in C, one of which results in an infinite loop. I am using the ctypes module in Python to run each of these functions, and hence it results in an infinite loop resulting to a complete halt in …

Total answers: 2

Pause an infinite while loop with a single keypress

Pause an infinite while loop with a single keypress Question: I’m new to python and i have been trying to find a simple way to pause an operating while-loop, making it possible to start it again from where it was paused. I have searched google for help and tips, but everything i find seems very …

Total answers: 5

How can I represent an infinite number in Python?

How can I represent an infinite number in Python? Question: How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity. Asked By: ssierral || Source Answers: I don’t know exactly what you are doing, but float(“inf”) gives …

Total answers: 13

What's exactly happening in infinite nested lists?

What's exactly happening in infinite nested lists? Question: It’s possible to create an infinite nested list in Python. That’s clear and, although not popular and definitely not useful is a known fact. >>> a = [0] >>> a[0] = a >>> a [[…]] >>> a[0] == a True My question is, what is happening here: …

Total answers: 5

Is it possible to set a number to NaN or infinity?

Is it possible to set a number to NaN or infinity? Question: Is it possible to set an element of an array to NaN in Python? Additionally, is it possible to set a variable to +/- infinity? If so, is there any function to check whether a number is infinity or not? Asked By: Bob …

Total answers: 5