Extra credit Extra Credit Assignment Due: 11:00 PM, Saturday, October 16, 2021 Purpose of the assignment Those who did not do well in the examination, I want to give you another chance to improve your...

1 answer below »
All the instructions in the pdf attached


Extra credit Extra Credit Assignment Due: 11:00 PM, Saturday, October 16, 2021 Purpose of the assignment Those who did not do well in the examination, I want to give you another chance to improve your score in exam 1. The highest score you can get is 80% of the exam 1. Hence, those who scored less than 80 in exam 1 should submit this assignment only. Problem 1 Suppose you have a following series: +13 23 + 33 + .... + ?3 Write a function sum_series(n) that takes n as a parameter and returns the summation of the above series. Save the script as series.py Problem 2 Write a function even_digits(n) that returns the number of even digits in a number n. Save the script as digits.py Problem 3 In the practice programs, I have written a function that can calculate lcm(least common multiple) of two numbers. Write a function lcm_three(x,y,z) that returns lcm of three numbers x, y and z. Save the script as lcm.py. Problem 4 Write a function print_stars(n) that prints n stars in a line. For example, if n = 6, it should print ****** Save the script as stars.py Problem 5 Write a function print_star_lines(n) that invokes above print_stars(n) functions and prints n lines of stars with the pattern below. If n is 6, it should print 6 lines of stars like this: ****** ***** **** *** ** * For n = 7, it should print: ******* ****** ***** **** *** ** * Save the script as star_lines.py What to hand in Upon completion of your homework, create a folder by your last name, copy your python scripts inside the folder. Then create a zip file(your_last_name.zip) and upload the zip file in the moodle.
Answered 2 days AfterOct 13, 2021

Answer To: Extra credit Extra Credit Assignment Due: 11:00 PM, Saturday, October 16, 2021 Purpose of the...

Darshan answered on Oct 16 2021
113 Votes
digits.py
#Write a function even_digits(n) that returns the number of even digits in a number n. Sa
ve the script as digits.py
def even_digits(n):
    even_count = 0
    while (n > 0):
        rem = n % 10
        if (rem % 2 == 0):
            even_count += 1
        n = int(n / 10)
    return even_count    
    
    
number = int(input("Please enter n :"))
even = even_digits(int(number))
print( "Even count : " , even)
lcm.py
#In the practice programs, I have written a function that can calculate lcm(least common multiple) of two numbers. Write a function lcm_three(x,y,z) that returns lcm of three numbers x, y and...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here