Ask coding questions

← Back to all posts
Coding puzzle *SOLVED*
bstockdale07 (0)

How can you remove the gap separating the number from the rest of the username?

Answered by RYANTADIPARTHI (6019) [earned 5 cycles]
View Answer
Comments
hotnewtop
RYANTADIPARTHI (6019)

i think there is a way. i'm thinking.

RYANTADIPARTHI (6019)

@bstockdale07 ok, here you go.

firstname=input("What is your firstname?") 
surname=input("What is your surname?") 
print(surname[:3] + firstname[0] + str(len(surname)))
JBloves27 (1901)

Well, I think how you do this is the following:

#maybe this
print(surname[:3] + firstname[0] + len(surname))

#or this
print(surname[:3] + firstname[0] + x)

That should work. I hope this helps!

RYANTADIPARTHI (6019)

@JBYT27 your solution causes an error. Please test your code before giving it.

JBloves27 (1901)

oof. it does? thats sad. Will do. @RYANTADIPARTHI