Python Forum
Python, breaking words
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python, breaking words
#1
Hello,

I just started learning python and i got an assignment, if I pass it I automatically pass the whole semester Smile

So what i have to do is make a program that would automatically break the line once it reaches the end.
Example:

This is an exam-
ple of what i mu-
st do.

Problem is I have no idea where to start nor can I find any related tutorials, so any tips or links to a tutorial would be more than helpful.
Reply
#2
You should start here: https://docs.python.org/3/tutorial/intro...ml#strings

Then move onto here: https://docs.python.org/3/library/stdtyp...ng-methods
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
WoW that looks so much more advanced then where we are in class, I am screwed haha
Reply
#4
It is simple string manipulation. Yes, the links I provided contain a lot of information, but not all of it is relative to your problem. You need to scan the items and decide which might help and then try it. 

One other thing, your "description" of the problem does not fit with the example output.  You need to define what constitutes the  need to break the line, for instance, is it a certain number of characters? 

It will involve a little reading and some trial and error coding, but if it were too easy, I'm sure your instructors would not have made the offer they did.

We are glad to help and provide advise, but we will not write the code for you. You need to show you are making an effort.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#5
Well said sir!
And i do like a challenge.

About description, basically words have to be separated between
syllables on the end of the line and separated with (-).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  One of my exercises is breaking my balls. Jei 14 13,549 Dec-03-2016, 03:35 PM
Last Post: Jei

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020