我需要用户名是用户名的前3个字母及其年龄,例如18岁的杰克将是Jac18
name = (input('what is your name'))
age = (input('what is your age'))
username = (name+age)
我需要添加或更改以使用户名只包含3个姓名和年龄的字母。
答案 0 :(得分:1)
name = (input('what is your name'))
age = (input('what is your age'))
if len(name) =< 3:
username = (name+age)
else:
username = (name[:3]+age)