Assignment 1
BUSI 520: Python for Business Research
Jones Graduate School of Business
Rice University
Create a function that takes the lengths of two sides of a right triangle as inputs and returns the length of the hypotenuse.
- Create a list of names. Using list enumeration, print the names in the form
1. Adam 2. Bob 3. ...
- Create a function that takes a list of strings as an input and prints the list as in part (a).
- 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.
Create a list of numbers from 1 to 10.
- Write a loop to print only even numbers from the list.
- Write another loop to calculate and print the factorial of each number in the list.
Write a loop to halve a given number until the result is less than 1.0e-6.
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.
Write a script (.py file) that prompts the user to input
- title
- author
- journal
- volume
- pages
- year
- keyword
- 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},
}