Add a colon after a variable when inputed a value (Python 3.6) -
this first time coding in python. when calling inputed value within string, how add colon after variable? have far.
name1 = input('enter name of friend: ') bill1 = float(input('enter bill '+ name1))
for example want able have result
python 3.6 introduces literal string interpolation:
f'enter bill {name1}: '
for older versions use either format
or %
:
'enter bill {}: '.format(name1) 'enter bill %s: ' % name1
and string concatenation:
'enter bill ' + name1 + ': '
Comments
Post a Comment