These are the steps given by my professor,:
- Assume user will enter string with at least 1 character
- Store the input as user_input
- Calculate length of user input
- Store this as 'string_length'
- Print message stating whether length is even or odd 6.print "length is" and the length of the string
- Assume user will input either 'h1', 'div' or 'article'
Store this input as variable 'tag'
Calculator half the length of the string_length, rounded down
- Store this value as 'midpoint'
- Calculate a new string that is the first half of 'user_input' using midpoint
Store this as 'first_half'
Calculate a new string that is the concatenation of 'tag' and 'first_half' in the following format first_half
- Store this value in a variable called tagged_input.
Attached is the code I've already run. Everything works fine up until I start with the "tag" variable being defined. So basically around step 9 and onward I have issues.
user_input=input ("Please enter something")
string_length=len(user_input)
even_message= string_length % 2
if even_message>0:
print ("The length is", string_length, "characters long and is
odd.")
else:
print ("Your length is", string_length, "characters long and is
even.")
tag= input("Input one of the following: h1, div or article.")
midpoint = (string_length/2)
first_half= (midpoint)
tagged_input= print ((tag) + (midpoint) + "/" + (tag))
Output should be this. (uploaded a screenshot to imgur)