+ 2

How to make a program that prints the first half of what you input?

For example, you input "python' and it prints out "pyt". I have made one but it prints the letters out on new lines. x = input(":") y = int(len(x)/2) i = 0 while i < y: print(x[i]) i += 1

2nd Feb 2017, 4:45 PM
chunngai chan
chunngai chan - avatar
2 Respostas
+ 5
print(x[i], end = "")
2nd Feb 2017, 5:08 PM
Kawaii
Kawaii - avatar
+ 3
x = input() print(x[0:int(len(x)/2)]) And.. ya.. it is your programm Use slices:)
2nd Feb 2017, 7:18 PM
Leshark
Leshark - avatar