How does hellogwen relate to the original code you

Info icon This preview shows pages 8–9. Sign up to view the full content.

like “Hello(“Gwen”)” to execute it. How does Hello(“Gwen”) relate to the original code you typed and the output you saw when you ran the script? Answer: The function for Hello tells the code to identify the name and place it according to where the %s is written. The function does a search for the name in quotes and makes it when Hello is prompted. So when you write the script Hello (“Jonathan”) the %s is replaced with my name Jonathan.
Image of page 8

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

9 Question 2: When you modified the code, you added an additional parameter – Function (name, age ). How did this change affect what happened with the program? How were the execution and contents of the script different when you added a second parameter? When an additional parameter is added, the function is searching for a second response. The %s is searching for a string, or “name” and %i is for an integer (35). As both inputs are written, Hello(“Jonathan”,35) the function will input Jonathan in the %s and 35 in %i. The final response will be Hello, Jonathan, how is your day going – rumor has it you just turned 35 years old!” 10 Question 3: Why were “%i” and a “%s” in the script? What purpose do you think those two symbols served? Why? The %i and %s are the inputs required for the information within the command prompt. The input %i is searching for an integer and %s is searching for a string entry in the command prompt. If the inputs in the sample script were flipped to Hello (35, Jonathan) the result would be an error of invalid format. 11 Exit R: 1. Execute the following command: q() 2. R will ask you if you want to save your workspace. Answer no.
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern