while-loop tag

27 questions


1 answers
92 views
0
To print sentences in reverse order while statements

sentence='There is a sun in the mouse hole.'i=len(sentence)-1while i >= 0 : if sentence[i]=='': print('-') else: print('%s'% sentence[i],end='') i-=1

2 years ago

2 answers
95 views
0
Self-Error when entering a string for a question that requires a decimal point

I make a code to enter the second decimal placeIf you enter a string, or if you enter a decimal point incorrectly, Print a print (Re-enter).You want to prompt again to enter the second decimal place.B...

2 years ago

1 answers
128 views
0
Use while loop to convert from Python Decimal to binary

For example, to convert the number 92 to binary:92 / 2 - quotient = 46 remainder = 046 / 2 - quotient = 23 remainder = 023 / 2 - quotient = 11 remainder = 111 / 2 - quotient = 5 remainder = 15 / 2 - q...

2 years ago

1 answers
104 views
0
I change the Python while statement to for statement, but I don't get the same execution value

###Global variable declaration part##i,k=0,0##Main code part ##i=0while i<9: if i<5: k=0 while k<4-i: print(' ', end='') k+=1 k=0 while k<i*2+1: print('\u2665', end='')###Global var...

2 years ago

1 answers
81 views
0
It's a C++ question

Hi, everyone.I'm asking you this question because I don't understand something because I'm a C++ beginner.#include <iostream>using namespace std;// *** Declaration of Global Variables ***// #1in...

2 years ago

1 answers
108 views
0
Python Dictionary while statement registration code

Please help meI was looking for it for 4 hours and this is the code I came up withIt works, but I can't print out the last word added. TT: Please save meㅠ


1 answers
104 views
0
While loop problem 1

Create function multiplies_of_k(n,k), in which n and k are two integers larger than 0. The function will return a list, which contains all the multiplies of k not larger than n in ascending order. k, ...

2 years ago
« - 3 -

© 2024 OneMinuteCode. All rights reserved.