0

Beginner pov hear me out though.

so I'm not quite sure I understand input quite yet as when I try and add a variable and an input together it kinda does a weird thing. basically I did this piece of code x = "hello" y = input(" ") print(x + y) output: hello(input) but then the output came out without the space but whenever I put any other text in it still shows in the output for example x = "gauc" y = input("amole") print(x + y) output: guacamole(input) I'm still learning olease tell me what am doing wrong thx ver mucsh

14th Oct 2018, 5:16 AM
Phillip Truong
3 Antworten
+ 1
I think there's a few things going on here that are making somethings that are already confusing in isolation to be more so by combining them. 🙂 In the Code Playground, inputs are gathered at the beginning, then assigned to your variables respectively (separated by line breaks / carriage returns), so in your code, you asked for 3 inputs, so you could put in: something other last for example. Then, to figure out what to print, it evaluates the function/method first (i.e. input("whatever-is-inside-this")), then the addition/concatenation. The above inputs result in: stringsomething turtleex2other text and some.spaceex3last Reference: http://www.informit.com/articles/article.aspx?p=459269&seqNum=11 I could be more precise with my terminology (method vs function) but I don't think it's super important right now. Here's another reference to save for later when/if such a distinction ever becomes important: https://www.geeksforgeeks.org/difference-method-function-JUMP_LINK__&&__python__&&__JUMP_LINK/amp/
15th Oct 2018, 7:34 PM
Janning⭐
Janning⭐ - avatar
0
Is this in Python? Because my outputs don't match yours. Please provide a link to your Code Playground code so we can help you troubleshoot the specific issues you are running into. The Code Playground should be relatively easy to find in the website version of SoloLearn, but if you are in the app version, it can be accessed via the curly braces, green circle with plus sign to add a new project, then select the project type. Looking forward.
14th Oct 2018, 9:21 AM
Janning⭐
Janning⭐ - avatar
0
hi thanks for replying but just from messing around I realised that the string that I put into the inputs would come out first. Also yes this is in python, sorry I should have specified. https://code.sololearn.com/c9dAnGN77WMz/?ref=app
14th Oct 2018, 2:42 PM
Phillip Truong