6 python Qs

Question 1 .Write python code that accepts a string, input from the user.
The string will be a series of numbers separated by commas (e.g. “24,6,14,66,2”). The numbers will all be integers. Convert the string into a list of numbers (e.g. [24,6,14,66,2]). Print the list.Print each number in the list, followed by the sum of all of the numbers in the list, in the following format: “The sum of 24 + 6 + 14 + 66 + 2 equals 112″.Attach your answer in a python file called question_1.py.

Question 2 .Write the function weather_report() that accepts a temperature in degrees celsius and prints out the temperature in farenheit, along with a phrase.If the temperature in celsius is less than 0 degrees, print ” That’s freezing!”. If the temperature is over 35 celsius print “It’s gonna be hot!”.If the temp is exactly 25 celsius print “Perfect!”. For any other temperature print “Jeans and a shirt will be fine.”. For example, weather_report(25) will print: “77F, Perfect!” Call the function 6 times, with the following values:weather_report(-5)
weather_report(0)
weather_report(12)
weather_report(25)
weather_report(35)
weather_report(40)

3.Write python code that takes the list of numbers created in question one, and removes any numbers that begin with a 3 from the list.Do not create a new list, you must remove the elements from the existing list.Note there will be no 3+ digit numbers (all numbers are between 0 and 99).For example, the list [1,3,5,7,23,33,9] would become [1,5,7,23,9].

4.Write python code that accepts a string, input from the user. The string will be several sentences long, and could contain punctuation including quotation marks, commas, periods or hypthens. There will be no contractions (so no “I’m”, “it’s” etc ).For example:” Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten lore— While I nodded, nearly napping, suddenly there came a tapping, As of some one gently rapping, rapping at my chamber door.” This would be a single string entered by the user (they would hit return only at the end of the whole quote).Convert the single string into a list of strings. Each string in the list will be equal to one word in the sentence. Punctuation should not be preserved, and all the words should be stored in lowercase. A word is defined as a series of one or more characters (a-z or A-Z) separated by spaces or punctuation. In the example above the list would contain [‘once’ ‘upon’ ‘a’ ‘midnight’ ‘dreary ‘while’ etc]Print the list of strings so that each string in the list is printed on a new line. At the end of the list print the total number of strings in the list.

5.Make a Class called Customer. The class will have the attributes first_name, last_name, date_of_birth, and phone_number. Make a method called describe_customer() that prints a summary of the customer information. Make another method called greet_customer() that prints out a welcome greeting (“Hello, “)Create several instances of the class representing different customers, and call both methods for each customer.

6 .Write python code that will print out 3 “X” shapes, next to each other horizontally. The Xs will be built of asterix symbols (the character above the number 8 on the keyboard).The width of the X will be input from the user, and must be a value between 5 and 11. It will also be an odd number (you do not need to control for bad user input).The height of the X shape will be the same as the width, so if the user enters 9, the output will look like this:
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
Note there is one space between each shape.