+ 3
[Solved] Where do I put the cmd variable?
...so it executes when the loop is finished and/or when the else condition is met? In order to always have the cmd variable displayed after all the operations are finished. The current positions (lines 24 and 28) are not working. https://code.sololearn.com/ckkEOjcHzSum/?ref=app
11 ответов
+ 1
https://code.sololearn.com/c4B8Tf0Fnv3U/?ref=app
+ 2
Slick You're right! I tried to assign an input to a variable. I will have to research this further.
codemonkey I will look into the code you've posted, although I will try to update my code first as to fix it rather than replace it. Since that would be no fun. :)
Thank you both! I'll let you know how it worked out.
+ 2
codemonkey An hour ago I didn't have one working code, now I have two! Haha.
Thank you both so much! You guys are the best!
+ 1
Slick I want it to ask for input.
I removed the str function (although I wouldn't think this would be an issue *) so it's cmd = input("Command: ") now, but the variable still doesn't show when it should. If I input loop, it executes the loop correctly, but then the program finishes, the variable isn't shown.
* Also, if the issue was that the variable was a string, wouldn't it still print the string?
+ 1
codemonkey I see. Okay, that is helpful. I'm tweaking the code and will see how it goes.
+ 1
Slick, codemonkey Okay, this is getting frustrating... I've been trying pretty much everything and it's still not working. What am I doing wrong? Why does the cmd() not execute the test() after inputting test?
https://code.sololearn.com/cQpZ0AXw6sBk/?ref=app
0
you assigned cmd to a string. did you want to print the string? or have it ask for input at those lines?
0
no because you never explicitly called print(cmd)
and did you want this to ask for input continuously? what are you trying to do with your program?
0
Slick It's working! Sweet!
I haven't gotten through all the function lessons, I thought the first few ones were enough to make this code work. Well, I guess I was wrong! :)
Thanks so much, Slick!
Now, back to the lessons. :)
- 1
o why you