Python Programming language
Write the following functions:
I have done the code. Let me know if you have any doubt. def getNumInRange(prompt, min, max): while True: num=int(input(prompt)) if num>=min and num<=max: return num else: print('Number is not in range. Please try again') def calcAvg(values): total=0 count=0 for item in values: total=total+item count=count+1 return total/count def main(): prompt='Enter the number: ' min=1 max=5 num=getNumInRange(prompt, min, max) print(num) values=[1,2,3,4,5] avg=calcAvg(values) print(avg) main()
Python Programming language Write the following functions: getNumInRange(prompt, min, max) - get...
PYTHON PROGRAMMING NEED HELP ASAP You will write an application to manage music collections -- a music collection is a list of albums. The named tuples used for Albums and Songs are defined below, and an example of a music collection is given. (DO NOT HARDCODE THE VALUES FOR MUSIC!) Album = namedtuple('Album', 'id artist title year songs') Song = namedtuple('Song', 'track title length play_count') MUSIC = [ Album("1", "Peter Gabriel", "Up", 2002, [Song(1, "Darkness", 411, 5), Song(2, "Growing Up",...
Please use python 3 programming language Write a function that gets a string representing a file name and a list. The function writes the content of the list to the file. Each item in the list is written on one line. Name the function WriteList. If all goes well the function returns true, otherwise it returns false. Write another function, RandomRange that takes an integer then it returns a list of length n, where n is an integer passed as...
For Python 3.8! Copy and paste the following bolded code into IDLE: movies = [[1939, 'Gone with the Wind', 'drama'], [1943, 'Casablanca', 'drama'], [1965, 'The Sound of Music', 'musical'], [1969, 'Midnight Cowboy', 'drama'], [1972, 'The Godfather', 'drama'], [1973, 'The Sting', 'comedy'], [1977, 'Annie Hall', 'comedy'], [1982, 'Ghandi', 'historical'], [1986, 'Platoon', 'action'], [1990, 'Dances with Wolves', 'western'], [1992, 'Unforgiven', 'western'], [1994, 'Forrest Gump', 'comedy'], [1995, 'Braveheart', 'historical'], [1997,...
Write a program IN PYTHON that checks the spelling of all words in a file. It should read each word of a file and check whether it is contained in a word list. A word list available below, called words.txt. The program should print out all words that it cannot find in the word list. Requirements Your program should implement the follow functions: main() The main function should prompt the user for a path to the dictionary file and a...
In C Programming Language, write a program Character Pointers and Functions. Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count.
In C Programming Language, write a program Character Pointers and Functions. Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count.
PYTHON. Write the following functions without using any predefined functions unless specified. def min (dataList) : #returns the smallest value of the data values in dataList def max (dataList): #returns the largest value def getRange (dataList) def mean (dataList) : #returns the average of data values def median (dataList): #returns the middle value of an ordered list #note: to sort the list first, may use the predefined sort function Then write a test1 function to test the above functions using...
NOTE: LANGUAGE IS PYTHON CS160 Computer Science Lab 17 Objectives Work with dictionaries Work with functions Work with files Overview This lab will have you store the birthdays for a group of people. This program will store the information with the focus on the date of the month and not on the individual. The point of this program is to be able to see who has a birthday on a given day or to create a table of birthdays, in...
NOTE: LANGUAGE IS PYTHON CS160 Computer Science Lab 17 Objectives Work with dictionaries Work with functions Work with files Overview This lab will have you store the birthdays for a group of people. This program will store the information with the focus on the date of the month and not on the individual. The point of this program is to be able to see who has a birthday on a given day or to create a table of birthdays, in...
PROJECT 6 Functions You are to write a PYTHON program which: *Defines the following 4 functions: whoamI() This function prints out your name and lists any programming course you have taken prior to this course. isEven(number) This function accepts one parameter, a number, and prints out a message indicating if the number is even or odd. Keep in mind that a number is even if there is no remainder when the number is divided by two. printEven(number) This function accepts one...