Since I’ pretty bad at this and I’m pretty sure I’m just being really dumb I can’t find/understand what’s wrong with my code here for just some practice for what I want to try making.
Here is my code so far:
text = ‘hi!’
if text = ‘hi’ print(‘Hello friend!’)
else:
print ‘Who are you?’
if text = 'hi'
has two problems, after the if condition there should be colon, just like else. but for if
, it should be placed after the condition, not the if
keyword
also, a single equal sign means assign value to variable, which for a condition isn’t great, use two equal signs to see if text
variable equals 'hi'
string
I fixed it. I think you needed two equal signs in the (if text == “hi”)
text = “hi!”
if text == “hi”:
print(“Hello friend!”)
else:
print (“Who are you?”)