I have problems with pythons chatbot v1.1 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

I have problems with pythons chatbot v1.1

I have done test case 1,but I don't know what to do with test case 2 and 3 because the difference between test case 1 and 2,3 is people's names and I don't know what to do with this

30th Jun 2023, 9:35 AM
Cloud
Cloud - avatar
25 Antworten
+ 9
It sounds like you're hardcoding. That means you can only solve 1 problem once. You need to think of how you can solve all of the problems with the one code. Review your lesson, are you accepting input? Or are you declaring the variable with a value? For example: Hardcoded a = 2 b = 2 print(a+b) You can only ever get the answer of "4" Correct a = int(input()) b = int(intput()) print(a+b) Now, when the user types 2 numbers the program will display the answer. Do you see the difference?
30th Jun 2023, 11:30 AM
Ausgrindtube
Ausgrindtube - avatar
+ 7
Cloud , Share your attempted code...
30th Jun 2023, 11:25 AM
Riya
Riya - avatar
+ 5
Your error is here: # Take the name as input name = "Mary" It says to take the name as input. You don't accept input, you assign the value of the variable as "Mary". That's hardcoding. Review the lessons and maybe my comment above.
30th Jun 2023, 3:41 PM
Ausgrindtube
Ausgrindtube - avatar
+ 4
Surlax Mahat please don't spam with irrelevant comments. You can share such things in your feed under the community tab.
2nd Jul 2023, 8:27 AM
Ausgrindtube
Ausgrindtube - avatar
+ 4
Can you share your code? (Read below) That's as close as you'll get to a walk through. https://code.sololearn.com/Wek0V1MyIR2r/?ref=app
4th Jul 2023, 1:24 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Thanks everyone, I solved the problem
2nd Jul 2023, 8:35 AM
Cloud
Cloud - avatar
+ 3
Read the comments here K. Bradley . Do not hardcode "Mary", you need to accept an input.
4th Jul 2023, 7:01 AM
Ausgrindtube
Ausgrindtube - avatar
30th Jun 2023, 12:21 PM
Cloud
Cloud - avatar
+ 1
Ausgrindtube , thanks
30th Jun 2023, 4:59 PM
Cloud
Cloud - avatar
+ 1
Share what you have tried so we can know where you have error.
30th Jun 2023, 7:10 PM
Emmy~tech
Emmy~tech - avatar
+ 1
How did you do chatbot v1. 0?
11th Jul 2023, 7:57 PM
Orber playz
+ 1
Sunday Ayomide you need to upload your code for us to see what's the problem. Look at my post with the link to Ugulberto Sánchez's code.
25th Jul 2023, 7:04 PM
Ausgrindtube
Ausgrindtube - avatar
0
I don't understand why the practice chatbot v1.1 doesn't get completed
30th Jun 2023, 12:33 PM
Cloud
Cloud - avatar
0
I actually restarted introduction to python course (which I had completed long back) to see what is the code you were talking about. I am an old user of Sololearn. The code you shared didn't open for me. Now coming to the question, you may have already performed string concatenation since your first test case passed. And I agree that you are hardcoding the name variable with the first test input value. Of course, the code would fail when that value changes for other test cases. The name is a variable, not a constant. You hardcode constants, not variables (variable always varies in value). So in this case, name is not only Maria, but also Tom and others depending on the testcase. It depends on the input, what the value of name should be. What is provided as input, needs to be the value of the name variable in this case. There is a way to store the input value in a variable, which was also discussed in the same lesson. Python provides an inbuilt function for storing inputs. Use that.
1st Jul 2023, 6:38 PM
Avinash Suresh
0
Hint: See Inputs and Outputs lesson in the same course if you are still confused
1st Jul 2023, 6:42 PM
Avinash Suresh
0
I actually restarted introduction to python course (which I had completed long back) to see what is the code you were talking about. I am an old user of Sololearn. The code you shared didn't open for me. Now coming to the question, you may have already performed string concatenation since your first test case passed. And I agree that you are hardcoding the name variable with the first test input value. Of course, the code would fail when that value changes for other test cases. The name is a variable, not a constant. You hardcode constants, not variables (variable always varies in value). So in this case, name is not only Maria, but also Tom and others depending on the testcase. It depends on the input, what the value of name should be. What is provided as input, needs to be the value of the name variable in this case. There is a way to store the input value in a variable, which was also discussed in the same lesson. Python provides an inbuilt function for storing inputs. Use that.
2nd Jul 2023, 2:55 AM
Jennycar ALVAREZ
Jennycar ALVAREZ - avatar
0
Python has implictily changed the number as an integer due to some built in data types
2nd Jul 2023, 4:00 AM
S2XPHOENIX🇮🇳
S2XPHOENIX🇮🇳 - avatar
0
I guess it would be great if the one asking the question has the option to lock the discussion when they have resolved their issue.
2nd Jul 2023, 1:02 PM
Avinash Suresh
0
I am having issues with this and I cannot move past it I am getting the correct code for Mary but it is not generating the code for the other two people how do I get it to populate the correct code for all three people at the same time so I can pass onto the next lesson?
3rd Jul 2023, 11:32 PM
KBradley
KBradley - avatar
0
Ausgrindtube I've tried everything that makes sense on this post and so many ways. Is there a walkthrough somewhere? 😅
4th Jul 2023, 12:38 PM
KBradley
KBradley - avatar