Category "while-loop"

Beginners Coding Error, While Loop Triggering 2 Messages

I am a beginner that just started learning python this Monday and one of the first hurdles I am getting into is while loops. I was trying to code a number guess

Sum of n natural numbers using while loop in python

The question was tp :write a program to find the sum of n natural numbers using while loop in python. n = int(input("Enter a number: ")) i = 1 while i<n:

Email Verification using re.search Python

Need help making email verifications with the variable 'pattern' and making it so that it loops if it doesn't contain whatever is within the pattern. Required t

Hack assembly language - finding the maximum number in RAM

as a task I have to find the maximum number in the RAM locations 10 to 20 and we have to write the solution into RAM[0]. I have a big problem with getting the i

I want modify this code as when a user gives right name but wrong password code must run from enter password not from enter username again

while True: print("who is this?") name=input() if name!='shubh': continue print("hi its you shubh. type your password") password=i

While loop with NSFileManager directory enumerator not running

I am seeking help to understand why a tutorial I am following is not working for me. I am running macOS 12.3.1, Xcode 13.3.1. The project is in Objective-C and

While loop with NSFileManager directory enumerator not running

I am seeking help to understand why a tutorial I am following is not working for me. I am running macOS 12.3.1, Xcode 13.3.1. The project is in Objective-C and

How to write the program that prints out all positive integers between 1 and given number , alternating between the two ends of the range?

The program should work as follow: Please type in a number: 5 1 5 2 4 3 My code doesn't do the same. I think there is should be the 2nd loop, but I don't reall

Confused with the "not" operator in while loops and if statements

So I'm a total beginner when it comes to Python and the "not" operator is kinda confusing me. So i was watching a BroCode video and he wrote this code: name = N

C++ While loop not re-assigning string value

I had created a program that counts the amount of vowels in a provided string. It counts the vowels correctly and repeats when the user provides a 'y' or 'Y'. H

C++ While loop not re-assigning string value

I had created a program that counts the amount of vowels in a provided string. It counts the vowels correctly and repeats when the user provides a 'y' or 'Y'. H

Multiple actions within one while loop python

I need help with an experimental python bot that allows one to be afk and grind discord bots. (And I'm new to programming so please don't judge). Im trying to g

How can I program a while loop that waits for my input in Android?

My question is simple. What method can I use to tell my program that a button is pressed? I'm trying some codelines but its not really working (I tryed with isP

How to get information from a while loop after a pipe in bash

From this trivial example: $ x="ls output: " $ ls | while read line; do x="$x $line"; echo $x; done ls output: a ls output: a b ls output: a b c ls output: a b

How to stop printing comma and space after last digit in c

Here is the program I wrote: int main(void) { int d1, d2; d1 = 48; while (d1 < 58) { d2 = d1 + 1; while (d2 < 58)

How to do multiple loops with user inputs in python terminal?

I'm new to phyton and I looked everywhere, but all that I find is the .split() option for multiple inputs but I don't want them together, I want one in each sep

Confusion with an infinite while loop, concerning Scanner.nextInt();

I am having problems with understanding why code is not working. My objective is to keep reading the input of the user until the user finally enters "5", to whi

printing the largest number from a while loop, when 10 numbers are inputted from the keyboard

Every time my output prints out the last number given through the Scanner as the largest number. This program needs to be modified in a way, that it scans throu

Converting text file to all uppercase letters

I have an assignment for class and I have to make a program that takes an existing file and converts all the letters to uppercase. Below is part of the code (sp

Number of trailing zeroes

I've written a function trailing_zeroes(int n) that returns the number of the trailing zeroes in the binary representation of a number. Example: 4 in binary is