Is there a way to use the rest of the operation like 'myage,%d'%(a%b) in Python?

Asked 2 years ago, Updated 2 years ago, 20 views

I tried to insert a number in the string, but there was an error when I used the rest of the operations Is there any way to use % operation within %() by adding or doing something before?

python

2022-09-22 14:19

1 Answers

It's working fine.

>>> a = 5
>>> b = 3
>>> 'my age,%d'%(a%b)
'my age,2'


2022-09-22 14:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.