[SOLVED] Has anyone encountered such a problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[SOLVED] Has anyone encountered such a problem?

Python for beginners. 15.1-15.2, code coach. I try code: x = input("hi"), y = int(input(3)), print(x*y), but I don't get "hihihi" in the code output, instead I see "hi3coolcool" (there is confusion with another test in the workshop). Please, help.

16th Mar 2022, 9:04 AM
save_lie
4 Answers
+ 5
G'day save_lie I think you are new to programming. You are trying to write a program that takes an input. Seems like the input from test case 1 is "cool 2". You are seeing your prompt "hi" printed from your code. 👎 x=input("hi") Then you are seeing your next prompt "3" from your code. 👎 y=into(input(3)) The test case is sending "cool" as its first input, your code saves that to x. The test case then sends "2" as the next input, your code saves that to y. Your code then prints 👉 x * y 👈 which in test case 1 seems to be "cool" * 2 To fix it remove the prompts. Eg rewrite to 👍 x=input() Same for y, remove the input prompt. Let us know if that fixes it?
16th Mar 2022, 9:36 AM
HungryTradie
HungryTradie - avatar
+ 4
Remove hi and 3 then x = input() y = int(input())
16th Mar 2022, 9:35 AM
Simba
Simba - avatar
+ 3
Thank you all for your help! I misunderstood the task and for some reason began to push away from the values specified in the example of the task, while it was necessary to write just a code without values. The task is completed!)
16th Mar 2022, 9:42 AM
save_lie
+ 2
Champion! Would you be a champion of this forum too? Edit your original post to start with [Solved] Have you found the search bar, it is the magnifying glass icon at the top of the discuss screen. Did you know you can link SoloLearn "code bits" or other Q&A posts here by using the plus icon? https://www.sololearn.com/discuss/1316935/?ref=app
16th Mar 2022, 9:45 AM
HungryTradie
HungryTradie - avatar