I see 3 issues in your program -
In the for
loop in second line , you have missed closing a bracket - for i in range (len(str):
, it should be - for i in range (len(str)):
There is no casting
in python, to convert input to string, you have use int
function, as int(...)
, so your line (int)(input(...))
should be - int(input(...))
.
In your for loop, you are defining the index as i
, but you are using ch
inside the loop, you should be using i
instead of `ch.
Example -
for i in range (len(str):
if(i==num):
continue
print(str[i],end=' ')
return
The print statement to print items without appending the newline is fine, it should be working.
A working example -
>>> def foo():
... print("Hello",end=" ")
... print("Middle",end=" ")
... print("Bye")
...
>>> foo()
Hello Middle Bye