Answered You can hire a professional tutor to get the answer.

QUESTION

Please I need help with the result of this project copy and paste the sample code below into the Python programming app of your choice, one program

Please I need help with the result of this project

copy and paste the sample code below into the Python programming app of your choice, one program at a time. RUN THE PROGRAM to make sure it's working properly. IF YOU GET AN ERROR, please correct the error and run the program again to make sure it's working properly. NOTE: I ran all these programs successfully in Python 3.6 (32-bit)

Then, for EACH PROGRAM, make the asked-for changes and rerun the program. Correct any errors, so that you can turn in the assignment with no errors thrown.

I need a screen print of each changed program once you have run the program to make certain that it's working. Copy and paste your changed code into text, and submit that document as well. please thank you,

SAMPLE PROGRAMS WITH OUTPUT

********************

1. Need help wrting Python program that prints out the words, with special indentation, of "Twinkle, twinkle, little star".

PROGRAM:

print("Twinkle, twinkle, little star, ntHow I wonder what you are! nttUp above the world so high, nttLike a diamond in the sky. nTwinkle, twinkle, little star, ntHow I wonder what you are!")

OUTPUT:

Twinkle, twinkle, little star,

   How I wonder what you are!

      Up above the world so high,

      Like a diamond in the sky.

Twinkle, twinkle, little star,

   How I wonder what you are!

MAKE THESE CHANGES:

Print out a different (short) poem. Have each line of the poem print individually, but with NO indentation as shown in the OUTPUT above.

********************

2. Need help wrting Python program that displays the current date and time.

PROGRAM:

import datetime

now = datetime.datetime.now()

print ("Current date and time : ")

print (now.strftime("%Y-%m-%d %H:%M:%S"))

OUTPUT:

Current date and time :

2018-01-31 14:23:03

MAKE THESE CHANGES:

Make the above program print out Greenwich Mean Time in addition to what it's already doing.

********************

3.Need help writing Python program to print out a set containing all the colors from a list which are NOT present in another list.

Test Data:

color_list_1 = set(["White", "Black", "Red"])

color_list_2 = set(["Red", "Green"])

Expected Output :

{'Black', 'White'}

PROGRAM:

color_list_1 = set(["White", "Black", "Red"])

color_list_2 = set(["Red", "Green"])

print(color_list_1.difference(color_list_2))

OUTPUT:

{'White', 'Black'}

MAKE THESE CHANGES:

Change the above program to use numbers instead of colors.

********************

4.Need help writing Python program to display your details like name, age, address in three different lines.

PROGRAM:

def personal_details():

   name, age = "Simon", 19

   address = "Bangalore, Karnataka, India"

   print("Name: {}nAge: {}nAddress: {}".format(name, age, address))

personal_details()

OUTPUT:

Name: Simon

Age: 19

Address: Bangalore, Karnataka, India

MAKE THESE CHANGES:

Add details as to where you attended high school and college.

********************

5. Need help writing Python program to compute the future value of a specified principal amount, rate of interest, and a number of years.

Test Data : amt = 10000, int = 3.5, years = 7

Expected Output : 12722.79

PROGRAM:

amt = 10000

int = 3.5

years = 7

future_value = amt*((1+(0.01*int)) ** years)

print(round(future_value,2))

OUTPUT:

12722.79

MAKE THESE CHANGES:

Change the amout, interest rate, and number of years and run the program again.

********************

6. Need help writing Python program to calculate midpoints of a line.

PROGRAM:

print('nCalculate the midpoint of a line :')

x1 = float(input('The value of x (the first endpoint) '))

y1 = float(input('The value of y (the first endpoint) '))

x2 = float(input('The value of x (the first endpoint) '))

y2 = float(input('The value of y (the first endpoint) '))

x_m_point = (x1 + x2)/2

y_m_point = (y1 + y2)/2

print();

print("The midpoint of line is :")

print( "The midpoint's x value is: ",x_m_point)

print( "The midpoint's y value is: ",y_m_point)

print();

SAMPLE OUTPUT:

Calculate the midpoint of a line :                                                                           

The value of x (the first endpoint) 2                                                                        

The value of y (the first endpoint) 2                                                                        

The value of x (the first endpoint) 4                                                                        

The value of y (the first endpoint) 4                                                                        

The midpoint of line is :                                                                                    

The midpoint's x value is: 3.0                                                                              

The midpoint's y value is: 3.0

NO CHANGES HERE.

********************

7. Need help writing Python program to check if a string is numeric.

PROGRAM:

str = 'a123'

#str = '123'

try:

   i = float(str)

except (ValueError, TypeError):

   print('nNot numeric')

print()

OUTPUT:

Not numeric

NO CHANGES HERE.

********************

8. Need help writing Python program to input a number, if it is not a number generate an error message.

PROGRAM:

while True:

   try:

       a = int(input("Input a number: "))

       break

   except ValueError:

       print("nThis is not a number. Try again...")

       print()

POSSIBLE OUTPUT:

Input a number: H

This is not a number. Try again...

Input a number: 3

MAKE THESE CHANGES:

Have a statement print out after a number is entered as well.

********************

9. Need help writing Python program to sum all counts in collections.

PROGRAM:

import collections

num = [2,2,4,6,6,8,6,10,4]

print(sum(collections.Counter(num).values()))

OUTPUT:

9

NO CHANGES HERE.

********************

10. Need help writing Python program to print the calendar of a given month and year. Note: Use 'calendar' module.

PROGRAM:

import calendar

y = int(input("Input the year : "))

m = int(input("Input the month : "))

print(calendar.month(y, m))

SAMPLE OUTPUT:

Input the year : 2018

Input the month : 8

   August 2018

Mo Tu We Th Fr Sa Su

      1 2 3 4 5

 6 7 8 9 10 11 12

13 14 15 16 17 18 19

20 21 22 23 24 25 26

27 28 29 30 31

MAKE THESE CHANGES:

Print out a different month of the year. Then try printing out a group of months - something like 3 calendars, instead of just one, and see what happens.

That's it!

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question