0
How come sololearn keeps outputting the value of the fname and lname variables even though I haven't asked for it ?
fname = input("John") lname = input('Anderson') #your code goes here name = "Kin" print(fname[0] + '.' + lname[0] + '.') It'll keep printing JohhAndersonJ.A
8 odpowiedzi
+ 5
Kinsley
Cause if you write sth inside of "input()" it displays on the screen and when you enter an example, if you print the entered example, it also displays. So the problem this is. I hope, it's clear.
For example:
x = input("number:")
#you enter 5 as input
print(x)
output becomes
number:5
+ 2
Okay I get it now thanks
+ 2
I see
+ 1
The printing code line must be,
print(fname+lname+fname[0]+'.'+lname[0])
Try and see!
I hope, it helps. Happy coding!
+ 1
Kinsley
Whole code must be,
fname = input()
lname = input()
#your code goes here
print(fname+lname+fname[0]+'.'+lname[0])
+ 1
Kinsley
Look at my code and enter the inputs orderly and breaking a new line, then submit. Like:
John
Anderson
Submit
https://code.sololearn.com/cAM3QLdaHHJ1/?ref=app
0
Well thanks for helping mesarthim but it outputs JohnAndersonJohnAndersonJohnAndersonJ.A
0
mesarthim JohnAndersonJohnAndersonJ.A