hi I have just started learning python and came to question on introduction python it asked me to use the if for the question some how it didn’t do was I ask. I don’t know where I got it wrong. Please help!!
Exercise goal: Practice making choice using if.
We are composing some Tweets for our Twitter followers, but are stuck
on the fact that Twitter messages can’t be more than 140 characters! We
need to only print our messages if they are short enough for Twitter.
So far, we have 3 variables: message1, message2, and message3.
For each of these messages, if the message is less than or equal to 140 characters, print the message; if it is longer than 140 characters, don’t print it.
Add your code below the existing code, starting on line 4.
message1 = “The Analytical Engine weaves algebraic patterns, just as the Jacquard loom weaves flowers and leaves. – Ada Lovelace, the first programmer”
message2 = “Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.”
message3 = “They told me computers could only do arithmetic. – Computer pioneer Grace Hopper”
if (len(message1) <= “140”):
elif (len(message2) <=“140”):
elif (len(message3) <=“140”):
the error message said:
Oops, try again. I didn't see: They told me computers could only do arithmetic. -- Computer pioneer Grace Hopper when I ran your code, but it is less than 140 characters! Double-check your `if` logic and try again.
Please help me out! Thank you!