NSCI 580A5 fall 2016

Sidebar

NSCI 580A5

Instructors
Tai Montgomery
Asa Ben-Hur

assignments:2016nsci580a5assignment1

ASSIGNMENT 1

Due date: 9/27/16 by 10 am

Exercise 1

a. Write a script that prompts the user for their name, stores their name as a variable, and prints their name within a greeting - for example, “Hello, Bob!”.

b. Modify the script from 1a to also prompt the user for their birthday and print a welcome message with both their name and their birthday - for example, “Hello, Bob! Your birthday in on 10/31”. Please include the proper spacing and punctuation.

Exercise 2

a. Write a script that prompts the user for a DNA sequence, stores the sequence as a variable, and prints the sequence with the message: “The sequence you entered was: ”.

b. Modify the script in part 2a to accept two separate sequences of DNA from the user, concatenate them into one, and then print the concatenated sequence with a descriptive message.

Exercise 3

a. Write a script that prompts the user for a number and then using an if-else statement, evaluates whether or not the number is less than or equal to 10 (⇐ 10).

b. Modify the script in 3a to include comments indicating what each statement does. Recall that comments are preceded by a #.

Exercise 4

Write a script that prompts the user for the diameter and height of a petri dish and then calculates the volume (V=3.14*h*r^2). You will likely have to convert the volume to a str to avoid an error message from the print function - str(variable).

Exercise 5

Write a script that prompts the user for a number and then determines if it is an even or odd number. Hint: use the remainder operator - %.

To submit your assignment, combine the scripts into one text file with each exercise clearly labeled and upload it to Canvas.