What is the answer of str="05"*5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the answer of str="05"*5

28th Jun 2019, 4:16 PM
Y.C.B Reddy
Y.C.B Reddy - avatar
11 Answers
+ 16
str="05"*5 is not a question, but if you want to know what str looks like, why not trying it in the CodePlayground ? str="05"*5 print(str)
28th Jun 2019, 4:24 PM
Cépagrave
Cépagrave - avatar
+ 4
str="05"*5 means print 05 5 times So ans is 0505050505
29th Jun 2019, 3:31 AM
Arun
Arun - avatar
+ 3
"05" is printed 5 times since it is multiplied with 5 Output: 0505050505
28th Jun 2019, 4:37 PM
Nandini
+ 2
Aatif Fraz In Python strings and iterables can be multiplied with natural integers. When you do that, you actually call a function of string or integer class (str*int => string class, int*str => integer class). In Python you can define custom behavior for objects, when they interact with symbols and another object.
30th Jun 2019, 7:55 AM
Seb TheS
Seb TheS - avatar
+ 1
0505050505
28th Jun 2019, 4:34 PM
Rajkumar
Rajkumar - avatar
+ 1
What is the difference between the above answer in-between "05","05","05","05","05" or 0505050505
28th Jun 2019, 5:01 PM
Y.C.B Reddy
Y.C.B Reddy - avatar
+ 1
0505050505 is an integer. "05", "05", "05", "05", "05" is a sequence of string "05"s, can be a tuple or a function feed.
28th Jun 2019, 5:07 PM
Seb TheS
Seb TheS - avatar
+ 1
Which answer I prefer for that question sir
28th Jun 2019, 5:08 PM
Y.C.B Reddy
Y.C.B Reddy - avatar
+ 1
Try ur self ....Print Y.C.B Reddy
28th Jun 2019, 5:09 PM
Rajkumar
Rajkumar - avatar
+ 1
You can use ("05",)*5 to get ("05", "05", "05", "05", "05")
28th Jun 2019, 5:12 PM
Seb TheS
Seb TheS - avatar
+ 1
Shouldn't that result in an error? Isn't str a reserved word which shouldn't be used for variables like, just like int, and all?
30th Jun 2019, 7:14 AM
Aatif Fraz
Aatif Fraz - avatar