I am having trouble understanding why this code isn't working, could someone please help me out?
Matt359 (0)

https://repl.it/@Matt359/My-Quiz I am having trouble understanding why this code isn't working, could someone please help me out?

You are viewing a single comment. View All
ash15khng (471)
print ("Which Spider is The Deadliest?")

print ("Is it option A, The Red Back?, or option B, The Funnel Web?")

if input is 'B' print ("Hi")
if input is 'A' print ("They are both very poisionous that makes them very deadly.")

So first, you have to understand that though Python is quite friendly in terms of syntax, writing proper English sentences doesn't work (lol).

To get input, you use input(), like this:

a = input("text that you want to display")

This sets a to whatever the user typed in.

Comparing for equality works like this:

if a == "hello":
    print("the user typed hello")

This checks if a was "hello", and if it is it runs the print statement.

So your code should be something like this:

print ("Which Spider is The Deadliest?")

d = input("Is it option A, The Red Back?, or option B, The Funnel Web?")

if d == 'B':
    print ("Hi")
if d == 'A':
    print ("They are both very poisionous that makes them very deadly.")
ash15khng (471)

@Matt359 If this helped, please mark it as the answer!