Assignment 1
BUSI 520: Python for Business Research
Jones Graduate School of Business
Rice University

  1. Create a function that takes the lengths of two sides of a right triangle as inputs and returns the length of the hypotenuse.

    1. Create a list of names. Using list enumeration, print the names in the form
        1. Adam
        2. Bob
        3. ...
    1. Create a function that takes a list of strings as an input and prints the list as in part (a).
    2. Create a function that takes a list of strings as its input and returns a dictionary with integers 1, 2, … as keys and the strings as values.
  2. Create a list of numbers from 1 to 10.

    1. Write a loop to print only even numbers from the list.
    2. Write another loop to calculate and print the factorial of each number in the list.
  3. Write a loop to halve a given number until the result is less than 1.0e-6.

  4. Create a function is_palindrome to check if a string is a palindrome (reads the same forwards as backwards – e.g., ‘radar’ is a palindrome). The function should return True if the input is a palindrome and False otherwise.

  5. Write a script (.py file) that prompts the user to input

    1. title
    2. author
    3. journal
    4. volume
    5. pages
    6. year
    7. keyword
    8. pathname of a .bib file

    The function should then append a bibtex entry to the end of the .bib file formatted as follows, where the items within braces are the user’s inputs.

    @article{keyword,
    title={title},
    author={author names},
    journal={journal name},
    volume={volume number},
    pages={pages},
    year={year},
    }