0
How multiplication of string and Integer is Possible in Python?? So confusing!!
X="a" Y=int(4) print(X*Y) output=aaaa
7 Respostas
+ 3
Yes. X string appended Y times itself..
+ 3
Multiplication of a string with an integer n returns the string n times, and the output string has a total length of n*len(string)
+ 3
doing this task is not confusing:
text = input() # input a text / word e.g.: 'abc' (do not input the quotes)
repeat = int(input()) # input a number e.g.: 3
print(text * repeat) # output will be a string 'abcabcabc' text contains the input 3 times
+ 2
x=banana
y=int(input())
Answer= (x*y)
Print("answer")
#bananabananabananabanana
or would that be str? it's confusing 🤣
+ 1
Right, you explained it so well. Not confusing at all 😂