26,495
questions
0
votes
0
answers
40
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 ...
-1
votes
3
answers
80
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>...
-1
votes
2
answers
40
views
Solving problems while repeating [closed]
enter image description here
How to solve problem 6 I do coding but the result is not repeatable and error
total_money = 0
day = 1
while day <= 5 :
earnings : float(input("How much your ...
0
votes
1
answer
66
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&...
0
votes
1
answer
75
views
Why does using nested loops cause the program to freeze?
I was trying to run the WDT on a specific microcontroller (it's still under development, and I accidentally got it as a test sample) and encountered an issue where, to start the WDT, there needs to be ...
-3
votes
0
answers
40
views
How can I validate the melody’s output format? [closed]
Write a program called LoopyMelody in your mmw package that will
accept, from the standard input stream, data corresponding to the number of notes per line
of melody and number of pitches to shift up ...
0
votes
1
answer
30
views
About Dafny loop invariant errors
The following code is the answer I came up with for the following problem. However, there are two main errors. By the way, this problem is problem 17 in Chapter 13 of the book "PROGRAM PROOFS&...
1
vote
1
answer
53
views
why is my loop only sometimes working correctly when the code is nearly identical?
Here is part of my python code, it's mostly working how I want, except for when the guessed letter is wrong, it loops incorrectly. I want it to loop back to asking for a letter, but it's looping back ...
-1
votes
2
answers
48
views
How do I disallow an alpha entry in a numeric input in Python? [closed]
import datetime
now = datetime.datetime.now()
current_year = now.year
while True:
user_name = str(input('What is your name?'))
if user_name.isalpha():
break
else:
print('...
1
vote
1
answer
55
views
Trying to iterate depending on key input using a while loop with if / else if
I have a code block to validate what a user inputs, using the keyboard...
Mainly asking for UP/DOWN/LEFT/RIGHT arrow keys...
When pressing up, it should increase the value of the counter by 1.
When ...
-1
votes
2
answers
85
views
While statement with and conditional behaviour
I have a very simple script that attempts to check the status of an API call up to a maximum of five times, with a one-second pause between each attempt. Script simulates an API call to check the ...
-2
votes
1
answer
74
views
Why am I getting errors from my while-loop in Java? [closed]
Beginner here. I'm having trouble writing a while loop (at section c) that outputs all numbers divisible by 5 and by 7 in the interval [35, 175] next to each other, separated by spaces. I am getting ...
2
votes
1
answer
95
views
R - The for loop may have bug while the acc it work with is a function. But why?
The issue
There is a case such as this,
acc = \ (a) \ (b) base::list(a = a, b = b)
for (x in c("A","B")) {acc = acc(x)}
acc
It returns:
$a
[1] "B"
$b
[1] "B"
...
0
votes
1
answer
39
views
Resetting "Last Row" in a While Statement
The objective is to take a value from A2 in an excel file and paste it into a specific location on another app. Then, take the value from B2 in the same excel file and paste it into a different ...
3
votes
2
answers
187
views
What does "do while (...) {...} while (...)" mean?
I accidentally combined a while loop with a do while loop to create this confusing construction:
do while (false)
{
Console.WriteLine(1);
}
while (true);
This doesn't throw any errors, but it ...