Q&A Discussões
In the continue Loop -
i = 0
while True:
i = i +1
if i == 2:
print("Skipping 2")
continue
if i == 5:
print("Breaking")
break
print(i)
print("Finished")
It shows the output being
"1
Skipping 2
3
4
Breaking
Finished"
Why are the last three lines not
"Breaking
5
Finished"
Where it shows print(i) after break?
1 Voto
3 RespostasGregorianCalendar
0 Voto
1 Respostapython
0 Voto
3 Respostasjavascript code
0 Voto
1 Respostain order to find the sum of n numbers given by user,suppose our program is to find the sum of any 4 numbers given by user (using while loop such that (while(i<=4))and incrementing each value of i by 1),if the user give any 2 inputs instead of four then the total sum should be the summation of that two inputs..but the program shows the sum something else,why it is so??
2 Votos
3 RespostasHow can I read from a file this line
19 34 Gateway Arch - St. Louis, MO.
The first digit is age, second timeUsed, and the rest description. So I want to read them and store them in a variable.
The code insime my while loop of my File is int age = reader.nextInt();
Int Tused = reader.nextInt();
Description = reader.next()
0 Voto
4 RespostasWhen Bongi's new baby, Sipho, was born,she opened a savings account woth R1000.00. On each daybitthday,starting with the first,the bank added 4.5% of the balnce and Bongi added another R500.00 to the account.Write a loop that will calculate how much money was in the account on Sipho's 18th birthday?
0 Voto
2 RespostasInstream & outstream
0 Voto
1 RespostaHow do I do this?
-3 Votos
2 RespostasWrite a java program that generates the binomial coefficients for (x +y)^14 prints them, separated by a comma and a space use a loop or loops to increment the integer n and k after they are initialized.
Hint:for the above problem the coefficients ate the 15th row of pascal triangle
0 Voto
2 RespostasPointer in array
0 Voto
1 RespostaIn the short code below, I declared an array of five elements. But I'm getting confused on how to use it in a while loop. My main question is , if the user inputs a userchoice1 value that is less than 1, I want the code to keep looping until the user inputs a number that is not less than 1. But I don't know if the 7th line (userchoice1 [x]++) shows the right way to loop it.
1 Voto
2 RespostasQuente hoje
Sticky position
2 Votes
Help please?
3 Votes
Online voting system
2 Votes
Game development
0 Votes
Ruby programming?
3 Votes
SQL practice
2 Votes