To print strings and numbers in Python, is there any other way than doing something like:
first = 10
second = 20
print "First number is %(first)d and second number is %(second)d" % {"first": first, "second":second}
To print strings and numbers in Python, is there any other way than doing something like:
first = 10
second = 20
print "First number is %(first)d and second number is %(second)d" % {"first": first, "second":second}
if you are using 3.6 try this
k = 250
print(f"User pressed the: {k}")
Output: User pressed the: 250
In Python 3.6
a, b=1, 2
print ("Value of variable a is: ", a, "and Value of variable b is :", b)
print(f"Value of a is: {a}")
import random
import string
s=string.digits
def foo(s):
r=random.choice(s)
p='('
p2=')'
str=f'{p}{r}{p2}'
print(str)
foo(s)
thank me later