Exam 2- 2012

Split printx1 printx22 g ss sonoma state x

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: : print(s) CS 115 Exam 2, Fall 2012 Page 2 of 7 (e) ss = "Sonoma State" print(ss[3]) (f) ss = "Sonoma State University" x = ss.split() print(x[1]) print(x[2][2]) (g) ss = "Sonoma State" x = ss.lower() (h) ss = "Sonoma State" print(ss[2:5]) CS 115 Exam 2, Fall 2012 Page 3 of 7 Problem 2: 30 points. Write snippets of code to do the following. Your code should only print the requested output. You will lose points for printing additional output. You can assume that all your snippets are enclosed within a main function and that any necessary libraries have been imported. You only need to write the specific lines of code that accomplish each task. Do not use sys.exit() in your solutions to this problem. (a) Ask the user to type a line of text. Print the user’s text in lowercase, with the vowels (“a”, “e”, “i”, “o...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online