+ 1

Is code broken?

Iā€™m studying python for beginners and cannot get beyond lesson 16.1. It will not allow me to solve both test cases at once. How can I fix this?? text=input() print("***"+ " "+ "hello" ""+" ***")

17th Nov 2022, 1:28 AM
Christany Johnson
Christany Johnson - avatar
12 Answers
+ 1
Your problem is that you're putting hello in the print statement. That's what I was saying before about not putting the input value yourself. That is supposed to be taken from the text variable - like in the solution I posted. That way it will work whatever word the user enters (and you are not the user and don't need to provide any input values yourself). This app is generating the input values.
18th Nov 2022, 8:39 AM
Caroline Russell
Caroline Russell - avatar
+ 2
Christany Johnson The reason I asked for the Code Playground link in the question description is because we have to see the code as it is, and actually test it, to know the problem you face and give you hints in the right direction. When you just describe the problem, without the code link, we have two layers of interpretation - yours and ours - between our guess and your issue. Plus, copy/paste your code sometimes add misleading differences, and require another copy/paste - and more possible copy errors - for us to run the code. Keep that in mind for future posts.
18th Nov 2022, 1:26 PM
Emerson Prado
Emerson Prado - avatar
+ 1
What do you have? Should be something like this, assuming I'm looking at the right lesson. text = input() print('*** ' + text + ' ***')
17th Nov 2022, 2:55 AM
Caroline Russell
Caroline Russell - avatar
+ 1
Yes! Thats exactly it. I get the responce that it is correct for test case #1 but then it forces me to get the other test case wrong. It has multiple test cases in one problem but will not let me code multiple solutions
17th Nov 2022, 3:17 AM
Christany Johnson
Christany Johnson - avatar
+ 1
It shouldn't need multiple solutions as it's just adding some * and spaces with an input. Do you have the line where you're getting input correct, or are you trying to literally insert the exact word? That won't work. Edit: What I mean is that you are not supposed to be providing the input value yourself.
17th Nov 2022, 3:24 AM
Caroline Russell
Caroline Russell - avatar
+ 1
I wish I could show pictures. The original question is just asking to code out *** hello *** when conpleted, it results as Test case 1 passed but 2 failed. If I go back to correct it to what 2 is asking for, it then says test case 2 is correct but 1 is wrong.
17th Nov 2022, 3:28 AM
Christany Johnson
Christany Johnson - avatar
+ 1
Pls follow these instructions, for us to see the problem: 1. Edit your question description 2. Hit "+" button, then select add code 3. Select your code from Code Playground
18th Nov 2022, 12:45 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Ahh now I understand fully what you mean. Okay, thank you so much!
18th Nov 2022, 9:04 AM
Christany Johnson
Christany Johnson - avatar
0
You could take a screenshot and upload it to imgur. Then post the link.
17th Nov 2022, 3:59 AM
Caroline Russell
Caroline Russell - avatar
0
Caroline Russell im not sure what imgur isā€¦
18th Nov 2022, 4:12 AM
Christany Johnson
Christany Johnson - avatar
0
Emerson Prado I have added code. It comes out correct. However its asking for case to be correct at the same time. If one case is correct, the other isnt
18th Nov 2022, 4:13 AM
Christany Johnson
Christany Johnson - avatar
0
No problem ;)
18th Nov 2022, 9:05 AM
Caroline Russell
Caroline Russell - avatar