I’m having trouble printing a string in lines chat contains 60 characters.
my code is below:
s = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrtsucwxyz'
for i in range(0, len(s), 60):
for k in s[i:i+60]:
print k
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
s[i:i+60]will slice the 60 characters you want into a string. By adding a second for loop, you’re looping over each character in that string and outputting it separately. Just outputs[i:i+60]instead