Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Fundamentals of Programming

Practical Test 1

Questions

1.   Using the terminal, create a PracTest1 directory. (0.5 mark)

2.  In the PracTest1 directory

a.  create a README file using vim. Update for PracTest1.  (0.5 mark)

b.  create a Python file called strings.py using vim. Ask a user to input a string and a character to find in that string. Using for and if statement, display the character and its location. (1.5 marks)

c.  create a Python file called lists.py using vim. In this file, create a list     called fruits” containing the following items: “apple”, “mango” , “cherry” , “banana” , and “ peach” . (0.5 mark)

d.  add a for loop to print out all the items in the fruitslist. (0.5 mark)

e.  create a new list that consists of items in the fruits” list with their first characters removed and print the new list. Your new list should look like ['pple', 'ango', 'herry', 'anana', 'each'].  Use for, append and    slicing.   (1.5 mark)

 

Submission

1.  Marking

Get your work marked by a tutor during the lab class.

 

2.  Submit your work

Zip your PracTest1 directory and upload to Moodle. To create a zip file, go to the directory containing PracTest1 and type the following (replace studentID with your student ID).

zip PracTest1_studentID *