Below is the script I'm trying to write. I've made other working scripts, including simple if-statement scripts, but I wanted to experiment a bit and try making a script that relies on string inputs instead of integers or floaters.
It goes without saying that I'm still learning and won't require this to do my job, but thanks for trying if you decide to take a crack at it. I spent about an hour with another novice coder trying out tiny adjustments. I'm almost certain it's futile to have the input equal a string to start with, creating my strife.
answer = raw_input("Do you enjoy your work?\n")
print str(answer)
if answer = str("yes") :
print "I'm happy to hear that, " + str(name)"
print "I wonder what being a " + str(title) + " actually means."
print "I don't have the term in my vocabulary. I'm a machine."
raw_input("My script is over soon. Goodbye.\n")
else :
print "I'm sorry to hear that, " + str(name)"
print "I guess being a " + str(title) + " must be difficult."
raw_input("My script is over soon. Goodbye.\n")
raw_input
returns a string already, so you don't have to convert it to string again. No need str("yes")
this.
Also your intention is wrong. It must be;
if answer == "yes":
Your whole script must be like;
from time import sleep
answer = raw_input("Do you enjoy your work?\n")
print answer
if answer == "yes":
print "I'm happy to hear that, " + name)"
print "I wonder what being a " + title + " actually means."
print "I don't have the term in my vocabulary. I'm a machine."
print ("My script is over soon. Goodbye.\n")
sleep(2)
else :
print "I'm sorry to hear that, " + name"
print "I guess being a " + title + " must be difficult."
print ("My script is over soon. Goodbye.\n")
sleep(2)
Used sleep
function from time
module. So it'll wait which seconds do you want as you see it's 2 seconds now sleep(2)
Also you can use format()
function to place like;
print "I'm sorry to hear that {} ".format(name)
It's my favorite function since it's pretty usefull, check it here