Define function which takes a decimal number as an input

Assignment Help Python Programming
Reference no: EM132313648

Introduction to Programming Assignment -

Purpose of the assessment (with ULO Mapping) - Assess student's ability to analyse programming problems and design and implement solutions as part of a developer team.

Assignment Specifications -

Purpose: This assignment evaluates your understanding of basic programming principles using Python programming language. In particular, this assignment assesses your ability to develop algorithms to solve simple problems, successfully develop and run python programs, and your ability to write meaningful comments when required. The assignment also provides a platform for students to work together in groups to develop solutions, which resembles how complex programming problems are solved in real-life.

1. Write a program named unique.py. The program takes as an input a text file. Your program should print all the unique words in the file in alphabetical order.

2. Write a program named frequency.py. The program takes as an input a text file. Your program should print all the unique words in the file and their frequencies in alphabetical order.

3. Define a function conversion.py which takes a decimal number as an input, and returns its representation in a given base as a string (i.e. binary, octal, or hexadecimal string). The function uses a look-up table (dictionary) to map decimal integers to digits in the targeted base. For your convenience, the look-up table is provided below. A main function with test statements are also provided. Hint: figure out how base 10 can be converted to other bases, then write the algorithm.

lookUp = {0 : '0', 1 : '1', 2 : '2', 3 : '3', 4 :'4', 5 : '5', 6 : '6', 7 : '7', 8 : '8', 9 : '9', 10 : 'A', 11 : 'B', 12 : 'C', 13 : 'D', 14 : 'E', 15 : 'F'}

def main():

"""Tests the function."""

print(decimalToRep(10, 10))

print(decimalToRep(10, 8))

print(decimalToRep(10, 2))

print(decimalToRep(10, 16))

# The entry point for program execution

if __name__ == "__main__":

main()

4. A list is said to be sorted ascendingly if it is either empty or if each item (except the last one) is less than or equal to the item prior to it. Define a function sorted.py which takes a list as an input and returns True if the list is sorted and False otherwise.

5. Define a function myRange.py, which behaves like the standard range function in python and takes both required and optional arguments. Do not use the standard Python's range function in your solution. You need to develop your own range function. Read Python's help on the standard range function to understand its arguments. Assign None as a default value for the two optional arguments. If the two optional arguments equal None, that means the range function has been called with just the stop value. If only the third argument equals None, this means the function has been called with both, the start and stop values. Therefore, the first part of your code determines what the parameters are while the rest of the code uses these parameters to build-up a list by counting up or down.

Reference no: EM132313648

Questions Cloud

Discussion on television and society : How would you compare movies with TV shows in terms of their influence over our society? Summarize the textbook discussion on "television and society"
Describe the components of competitive strategy : The 3 components of competitive strategy are focus, cost leadership and differentiation. Within competitive strategy the relevance of a value change framework.
How you would integrating the elements of engagement : Students will develop a three to four (3-4) page proposal for integrating the elements of engagement into the implementation process.
Establish metrics to measure attainment of each of the goals : Establish metrics to measure attainment of each of the goals. Evaluate how the strategy will address each issue identified in the scenario.
Define function which takes a decimal number as an input : HOLMES INSTITUTE - HS1031 Introduction to Programming Assignment - Define a function conversion.py which takes a decimal number as an input
How could you use technology to show negative aspects of job : Your objective is to give a balanced picture of the job so that applicants will better understand what they will be asked to do. Job duties, schedules.
Why is evaluating training an important part : Why is evaluating training an important part of strategic training? Instructions: You must have a minimum of two academically reviewed journal articles sourced.
Write about your rhetorical situation : write about your rhetorical situation. What brings you to this issue? Why do you think it is important to study? What do you see as its academic relevance?
Explain three or four job components in the job description : Explain three or four job components in the job description and specifications for the job. Explain what will be included in the compensation and benefits.

Reviews

len2313648

5/29/2019 9:21:51 PM

Submission Guidelines - There are five questions in this assignment which require you to write and submit five Python scripts. Similar to what you did in assignment I, please save each script in two different formats: .py and .txt prior to submission. For example, for the first question you need to submit unique.py and unique.txt. Code must be appropriately commented. Make sure to add comments at each segment of your code to explain what it does. You are allowed to use built-in library functions or methods if required. Make sure that your code runs successfully for all possible entries. Try to approach the solution with the least number of steps. Your code must be clear, logical, and easy to understand.

len2313648

5/29/2019 9:21:46 PM

All work must be submitted to Blackboard by the due date. You are encouraged to avoid last minute submission so that you do not run into technical problems. You can only submit once. Thus, ensure that your work is final prior to submission. This is a group project. Please make sure to divide tasks equally among the group. Group members need to collaborate to make sure that all programs run successfully and are appropriately commented. Marking criteria - Appropriate commenting 5%, Sound logic 5%, Code running successfully 5% and TOTAL Weight 15%.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd