Result: Currently, my program will print a score depending on what the user enters. After the first input, ‘fazli’ the score was 17. My while loop is supposed to keep running until the user enters nothing. The problem is my while loop I believe. It won’t make a new score, it only copies the first one. How can I keep
Tag: while-loop
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: My code doesn’t do the same. I think there is should be the 2nd loop, but I don’t really understand how can I do it. Could you possibly give me a hint or advice to solve this task. Thanks. My code looks like this: Answer This should work:
How do you take output from print() and put it into a set of variables, one in each?
I want to save the output of the line print(LettersUpC[CodeNum]) into a variable outside, but have it be a different variable each time. How can I accomplish this? Answer this is a modified version that will work.
Function digits(n) that returns how many digits the number has , returns a random value in python
The function digits, in the while loop – while (n > 0) returns 325 326 327 and 1 as the count value and if I use while (n > 1) it returns the correct number count. Any logical reason for this behavior? Answer There is a difference between / and //. / does the normal division given an accurate answer
im having trouble with this code, although it works but not the way i want
In this code if i put the right username and wrong password, I get the “Wrong, Try again”, but if I put the wrong username and wrong password, i still get the “You have logged in successfully” help please, thank you <3 Answer There’re two conditions in your loop: entered_username in users ; users[entered_username] != entered_password . If any of
Using a for-loop and range function vs a while-loop
I’m looking for a function like range except that the step is a fraction of the previous number generated. So if the fraction was 99/100 the set of numbers might be something like this: 100, 99, 98.01… 0.001 Would this be more efficiently done with a for-loop and range-like function or with just a while-loop? The code I have so
How can I use the content of a file as a condition?
I installed AutoKey on my computer so I can execute python files with the keyboard, and what I want to do is execute a script as a loop but also being able to stop it. The script presses the “d” key on my keyboard, waits around 2.4 seconds, and then presses “s”. What I thought would be a good idea
If a table has columns equal to columns in a second table insert values in a third table, python – mysql
I have 3 table in my database: Borrowers: amount of the loan, interest rate, borrower id (PK) Lenders: amount of the bid, interest rate and LenderID (PK) Contracts: ContractID PK, amount, interest rate and the two foreign key(borrowerID, lenderID) I create a loop in python with an input command in which I can insert new request of loan and new
Python – Trying to print each line that has a string value that matches the index provided
Now I’m still pretty new to python and programming in general, but I know I’ve gone a bit of a roundabout way this entire program. But here is what I have and what I want if anyone can help. Begins by reading a text file e.g. ADF101,Lecture,Monday,08:00,10:00,Jenolan,J10112,Joe Blo ADF101,Tutorial,Thursday,10:00,11:00,Jenolan,J10115,Cat Blue ALM204,Lecture,Monday,09:00,11:00,Tarana,T05201,Kim Toll Then I make empty lists and append them
How to use while loop to check difference between calculation output , convergence calculation
I am writing a code that carry outs the calculation: I want to pass incremental n_value value starting from 2 then +0.10 each time it iterates. For the iteration I am writing while loop counter however, codes does not work. However the code does not iterate and I am kind of struggling how to create the iterative loop. I want