Skip to main content
-2 votes
0 answers
32 views

How do I fix this program in Java that won't rerun the while loop that asks for a continue yes/no? [duplicate]

I have this code to create a triangle which all works fine, but in the while loop I have the user prompted to answer yes or no if they want to make another triangle and regardless of the answer ...
Finn Roche's user avatar
-3 votes
1 answer
48 views

How would I make this loop ask the user to play again and not loop forever? [closed]

import random playagain = "Y" while playagain != "N": input("Ask your question, and I shall answer.") my_list = ["It is certain.", "It is decidedly so....
MJ_TheOne23's user avatar
-1 votes
0 answers
62 views

tkinter - configuring widgets using while loop

I have a method that does not work when being called. The program just stops working and nothing happens. def change_statistics(self): """Updates widgets in frame""" q = ...
Ryan Johansson's user avatar
-4 votes
1 answer
81 views

Infinite loop with array.includes in while loop [closed]

I'm struggling with this script, trying to push new set of data in an array ('occupes'), while checking that it is not already in that array. I use a while loop to do so, but it crashes (infinite loop)...
Matthieu Marcé's user avatar
1 vote
1 answer
36 views

Not able to run exe containing an infinite while loop as it keeps opening console window even after using pyinstaller to convert and hide the console [duplicate]

I have made a python script which basically has a while loop which waits for a particular exe to start, and as soon as it opens it shuts down the system. But the thing is that the exe file when run, ...
Panav Gupta's user avatar
2 votes
3 answers
85 views

How to make this while loop create a list of objects?

The following code is meant to loop through a txt file and create a list of recipes that each have a name, cooking time and ingredients, which are themselves put on a list try (Scanner scanner = new ...
Felix_is_coding's user avatar
1 vote
2 answers
96 views

How to debug this substring matching code?

I am a beginner in C programming, and this is a string matching code I wrote. It aims to find the positions where the substring t appears in the string s and print them. The use of pointers is ...
Elliott T's user avatar
0 votes
2 answers
44 views

Display WordPress posts in alternating sets of 3 then 2 items

I am struggling to get the following function work properly. I am trying to configure a loop inside WordPress with wrapping every first 3 items in a div. After that it should wrap the next 2 items in ...
Justus's user avatar
  • 123
0 votes
1 answer
71 views

Calling functions on array make the program to exit

I want a Game of Life program in the console. The parameters to initialize the 'field' can be changed in the mainMenu(). When all is done, it returns 1, and the drawing begins. When we return from ...
c51p152's user avatar
-5 votes
2 answers
67 views

Infinite Loop When Iterating Over a List

Explanation of the Main Problem Problem Details: The goal is to iterate through a list of numbers and print only positive numbers. However, the provided code enters an infinite loop and does not ...
user28382400's user avatar
-5 votes
0 answers
41 views

How can I use a while loop to print only even numbers in Java? [duplicate]

I am a beginner in Java and currently learning about loops. I want to use a while loop to print only the even numbers from 1 to 10. I wrote the following code, but it prints all the numbers instead of ...
Asma Al Muaither's user avatar
0 votes
1 answer
66 views

Why does this C program not return an error? [duplicate]

#include <stdio.h> int main() { int a[]={1,-2,3,0,-5}; int i=0; while(i++<5){ a[i]=a[i]>a[i-1]?-1:1; } for(i=0;i<5;i++) printf("%d",a[i]); ...
enis serifi's user avatar
0 votes
1 answer
62 views

Cuda atomic (CAS, Exch) loop hangs

I'm trying to implement Cuda blocking, loosely following this tutorial I have tried to implement that code but the loop hangs. Similarly, I have implemented this in a kernel, where mutex is allocated ...
bigcodeszzer's user avatar
-1 votes
3 answers
95 views

Unable to use Python While Loop as I want

I am new to Python and trying to learn While loop. list1 = [1,2,3,4,5,6,7] a = max(list1) idx = len(list1)-1 while a>4: a = list1[idx] print(a) idx = idx-1 As i am using 'while a>...
ranjit more's user avatar
0 votes
1 answer
69 views

While loop not printing message on screen

I'm writing a simple loop to prompt a word from the user. When user enters a word, we print "Hi" on the screen. When I'm running this code, I'm getting prompted, but I don't see "Hi&...
Sachin Titus's user avatar
  • 2,329

15 30 50 per page
1
2 3 4 5
1767