Issue
I want to join a users input
to a string
.
def Username():
Name = ("Name:")
Name.join(input("What's your Dicer's name?:\n"))
print(Name)
Username()
If I were to input
the name 'Bradley'
for input()
here is the results:
What's your Dicer's name?:
Bradley
Name:
It didn't print
what I wanted even though I joined the input
with "Name:"
. Here is what I was expecting. Why is it not occurring?
What's your Dicer's name?:
Bradley
Name: Bradley
Solution
.join
is an overkill for this. You can simply concatenate the user input to Name
using +
:
def Username():
Name = "Name: "
Name += input("What's your Dicer's name?:\n")
print(Name)
Answered By - Moses Koledoye
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.