CSE 1310 - Assignments - Programming Assignment 5

The assignments will be graded out of 100 points. Create a text document entitled answers.xxx (where you replace xxx with whatever extension is appropriate, depending on the file format you use). Acceptable file formats are plain text, Word document, OpenOffice document, and PDF. Put your name and UTA ID at the top. Your answers that are not part of a program will be added to this file. Each task below will instruct you where to put your answers.


Task 1 (10 pts.)

What does this function do? Do not simply give the output from running it with a sample string, but try to figure out what its purpose is. Your answer should be understandable by someone who does not know any programming.

def function1(s):
    s = s.lower()
    vowels = 'aeiou'
    for x in s:
        if x in vowels:
            return x
    return None

How does this function differ? What does it do? Again, Your answer should be understandable by someone who does not know any programming.

def function2(s):
    s = s.lower()
    vowels = 'aeiou'
    for x in s:
        if x in vowels:
            return True
    return False

Put your answer in answers.xxx.


Task 2 (10 pts.)

Write a function named compute_differences(n1, n2, n3) that:

For example:

Save the function in file task2_functions.py, and code testing your function in file task2_main.py.


Task 3 (20 pts.)

Write a function named list_powers(n1, n2) that:

For example:

Save the function in file task3_functions.py, and code testing your function in file task3_main.py.


Task 4 (10 pts.)

Write a function named foo(num) that:

For example:

Save the function in file task4_functions.py, and code testing your function in file task4_main.py.


Task 5 (10 pts.)

Write a function named foo(num) that:

For example:

Save the function in file task5_functions.py, and code testing your function in file task5_main.py.


Task 6 (40 pts.)

In this task, you will implement some functions that can help decide if a string is a float number, and can be safely converted to such a number using the float function.

Part a (10 points). Implement a function check_float_chars with the following specifications:

For example:

Save the function in file task6a_functions.py, and code testing your function in file task6a_main.py.

Part b (10 points). Implement a function check_dots with the following specifications:

For example:

Save the function in file task6b_functions.py, and code testing your function in file task6b_main.py.

Part c (10 points). Implement a function check_spaces with the following specifications:

For example:

Save the function in file task6c_functions.py, and code testing your function in file task6c_main.py.

Part d (10 points). Implement a function check_float with the following specifications:

For example:

Save the function in file task6d_functions.py, and code testing your function in file task6d_main.py.


Suggestions

Pay close attention to all specifications on this page, including file names and submission format. Even in cases where the program works correctly, points will be taken off for non-compliance with the instructions given on this page (such as wrong file names, wrong compression format for the submitted code, and so on). The reason is that non-compliance with the instructions makes the grading process significantly (and unnecessarily) more time consuming. Contact the instructor or TA if you have any questions.

How to submit

The assignment should be submitted via Blackboard. Submit a ZIPPED directory called assignment4.zip (no other forms of compression accepted, contact the instructor or TA if you do not know how to produce .zip files). The zipped directory should contain your answers.xxx document and all the Python code files (task5.py, task6.py, etc).

Submission checklist