help plz
Icekit (62)

I need help with if satements.

You are viewing a single comment. View All
Answered by BlueComet (116) [earned 5 cycles]
View Answer
ChezCoder (1497)

this is the basic structure of an if loop:

if CONDITION:
    # some code...

Example:

if 1 == 1: # if 1 is equal to 1
    print("1 is equal to 1!") # print this.
Icekit (62)

not a loop. i need it so when the things says "do you buy this item" and someone puts yes it says that you now have $5. and if not then it says you did not buy the [email protected]

ChezCoder (1497)

@Icekit yes, you would use an if loop:

if item = "yes":
    print("You now have $5")
else:
    print("You didn't buy the item")