Code:
def how_elgible(essay):
ans = 0
if len(essay) <= 140:
if '"' in essay:
ans = ans + 1
if ',' in essay:
ans = ans + 1
if '!' in essay:
ans = ans + 1
if '?' in essay:
ans = ans + 1
print ans
else:
print 'Too many characters.'
1.
How
many characters are in this sentence? Does it matter whether Python is storing the string as one byte
per character or four bytes per character?
there are 41 characters. No
it does not matter how many bytes there are per character.
2.
This
question asks you about something you have not learned. In fact, the question
is asking about details that go beyond what you will learn in this course.
However, wondering what is going on at a lower level of abstraction – and
talking about it – can be a useful strategy when learning about computing.
Describe what you
think occurs in memory when the following code is executed.
In []: a = 'one
string'
In []: b = 'another'
In []: c = a[:3] + ' and ' + b
In []:print(c[6:10])
It looks like it will say 'one string
and another' then maybe it will print out the characters of 6 - 10.
No comments:
Post a Comment