#Python Beginner needs help

1 messages · Page 1 of 1 (latest)

vagrant sluice
#

For background, I'm coming from coding in scratch. :p (Gotta start somewhere)
Here is the buggy script:
user_input = input("What operation would you like to do? (Options: + - * /) : ")
x = user_input
if x == "+" or "-" or "*" or "*" or "/":
print("Valid Syntax")
else:
print("Invalid Syntax")

Oh, and the issue is that it keeps giving the if statement as true

#

By the way, I'm starting out by trying to see if i can get the program to know what symbols are allowed if you can't tell

#

And my first project is a calculator

#

in the console

#

Python Beginner needs help

hard harbor
#

For the record:

deep mesaBOT
#

Use codeblocks to send code in a message!

To make a codeblock, surround your code with ```
To use C# syntax highlighting add cs after the three back ticks.

For example:
```cs
Console.WriteLine("Hello World");
```

Produces:

Console.WriteLine("Hello World");

To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.

hard harbor
#

You highlighting every line, and spacing it all out, is so incredibly pointless

vagrant sluice
versed hound
#

So :
if x == "+" or x == "-" or …)