Enable contrast version

Tutor profile: Sarah G.

Sarah G.
BA in political science with a passion for sustainability and data

Questions

Subject: Python Programming

TutorMe
Question:

Write a code snippet that prompts the user for a number and then calculates the factorial of that number. Include error-checking so that the user cannot enter a negative number.

Sarah G.
Answer:

run = 1 while run==1: print("Please enter a value to find the factorial of, ex. 7") num = int(input()) if num< 0: print("This is not a valid input, please enter a positive number.") elif num == 0: print("The factorial of this number is 0") run= run + 1 else: factorial = 1 for F in range(1,num+1): factorial= factorial * F print("The factorial of this number is",factorial) run = run+1 This simple program has a while loop and a series of if/else/elif statements to take user input and then check if it fits the specified parameters. The inclusion of error checking helps make this a successful program as it anticipates error on the part of the user and avoids returning the wrong factorial. The for loop at the bottom also illustrates the "in range" syntax that python uses.

Subject: Writing

TutorMe
Question:

Do you need 5 paragraphs in an essay? What are the structural elements you need to include in a good essay?

Sarah G.
Answer:

In my opinion there is no one formula for the perfect essay. Instead, the form of your essay should easily flow from your arguments and what you want to highlight. So, there is no need to adhere to a 5 paragraph structure. However, the basic organizational principles behind a 5 paragraph essay can help guide you in your writing. It is important to include both an introduction and conclusion to make your key points clear to your reader and allow them to effectively follow your argument in the body of your essay. For longer works I also recommend using section headings to clearly delineate the different aspects of your argument. When in doubt, make sure that your logic is as easy to follow as possible!

Subject: C Programming

TutorMe
Question:

Write the code to cycle through and print out an array of integers a[N] (array "a' with length = N) using pointers rather than indices.

Sarah G.
Answer:

for (int *p = a; p < a+N; p++){ // cycles through the array with pointers printf("%d ", *p); // prints the integer at that spot in memory, %d tells the computer to interpret the data as an int. } Here, *p is the pointer that we use to cycle through the array. This code takes advantage of the fact that C stores arrays in consecutive spaces in memory. What we are doing here is moving through those slots in memory rather than moving through the indices of the array as we might do in other languages.

FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by GoGuardian
Copyright © 2022. Zorro Holdco, LLC doing business as TutorMe.
All Rights Reserved.
High Contrast Mode
On
Off