+ 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

11th Oct 2020, 5:33 AM
Adam Stork
Adam Stork - avatar
11 Antworten
+ 1
https://code.sololearn.com/c4B8Tf0Fnv3U/?ref=app
11th Oct 2020, 11:13 AM
Slick
Slick - avatar
+ 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.
11th Oct 2020, 6:12 AM
Adam Stork
Adam Stork - avatar
+ 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!
11th Oct 2020, 11:35 AM
Adam Stork
Adam Stork - avatar
+ 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?
11th Oct 2020, 5:46 AM
Adam Stork
Adam Stork - avatar
+ 1
codemonkey I see. Okay, that is helpful. I'm tweaking the code and will see how it goes.
11th Oct 2020, 6:27 AM
Adam Stork
Adam Stork - avatar
+ 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
11th Oct 2020, 10:54 AM
Adam Stork
Adam Stork - avatar
0
you assigned cmd to a string. did you want to print the string? or have it ask for input at those lines?
11th Oct 2020, 5:37 AM
Slick
Slick - avatar
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?
11th Oct 2020, 5:49 AM
Slick
Slick - avatar
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. :)
11th Oct 2020, 11:21 AM
Adam Stork
Adam Stork - avatar
- 1
o why you
15th Oct 2020, 5:01 PM
Owhoru Onome
Owhoru Onome - avatar