1.1) In analogy to the example, write a script that asks users for the temperature in F and prints the temperature in C. (Conversion: Celsius = (F - 32) * 5/9 ) #!/usr/bin/env python # # This program converts temperature from T to C F_temp = input ("Enter a temperature value in F ") C_temp = (F_temp - 32) * 5.0/9.0 print "Temperature:", F_temp, "F = ", C_temp, " C" ---------------------------------------------------------------- 2.1) Write a python script that prints the following figure \ | / @ @ * \"""/ #!/usr/bin/env python # # This program prints a funny face print """ \t\\ | / \t @ @ \t * \t \\\"\"\"/ """ ---------------------------------------------------------------- 3.1) Write a program that asks users for their favourite color. Create the following output (assuming "red" is the chosen color). Use "+" and "*". red red red red red red red red red red red red red red red red red red red red red red red red 1. Version (This is simpler, but only works for three letter words) #!/usr/bin/env python # # Favorite color color = raw_input ("Enter your favorite color ") color1 = (color + " ") * 10 color2 = color + (" " * 8) + " " + color print color1 print color2 print color2 print color1 ---- 2. Version (This version will print a rectangle) #!/usr/bin/env python # # Favorite color color = raw_input ("Enter your favorite color ") color1 = (color + " ") * 10 white_space = " " * len(color) color2 = (color + " ") + ((white_space + " ") * 8) + color print color1 print color2 print color2 print color1 ---------------------------------------------------------------- 4.1) Modify the program so that it answers "That is great!" if the answer was "yes", "That is disappointing" if the answer was "no" and "That is not an answer to my question." otherwise. Use "if ... elif ... else ...". #!/usr/bin/env python # if statement answer = raw_input("Do you like Python? ") if answer == "yes": print "That is great!" elif answer == "no": print "That is disappointing!" else: print "That is not an answer to my question."