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

example

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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -