ITM448_WEEK4

docx

School

California State University, Long Beach *

*We aren’t endorsed by this school

Course

4278

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

6

Uploaded by dattnguyenn8196

Report
CHRISTOPHER CONSUL 09/15/2022 ITM 448 18:00-21:00 ITM448 Homework – Week 4 Edit your submission in this word document, attaching the screenshots of the codes used for each question. Include narrative descriptions, outputs screenshot, or short answers when requested. Task 1 Please generate a vector of the following values: 12,32,33,44 and assign this vector to a variable x. Then output the first element and the last element from this vector
Task 2 Following the previous question, please square each number of the vector, and name the new vector “y”.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Task 3 Given the following character vector x = c( "hayward" , "fremont" , "union city" , "san jose" , "castro valley" ), generate another vector named “y” showing the number of characters in each string in x. Your result look like the following:
Task 4 Suppose we have two lists: lst1 = list( c ( 1 , 2 , 3 ), "dog" ), and lst2 = lst( TRUE , NULL , c ( 'good' , 'bad' )) Please concatenate the two lists together and name the new list lst3. Then please describe what is the difference between the following two expressions: (1) lst3[1]; and (2) lst3[[1]]. The difference between the two expressions is that lst3 are the displays the concatenated elements within the single brackets of [] or double brackets [[]]. The single bracket returned a lists of two [[1]] [[1]] because it needs to return the sequential of both [[1]] to get [1] 1 2 3 in order to display the exact name, type, and value of [[1]] . However, with lst3[[1]], it displays only [[1]] [1] 1 2 3 because it returns the exact list since it is the exact name, type, and value .
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help