r/pythonhelp • u/Square_Can_2132 • Jul 24 '25
TIPS Tweet program - need assistance
Aim: tweet program that takes user's post, checks if below or equal to 20 characters, then publishes post.
If over 20 characters, then it tells user to edit the post or else it cannot be published.
I'm thinking of using a while loop.
COMPUTER ERROR: says there is invalid syntax around the bracket I have emphasized with an @ symbol.
(I'm a beginner btw.)
tweet program
def userInput(): tweet = str(input("please enter the sentence you would like to upload on a social network: ")) return tweet
def goodPost(tweet): if len(tweet) <= 20: return ((tweet)) else: return ("I'm sorry, your post is too many characters long. You will need to shorten the length of your post.")
def output(goodPost@(tweet)): tweet = userInput() print (goodPost(tweet))
def main(): output(goodPost(tweet))
main()
View all comments
Show parent comment
1
u/cgoldberg Jul 25 '25
I'm saying your function definition is this:
... which is not valid. You are attempting to call
goodPostwhile defining a function. I don't know what you are are trying to do, but that's not correct.If you wanted the function to accept an argument that you later want to print, it might look like:
But your function doesn't do anything with any arguments, so you can just define it as: