question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m not sure what the expected result was on this one but I don’t think it’s what I’m getting. I tried multiple things until I could get it to work though. However the first one to work doesn’t seem right as it returned

Traceback (most recent call last):
  File "C:/Users/Alexander/PycharmProjects/PythonIntroduction/lesson3/task7/len_function.py", line 6, in <module>
    first_half = int(phrase[:43])
ValueError: invalid literal for int() with base 10: '\nIt is a really long string\ntriple-quoted s'

With the input of

phrase = """
It is a really long string
triple-quoted strings are used
to define multi-line strings
"""
first_half = int(phrase[:43])
print(first_half)

And then passes the lesson.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Michael-Waynecommented, Nov 28, 2016

@shake360

phrase = “”" It is a really long string triple-quoted strings are used to define multi-line strings “”" first_half = phrase[:int(len(phrase)/2)] print(first_half)

This is what you should have

1reaction
lancelotecommented, Nov 8, 2016

@shake360 That’s a correct logic but you forgot to use slicing, for now you store the number 44 in the first_half variable, not a first half of the phrase itself as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

College Readiness Mathematics. Unit 3. Lesson 4
Task #7: Scaling Activity. Look at the two pictures below. The first picture is the Washington Monument in Washington DC. The second is...
Read more >
unit5lesson3task7.pdf - Student Manual Math Ready . Unit 5...
Lesson 3Task #7: Systems of Linear Equations Practice1. An appliance store sells a washer-dryer combination for $1,500. If the washer costs $200 morethan ......
Read more >
College Readiness Mathematics - Georgia Standards
Algebraic Expressions. LESSON 1 OF 7. Task #3: Felicia's Drive. As Felicia gets on the freeway to drive to her cousin's house, she...
Read more >
Bridge to College Mathematics . Unit 1 . Lesson 3 Task #7
Lesson 3. Task #7: A Night Out. (1) A new miniature golf and arcade opened up in town. For convenient ordering, a play...
Read more >
Math Ready . Unit 6 . Lesson 3 - SCHOOLinSITES
Based on our work in this lesson and your work in the linear unit (Unit 3) ... Student Manual. Math Ready . Unit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found