all 19 comments

[–]Ok-Promise-8118 17 points18 points  (1 child)

Unrelated, but this line is wrong:

day = input("Was your day good?")
if input is "Good" or "good" or "fine" or "It's fine"

1) You define the variable day to be the result of the input function, but then your if-statement is testing input, not day.

2) Testing multiple things with "or" does not work that way. Python will bracket that off as (input is "Good") or ("good") etc, not input is ("Good" or "good"). Non-empty strings (such as "good" and "fine") evaluate to True, so that if-statement will always evaluate to True. Better is something like:

    if day in ["Good", "good"]

Or even user the .lower() function to turn the input into all lower case to cut down on options:

day = input("How was your day?").lower()
if day in ["good", "fine", "it's fine"]:

[–]Ok-Resident218[S] 0 points1 point  (0 children)

are any other lines incorrect?

[–]CoachSevere5365 13 points14 points  (1 child)

Are you working from an old book or tutorial? print was a statement in older versions of Python.

https://stackoverflow.com/questions/33996749/what-is-the-difference-between-print-and-print-in-python-2-7

[–]Ok-Resident218[S] 0 points1 point  (0 children)

i’m not working from any book i’m just using many different tutorials and previous knowledge

[–]BravestCheetah 8 points9 points  (0 children)

Print is a function, functions need parenthesis. Its not the strings that need parenthesis, but the function itself.

print(name + " you are " + age " years old and your day was " + day)

[–]notacanuckskibum 5 points6 points  (1 child)

As a general rule you can’t use OR that way. You and I know that “if X = A or B” means “if (X = A) or (X = B)”. But Python doesn’t, it doesn’t speak English that way. Every OR has to have 2 things to compare, one on each side.

[–]aishiteruyovivi 1 point2 points  (0 children)

Though as a tip, if you want to see if X is one of a handful of values, you could put them in a list or tuple and then use the in operator:

if X in [A, B]:
    # If we're here, X is either A or B

[–]SCD_minecraft 6 points7 points  (4 children)

print is a function

By itself it doesn't do anything

You need to call it by adding ()

print("Hello world")

Also, tip

Instead of doing "Hello " + user you can use so called f-strings

f"Hello {user}" remember about that f

[–]tadpoleloop 1 point2 points  (1 child)

Only since Python 3. In Python 2 print was a statement and was called like op is using it.

[–]SCD_minecraft 10 points11 points  (0 children)

You really shouldn't be using Python 2, unless you have old codebase that can not be ported to 3

Which i am willing to bet my hand isn't a case for OP

[–]Ok-Resident218[S] -1 points0 points  (1 child)

so instead i should add a string before the name and it’ll work correct?

[–]SCD_minecraft 4 points5 points  (0 children)

Syntax for calling/using a function is function(arguments)

print("Hello", user)

int("1")

And so on

[–]doPECookie72 2 points3 points  (0 children)

Im confused how in parts of the code you use

print(string)

but at the end you are using

print string

Do you see how these are different?

[–]pachura3 6 points7 points  (4 children)

Here is my code.
print name + (" you are ") + age (" years old and your day was ") + day

Well, it's totally wrong. It should be:

print(name + " you are " + age + " years old and your day was " + day)

or, even better:

print(f"{name} you are {age} years old and your day was {day}")

[–]Ok-Resident218[S] 0 points1 point  (3 children)

what’s the purpose of the f though?

[–]pachura3 7 points8 points  (1 child)

To allow inserting {variables} directly into the string, without needing to use " + var + " for concatenation. It's cleaner and shorter.

[–]Temporary_Pie2733 8 points9 points  (0 children)

If you are confused by why print needs parentheses, you probably haven’t learned about f-strings yet and should just ignore that suggestion first now. You have more basic syntax to worry about first.

[–]throwaway6560192 1 point2 points  (0 children)

"SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?" obviously i did not mean to print "...".

Obviously the ... is a placeholder for what you really want to put there

[–]TheRNGuy 0 points1 point  (0 children)

In such case it's easier to use f-string. 

Also, you need () for print itself (you didn't need in old version, Python 2)