0% found this document useful (0 votes)
22 views1 page

PHY105: Assignment 1: Instructor: Tobias Toll

This document provides instructions for Assignment 1 in PHY105. Students are asked to submit Python programs for 3 problems by July 28 via email to 2 instructors. File names should follow a specific naming convention of [student_name]_assignment1_prob[number].py. The problems include: 1) Creating and printing a tuple with name, DOB, place of birth data, 2) A program to determine if a user-input string is shorter, longer or 10 characters using if statements, and 3) Modifying a list by adding elements to the beginning and end, finding an index, reversing the list, and removing elements less than 1.

Uploaded by

pranav1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

PHY105: Assignment 1: Instructor: Tobias Toll

This document provides instructions for Assignment 1 in PHY105. Students are asked to submit Python programs for 3 problems by July 28 via email to 2 instructors. File names should follow a specific naming convention of [student_name]_assignment1_prob[number].py. The problems include: 1) Creating and printing a tuple with name, DOB, place of birth data, 2) A program to determine if a user-input string is shorter, longer or 10 characters using if statements, and 3) Modifying a list by adding elements to the beginning and end, finding an index, reversing the list, and removing elements less than 1.

Uploaded by

pranav1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PHY105: Assignment 1

Instructor: Tobias Toll


July 26
Submit programs files (soft copies) by Friday July 28,
via email to [email protected], and [email protected]
Create programs using Python 3.x using any editor e.g. Spyder.
Name your files thus: (your-name)_assignment(number)_prob(number).py.
Example: Sushmita will save her assignment 1, problem 2, as
Sushmita_assigment1_prob2.py

Submit the assignments over email to Dwaipaian: [email protected] and [email protected]

1. As we have seen in class, a list is a mutable object, meaning that we can change its elements and
even the number of elements in the list. A tuple is similar to a list, but it is immutable, meaning that
once it has been defined it cannot be changed. A tuple is defined with round brackets () instead of the
square brackets [] of the list. Can you think of a reason for why we want objects to be immutable?
Write a program which uses a 'tuple' to create a data base of your name, date of birth, and place of
birth, and then prints them one by one. (Feel free to make things up.)
2. Write a program which determines whether a string is shorter, longer or precisely 10 characters using
if statements. Let the program ask for user input for the string.
3. In the list [-1.0, 0.5, -0.5, 1.0] add 0.0 to the beginning and -2.0 to the end. Find the
index (i.e. its number in the list) of -0.5, reverse the list and remove all numbers which are less than
one. Hint: do dir(list) to find out about the functions available to list. The function comes after your
list: your_list.function(arguments). Also, have a look at this page:
https://www.tutorialspoint.com/python/python_lists.htm

You might also like