Most voted "while" questions
Use this tag when the question primarily involves logic and/or command structure. Effectively, while is a repeat loop used to iterate matrices, vectors, or to another end that basically has a single component, the stop condition.
Learn more…332 questions
Sort by count of
-
-1
votes1
answer39
viewsHow to do password validation in python:
I made a code to validate the password with some requirements: print("Cadastre aqui sua senha com os seguintes criétios: \n" " *Ao menos 8 digitos\n" " *Ao menos uma letra MAIÚSCULA\n" " *Ao menos…
-
-1
votes0
answers16
viewsLoop php in Carousel with Bootstrap indicators
I am creating a Carousel via bootstrap. The problem is that my div: <div class="carousel-inner"> is empty with ::after. Below follows my code: <div id="carouselExampleIndicators"…
-
-1
votes1
answer53
viewsHow to get back inside the while
I have a Dungeon code, in which the user can choose path 1 or path 2, each path leads to a room. In case he reaches room 8 I need a value between 1 and 5 to be drawn and return the respective room…
-
-1
votes0
answers31
viewsJava - problem when factorial using while
The idea is to type I type 3 numbers and calculate the factorial of each number. But I didn’t understand why the variable is keeping the value, for example. String entra; int cont = 1; int numero =…
-
-2
votes1
answer523
viewsStructure of Repetition in Python
I need to solve the following equation in Python N is an integer and positive value. Calculate and show the value of E according to the following formula: E = 1 + 1/1! + 1/2! + 1/3! + ... + 1/N! My…
-
-2
votes2
answers52
viewsCheck if file exists at runtime
I need to check if a file has been deleted while running a particular function. At the start of implementation the result of is_file is true, but during execution the file will be deleted and, this…
-
-2
votes1
answer207
viewsWhat is the error in this while PHP?
The code below selects all the results whose thumbnail of the video has not yet been created and if it has not been, it creates a new one, but I am getting an error that I cannot find the solution:…
-
-2
votes1
answer2037
viewsCalculate sine by Taylor series expansion
Write a program that calculates an approximation for the sine according to the equation below: seno(x) = x - x^3/3! + x^5/5! - x^7/7! + ... + x^n/n! Whereas x and n are integer numbers informed by…
-
-2
votes1
answer17
viewsHelp with form within WHILE
I would like to know how to get individual values of each like button, because when I like once a comment it ends up receiving the amount of others... Example; If you have 2 comments you get 2Likes,…
whileasked 5 years, 10 months ago Maykel Figueiredo 1 -
-2
votes1
answer106
viewsHelp me with this while and switch code in C?
Well I did this code in college, where it receives two integers and as the User chooses it performs an arithmetic operation with these two numbers typed. I believe my logic is correct, it compiles…
-
-2
votes1
answer33
viewsHow to send the respective messages to emails coming from the php database?
WARNING: HICCUP AT THE END OF THE POST I’m finalizing a project however I’m stuck in the following situation! I’m making a Newsletter system where the database has three fields, the permission to…
-
-2
votes1
answer63
viewsInsert Loop in C
I wish to insert an option for the user to type in how many rounds he wants to play against the cpu in this joquenpo game follows my code below, can any c master help me ? thanks #include…
-
-2
votes2
answers137
viewsA proposed infinity loop PYTHON exercise
HELLO, I’m trying to resolve the issue below, but I can’t make the LOOP work, since the exercise asks that even after choosing a type of average, the instruction comes back asking infinitely the…
-
-3
votes1
answer1783
viewsSolution for while in HTML structure
Someone has a simple solution to loop while in PHP to the following HTML structure? Basically I want every 3 Ivs to have one <li> separating them so that the slide can function properly, since…
-
-3
votes1
answer58
viewsResult while PHP
Hello. The while I created is responsible for adding several photos, however, when the photos are added they end up at the bottom of each other. Is there any method for the photos to go next to each…
-
-3
votes2
answers82
viewsfill as data an Array up to a specific value
I need to make a program that reads the keyboard names until the user type the word "order", and then print the typed names in the order they were typed. So far, I’ve tried to resolve this issue…
-
-3
votes1
answer267
viewsAdd a value to while in php
I have the following code: <?php $con = mysqli_connect("localhost","root","","gibellino"); mysqli_set_charset($con,"utf-8"); $result = mysqli_query($con,"select * from index_img"); while($row =…
-
-3
votes1
answer691
viewsWhile listed in python
Could someone help with the following doubt? in "item", the goal is to loop from 0 to 50 id_rec = [conteudo['complainResult']['complains']['data'][item]['id']] I made the following code: item = 0…
-
-3
votes2
answers85
viewsI am learning Python and have an exercise using the FOR that I am not able to do, can anyone help me?
Build an algorithm that reads the age and sex of 5 people, providing: *The number of men and women; *The average age of men and women; *The greatest age among men; *The lowest age among women. This…
-
-3
votes2
answers126
viewsHow to operate on the counter of a while in each loop iteration
Sorry my ignorance I’m starting to learn python now, my doubt is: How can I generate a result in each iteration of a while. valor= input('digite o numero desejado:') contador = 0 while contador…
-
-3
votes1
answer55
viewsrepeat loop - while
Hey, guys! All right? I’m not able to develop an algorithm in Javascript that "Ask the user to enter a number n and add all numbers from 1 to n" using while only. Would anyone like to help? Tks…
-
-3
votes1
answer167
viewsShow F(n) of the Algorithm sequence of Fibonacci
I need to know the last term of the Fibonacci sequence, I’ve done it to show all the terms, but I need you to show me the last I’m using the Visualg Algoritmo "Fibonacci" Var v1, v2, v3, limite,…
-
-3
votes1
answer40
viewsHow do I put a close button on my python file?
I’m starting in python and I’m writing a code, but when all the actions end the program closes, how do I put a command where for example click ESC and it closes? I want that when the person does not…
-
-3
votes1
answer40
viewsHelp on a While Improvement()
I would like when the user presses a different character from’S' and 'N', to inform the message "Enter a valid character". They could help me? #include <stdio.h> #include <stdlib.h>…
-
-3
votes1
answer45
viewsStop loop with typed text
Hello, I’m new to programming and would like to know if I can stop this loop when the user type "Quit" in the dialog box "Enter your name". public class PeriodoDeVacinacao { public static void…
-
-4
votes2
answers56
viewsBuild error
I started AI recently and I don’t get much of this... The idea was to use the while to show us all even numbers up to 100 but is always giving error and could not fix this yet. while (i <= 100) {…
-
-4
votes1
answer178
viewsWith creating a program that reads 10 numbers and writes the lowest and highest read value (Python)?
I’m having a little trouble with this exercise. Here is my code: python num = float(input('Digite o 1 numero: ')) guarda_maior = num guarda_menor = num for n in range(1, 10): num =…
-
-4
votes2
answers52
views -
-4
votes1
answer43
viewsHow to repeat all the code at the end of the execution when "While" repeats only one part?
I’m doing a program that calculates a person’s pay based on the number of hours and overtime worked. The idea is that at the end of the execution the user decides whether to recalculate or terminate…
-
-4
votes1
answer69
viewsIs there a way back to a particular line of code?
I would like to know if there is any module, function, etc. that would allow me to go back to a certain line of code. I have this doubt because, whenever I want to ask a question repeatedly, I have…
-
-5
votes2
answers1037
viewsHow to make an infinite count loop in Java?
I am starting my studies with Java now and I would like to know how to do an infinite count I’m having difficulties, because I know that in Python it would be something like: a = 0 while True: a = a…
-
-5
votes3
answers169
viewsDoubt about Python data output
I’m solving the following exercise: Make a program that prints on the screen the numbers from 1 to 20, one below the other. Then modify the program to show the numbers next to each other. The first…