Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

einhan

What does 'can't assign to literal' error mean? I did: '3 + 3' = 'six' print ('3 + 3') It gives me that error. I intended to get 'six' printed out, since I intended to assign 'six' to '3 + 3'

  • one year ago
  • one year ago

  • This Question is Closed
  1. Shadowys
    Best Response
    You've already chosen the best response.
    Medals 0

    you cannot assign a string to another string '3+3' is an illegal name because there's numbers and operators only

    • one year ago
  2. ParthKohli
    Best Response
    You've already chosen the best response.
    Medals 0

    ``` var x = "y" ``` The above is the standard format for assignment.

    • one year ago
  3. ParthKohli
    Best Response
    You've already chosen the best response.
    Medals 0

    Note that it is not this: ``` var "x" = "y" ```

    • one year ago
  4. MicroBot
    Best Response
    You've already chosen the best response.
    Medals 1

    on the left side u have to have a variable name to assign to a string ,a number,or an other variable that has to be on the right side. so if u wanted to call your variable something like 3+3 it cant be a string ,and u cant start the variable name with a number or have an operator in it. Instead you could call it threeplusthree or threeplus3. so: threeplus3='six' should do it. :) Check this for further info: (1.6.1. Literals and Identifiers) http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/variables.html

    • one year ago
  5. shawnf
    Best Response
    You've already chosen the best response.
    Medals 0

    you are trying to assign a value to another value you can only assign a value to a variable

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.