Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing code
#1
I'm having an issue with trying to get my if statement working. The code works until it reaches the if statement an it
says there is a bad input. I want to be able to put in "Adhesive Vinyl" in the "Choose Material" so it can print out "test", but no matter what I try it still says that there is a bad input.



#Adhesive Vinyl - $8 sft *
#13 Oz. Banner Material - $5 sft
#Poster Paper - $5 sft
#Wall Wrap Vinyl - $12 sft *
#Canvas - $15 sft
#*Lam - $5 sft

Ad = "Adhesive Vinyl"
Oz = "13 oz. Banner Material"
P = "Poster paper"
W = "Wall Wrap Vinyl"
C = "Canvas"

print Ad
print Oz
print P
print W
print C

Variable = input("Choose Material:")
if Variable = "Adhesive Vinyl":
print "test"
Reply
#2
(Apr-12-2018, 05:10 PM)felix62600 Wrote: print C

Variable = input("Choose Material:")

If you're going to insist on using Python 2.x, then you'll need to use raw_input() instead of input(). What used to be input() no longer exists, as it's not safe to use, for roughly the reason you're seeing here.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020