Good morning <proper name>!
This will be a/an <adjective1> <noun1>! Are you <verb1> forward to it?
You will <verb2> a lot of <noun2> and feel <emotion1> when you do.
If you do not, you will <verb3> this <noun3>.
This <season> was <adjective2>. Were you <emotion2> when <team_name> won
the <noun4>?
Have a/an <adjective3> day!
#Prepare variablesproper_name=""adjective1=""noun1=""verb1=""verb2=""noun2=""emotion1=""verb3=""noun3=""season=""adjective2=""emotion2=""team_name=""noun4=""adjective3=""template="""
Good morning <proper name>!
This will be a/an <adjective1> <noun1>! Are you <verb1> forward to it?
You will <verb2> a lot of <noun2> and feel <emotion1> when you do.
If you do not, you will <verb3> this <noun3>.
This <season> was <adjective2>. Were you <emotion2> when <team_name> won
the <noun4>?
Have a/an <adjective3> day!"""output=""#Get user's inputprint("Let's play Mad Libs for Homework 1")print("Type one word responses to the following:\n")proper_name=input("proper_name ==> ").strip()print(proper_name)adjective1=input("adjective ==> ").strip()print(adjective1)noun1=input("noun ==> ").strip()print(noun1)verb1=input("verb ==> ").strip()print(verb1)verb2=input("verb ==> ").strip()print(verb2)noun2=input("noun ==> ").strip()print(noun2)emotion1=input("emotion ==> ").strip()print(emotion1)verb3=input("verb ==> ").strip()print(verb3)noun3=input("noun ==> ").strip()print(noun3)season=input("season ==> ").strip()print(season)adjective2=input("adjective ==> ").strip()print(adjective2)emotion2=input("emotion ==> ").strip()print(emotion2)team_name=input("team-name ==> ").strip()print(team_name)noun4=input("noun ==> ").strip()print(noun4)adjective3=input("adjective ==> ").strip()print(adjective3)#Construct the Mad Liboutput=template.replace("<proper name>",proper_name)output=output.replace("<adjective1>",adjective1)output=output.replace("<noun1>",noun1)output=output.replace("<verb1>",verb1)output=output.replace("<verb2>",verb2)output=output.replace("<noun2>",noun2)output=output.replace("<emotion1>",emotion1)output=output.replace("<verb3>",verb3)output=output.replace("<noun3>",noun3)output=output.replace("<season>",season)output=output.replace("<adjective2>",adjective2)output=output.replace("<emotion2>",emotion2)output=output.replace("<team_name>",team_name)output=output.replace("<noun4>",noun4)output=output.replace("<adjective3>",adjective3)#Print the Mad Libprint("\nHere is your Mad Lib...")print(output,end="")
#Perpare Variablesminutes=00seconds=00miles=00.00target_miles=00.00pace_seconds_per_mile=00.00pace_seconds=00pace_minutes=00speed_mph=00.00target_time_total_seconds=00.00target_time_seconds=00target_time_minutes=00#Get User Inputminutes=str(input("Minutes ==> "))print(minutes)seconds=str(input("Seconds ==> "))print(seconds)miles=str(input("Miles ==> "))print(miles)target_miles=str(input("Target Miles ==> "))print(target_miles)#Calculate Pacepace_seconds_per_mile=(int(minutes)*60+int(seconds))/float(miles)pace_seconds=int(pace_seconds_per_mile%60)pace_minutes=int(pace_seconds_per_mile//60)#Calculate Speedspeed_mph=float(miles)/(int(minutes)/60+int(seconds)/3600)#Calculate Target Timetarget_time_total_seconds=float(target_miles)*pace_seconds_per_miletarget_time_seconds=int(target_time_total_seconds%60)target_time_minutes=int(target_time_total_seconds//60)#Print Resultsprint("\nPace is "+str(pace_minutes)+" minutes and "+str(pace_seconds)+" seconds per mile.")print("Speed is {0:.2f} miles per hour.".format(float(speed_mph)))print("Time to run the target distance of {0:.2f} miles is {1} minutes and {2} seconds.".format(float(target_miles),int(target_time_minutes),int(target_time_seconds)),end="")
#Prepare Variablesframe_character=""height=0width=0free_space=0.0#Get user inputframe_character=input("Enter frame character ==> ").strip()print(frame_character)height=int(input("Height of box ==> ").strip())print(height)width=int(input("Width of box ==> ").strip())print(width,"\n")#Calculate dimensions linedimensions=str(width)+"x"+str(height)free_space=width-2-len(dimensions)#Calculate the left and right padding considering odd/even widthleft_space=free_space//2right_space=free_space//2+(free_space%2)#Prepare rowstop_bottom_row=frame_character*widthempty_row=frame_character+" "*(width-2)+frame_characterdimension_row=frame_character+" "*left_space+dimensions+" "*right_space+frame_character#Calculate the number of rows before and after the dimensions rowbefore_rows=((height-2)//2)-((height-1)%2)after_rows=height-3-before_rows#Output boxprint("Box:")print(top_bottom_row)print((empty_row+'\n')*before_rows,end="")print(dimension_row)print((empty_row+'\n')*after_rows,end="")print(top_bottom_row)