1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Norma-Jean [14]
4 years ago
12

Python1. Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a Stri

ng containing the last character of the value of name. So if the value of name were "Smith" the expression's value would be "h".2. Given a String variable named sentence that has been initialized, write an expression whose value is the number of characters in the Stringreferred to by sentence.3. Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is a String containing the last character of the value of name. So if the value of name were "Smith" the expression's value would be "h".
Computers and Technology
1 answer:
suter [353]4 years ago
3 0

Answer:

Expression for 1st option:

last_character=name[len(name)-1]

print(last_character)

Expression for 2rd option:

length_of_the_string=len(sentence)

print(length_of_the_string)

            or

length=0

for x in sentence:

   length=length+1

print(length)

Expression for 3rd option:

last_character=name[len(name)-1]

print(last_character)

Explanation:

  • The first and the third questions option are same, so the answer to those options are also the same.
  • The len function is used in python which is used to find the length of the string.
  • The user can also find the string length by the help second option which is written in option 2 answers. It uses a for loop which scans the character and counts the length.
  • The len function defines the length and if any user needs to print the last character then he can do it with the help of string size -1.
  • It is because the string is a collection of character array which index starts from 0 and ends in size-1.
You might be interested in
A total stranger is trolling Jack online. He’s offended and annoyed. How can Jack stop the troll in his or her tracks? (5 points
zvonat [6]

Answer:

log off the web page would be the best answer here or explaining why trolling is rude but log off the web page is the best one here

5 0
3 years ago
Read 2 more answers
Suppose you will invest $100 per month at the beginning of the month for 40 years with interest rate
Alexeev081 [22]

Answer:

future value = 232369.1361

return % = 384.10 %

Explanation:

given data

principal = $100 per month

time = 40 year = 480 months

rate = 6.25 % yearly = 0.0625 yearly = 0.005208 monthly

to find out

total amount of capital at the end of your investment and percentage is  your total return

solution

so here future value formula is

future value = P \frac{(1+r)^{t-1}}{r} * (1+r)   ..........1

here r is rate and t is time and P is principal

so put all value

future value = 100 \frac{(1+0.005208)^{480-1}}{0.005208} * (1+0.005208)

future value = 232369.1361

so

Total capital at the end of investment-Total principle invested over the years

232369.1361 - 100 ( 12 × 40 )

184369.1361

so

Return % = \frac{184369.1361}{48000} × 100

return % = 384.10 %

5 0
3 years ago
What is “GoF” and how does it relate to design patterns?
tatuchka [14]

Answer:

GOF refers to the gang of four pattern that are generally consider the basic for all the other patterns. Design pattern are basically provide the solution to the software design to resolve all problems that are associated with the development of real world applications.

GOF Design pattern implemented the parts of the re-usable object oriented software applications. The main aim of design pattern is to pass all the structural design pattern. Design pattern is the most powerful and helpful tool for the software developer and architecture.  

3 0
3 years ago
A _____ is a machine that changes information from one form into another.
gavmur [86]
The answer would be computer
5 0
3 years ago
Paano nakatutulong ang teknolohiyang pangkomunikasyon sa pangangalap ng impormsyon
Makovka662 [10]

Answer:

Yes correct. Absolutely breathtaking. You should create poetry with your writing skills.

6 0
3 years ago
Other questions:
  • Compilers can have a profound impact on the performance of an application. Assume that for a program, compiler A results in a dy
    8·1 answer
  • What problem does chlorofluorocarbon (CFC) create?
    5·1 answer
  • 2 inventions revolutionized photography, what are they?
    10·1 answer
  • What social media category allows users to publish content as posts but restricts the size of the post to a certain numbers of c
    8·1 answer
  • A remediation liaison makes sure all personnel are aware of and comply with an organization's policies.
    9·1 answer
  • The advancements in which of the following technologies has most changed the American job market in recent years?
    15·1 answer
  • What line of code makes the character pointer studentPointer point to the character variable userStudent?char userStudent = 'S';
    5·1 answer
  • Please help!! I dont need the answer i just need explaining on how to do this!!!!
    9·1 answer
  • In which career field, would the computing technology industry Associates CompTIAA+ certification be useful?
    12·1 answer
  • Assuming auto-mdix is not supported, which of these devices would require a crossover cable when connecting to a router? (select
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!