+ 1

Python Core Project 4

Hi, I'm a student about to go into to college and I wanted to learn a little bit about python before I got into studying for a cybersec major. I don't know if it's because it's around 12am, or because I'm an idiot, but this project has me completely stumped. I found solutions for it all over the internet and I don't want to just copy and paste a solution. I'm making this post to ask, first is this problem actually hard or should I switch out of a comp sci major. Second, how do I do this, without just spoiling the solution pleeeease. All advice and help is very appreciated! Edit: Sorry! I didn't outright post my question. I was just wondering what the process might be or if you had any hints you could give me in order to progress. I don't quite understand how to get the desired output at my level. The question is this: Your given a file containing a list of books and you need to categorize them with the first letter and then the number of integers next to it, so for instance, Harry Potter would be H12. I have no clue how to do this correctly but I'm gonna keep trying. Any help or advice is much appreciated!

9th Jan 2022, 4:51 AM
Quack Duck
4 Antworten
+ 1
and what's the question? I like how you're honest enough not to simply ask for a solution, we don't see that often.
9th Jan 2022, 4:56 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Sorry, but can you please send us the question? Because I have not started python core yet, However, I can give it a try, since I had been with python a little bit before.
9th Jan 2022, 4:59 AM
Krish
Krish - avatar
+ 1
I'm unsure which project is Project 4. None have that number. But I am reasonably sure that it is meant to be easy. The early projects can be solved in one line. Fizz Buzz gets more complicated.
9th Jan 2022, 10:44 PM
Brian
Brian - avatar
0
Quack Duck the updated information helps identify the task as Python Core 51 Book Titles. It can be solved a couple lines using a print statement inside a for/in loop. See the very last example in Lesson 47.1 for a way to iterate through the file line-by-line (i.e., book title-by-book title). Then print the first character with the length of the title. Beware the length might also count trailing spaces and the newline, which you don't want counted in your output number. There is a function that can remove them for you.
23rd Jan 2022, 7:14 AM
Brian
Brian - avatar