Jan-31-2019, 07:16 AM
Hello, I'm a newbie to CS and Python (i.e., 2 weeks)and have been doing fairly well so far, but I've been having trouble with the following questions. They seem easy enough, but I'm stuck and can't figure it out.
Question #1
Create a list from 0 through 40 and assign that list to the variable numbers1. Then, accumulate the total of the list’s number values and assign that sum to the variable sum1.
Question #2
Count the number of characters in string1. Try not to use (len). Instead, use a Python function. Then save the number in variable numbers1.
These are similar to practice questions in a Coursera course.
Thank you in advance for your help. Answers for these would be great so I can see and learn how to tackle such code.
Question #1
Create a list from 0 through 40 and assign that list to the variable numbers1. Then, accumulate the total of the list’s number values and assign that sum to the variable sum1.
Question #2
Count the number of characters in string1. Try not to use (len). Instead, use a Python function. Then save the number in variable numbers1.
- 1 string1 = "I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living."
These are similar to practice questions in a Coursera course.
Thank you in advance for your help. Answers for these would be great so I can see and learn how to tackle such code.