+ 1
Why can't i get a string n times
I wanted to get math printed n times print("how many math do you want") n=input("enter n") print("math"*n)
7 Answers
+ 3
The second line should be:
n=int(input("Enter n"))
Hope this helps! :)
0
actually u are not taking int input else your code is correct
print("how many math do you want")
n=int(input("enter n"))
print("math"*n)
0
what if I give the input as an integer for n but hasn't declared it as integer
0
it will by default take as string.
0
but the code gave me output as below
>>>n= input("enter n")
enter n5
>>>print(n)
5
>>>print('n')
n
0
n=input("no")
print(n)
z=n*2
print(z)
check this if you put 5 input it should result 10 but in python it results 55 as str is multiple by 2 instead when u use int it will take as an int input.
0
ok, I got it now. Thanks for your clarification.