+ 2
Can someone please help me with this code?
The idea is to create an infinite loop until the output equals the input. Can someone please tell how to make it break? https://code.sololearn.com/cY5NLPL05XzZ/?ref=app I edited it
19 Antworten
+ 1
This is basically your code corrected and works for words as well. and you could edit it a bit to work for anything.
I tried to keep as much as possible from your original code and added few things for fun.
https://code.sololearn.com/cz6LmvoliAEH/?ref=app
+ 1
Np. Your Idea was nice btw. In general try to structure the shit out of your code in your mind, I noticed that you had the idea and the syntax right but your structure was a little bit off.
+ 1
I will add some comments and recomment the code. Then you can ask again after going through it.
0
I don't understand what this code is supposed to do !
Is it supposed to keep choosing letters at random until it equals the input? Like bruteforcing?
0
FeDi BbM yes
0
Ava Alford and why do use files for that?
0
FeDi BbM the idea is to write to the file the random letter choice. Though I suppose you could do it another way. That opens up other possibilities I might try
0
FeDi BbM can you please look at my new code? Can you please tell me what would be a good way to do this or what I can change? I'm sure it's a lot
0
Ava Alford
perhaps this:
https://code.sololearn.com/c7EJSUqnCE6x/?ref=app
0
Mohamad Aljammal thank you so much. That was very helpful
0
Mohamad Aljammal can you explain if control: continue break for me please?
0
Mohamad Aljammal I don't completely understand the control statements.
0
Feel free to ask.
I might modify some things further so I might post it here again.
https://code.sololearn.com/cz6LmvoliAEH/?ref=app
0
Mohamad Aljammal thank you.
0
Mohamad Aljammal I have a few questions I left in the comments.
https://code.sololearn.com/c5o2aJjQdvzQ/?ref=app
0
Mohamad Aljammal I have another code that does something similar. Can you explain how to make it work to where it never prints no output?
https://code.sololearn.com/co9hZQlW7EnT/?ref=app
0
Each time you write a character to the file
You are appending it to a new line.
So if a user enters anything other than a single letter, you wont ever find a match
0
Actually you arent even appending it to a new line, but instead just overwritting the file
Aka file only ever contains one letter