Given a String variable named sentence that has been initialized, write an expression whose value is the number of characters in the String referred to by sentence.

Answers

Answer 1
Answer:

A String variable named sentence that has been initialized, write an expression whose value is the number of characters in the String referred to by sentence. Python: sentence = “this is the sentence.” size = lens (sentence), C++: string sentence = “this is the sentence.” int size = sentence.

What is python ?

Python is an programming language with the integration of dynamic semantics for web and app development, extremely attractive in the field of Rapid Application Development.

Python is simple in comparison to other language program,  so it’s easy to learn and understand well; it needs a unique syntax which is mainly focus on readability.

Developers can read and translate Python code in a easy way, than other languages and reduces the cost of program maintenance and development.

For more details regarding python, here

brainly.com/question/18502436

#SPJ2

Answer 2
Answer: Python:

sentence = “this is the sentence.”
size = len(sentence)

C++:

string sentence = “this is the sentence.”
int size = sentence.size()

* Remember strings are just arrays of characters.


Related Questions

To return the value of the cell D8, the formula should be OFFSETA1=________.
As sensory input ________, our ability to detect changes in input or intensity ________.
Which is true of diagnosing and troubleshooting? Diagnosing attempts to identify the source of a problem, while troubleshooting looks for the nature of the problem. Diagnosing is used to fix problems with hardware, while troubleshooting is used to fix problems in program code. Diagnosing looks for the nature of the problem, while troubleshooting attempts to identify the source of the problem. Diagnosing is used to fix problems in program code, while troubleshooting is used to fix problems with hardware.
The scope of a variable declared inside of a function is:a) Local - within that functionb) Within that file onlyc) global
Many organizations have policies that require users to: a. retain their passwords for a minimum of 30 days. b. include at least three consecutive letters of part of their name in their passwords. c. change their passwords on a regular basis. d. share their passwords with the administrator.

Python code 100 Random Numbers (twice)python code

instructions:
You need to write code that will print two bricks of numbers, one with integers, one with decimals.

Answers

import random

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.randint(1,100)), end=", ")

   i+=1

print()

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.uniform(1,100)), end=", ")

   i += 1

I hope this helps!

Which quantity measures the rate at which a machine performs work?

Answers

Answer:

The SI unit of energy rate

Explanation:

is the watt, which is a joule per second. Thus, one joule is one watt-second, and 3600 joules equal one watt-hour.

The program that you create for this exercise will begin by reading the cost of a meal ordered at a restaurant from the user. Then your program will compute the tax and tip for the meal. Use your local tax rate when computing the amount of tax owing. Compute the tip as 18 percent of the meal amount (without the tax). The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip. Format the output so that all of the values are displayed using two decimal places.

Answers

The program is a sequential program; as such, it does not require loops or conditional statements.

The program in Python, where comments are used to explain each line is as follows:

#This gets input for the cost of the meal

cost = float(input("Cost: "))

#This initializes the local rate tax to 7.25%

local_rate_tax = 0.0725

#This initializes the tip to 18%

tip = 0.18

#This calculates the tax amount

taxAmount = cost * local_rate_tax

#This calculates the tip amount

tipAmount = cost * tip

#This calculates the grand total

grand = cost + taxAmount + tipAmount

#This prints the tax amount

print("Tax amount: {:.2f}".format(taxAmount))

#This prints the tip amount

print("Tip: {:.2f}".format(tipAmount))

#This prints the grand total

print("Grand total: {:.2f}".format(grand))

All outputs are formatted to 2 decimal places.

See attachment for sample run

Read more about similar programs at:

brainly.com/question/23954622

Answer:

Explanation

If I were calculating a tip at a restaurant using the same syntax, it would have been. meal ... New value of meal is double meal times tax. you're saying: (meal + meal) * tax but meal + meal * tax is calculated in the following order meal + (meal * tax) ... eh? ;) The exercise implied it was just reading the equation from right to left.

When people receive benefits just because they belong to a particular identity group, this is called

Answers

Answer:discrimination

Explanation:

The ____ area on the status bar includes six commands as well as the result of the associated calculation on the right side of the menu.

Answers

Auto Calculate 

The 
Auto Calculate area on the status bar includes six commands as well as the result of the associated calculation on the right side of the menu.

Hope This Helps :)

P.S
If you would make me as brainiest that would be great! :D 

Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per second. The height of the ball after t seconds is

Answers

Answer:

The height of the ball after t seconds is h + vt - 16t 2 feet:

def main():

getInput()

def getInput():

h = int(input("Enter the initial height of the ball: ")) # Adding the int keyword before input() function

v = int(input("Enter the initial velocity of the ball: ")) # Same as above

isValid(h,v)

def isValid(h,v):

if ((h <= 0) or (v <= 0)):

print("Please enter positive values")

getInput()

else:

maxHeight(h,v)

def maxHeight(h,v):

t = (v/32)

maxH = (h + (v*h) - (16*t*t))

print ("\nMax Height of the Ball is: " + str(maxH) + " feet")

ballTime(h, v)

def ballTime(h,v):

t = 0

ballHeight = (h + (v*t) - (16*t*t))

while (ballHeight >= 0):

t += 0.1

ballHeight = (h + (v*t) - (16*t*t))

print ("\nThe ball will hit the ground approximately after " + str(t) + " seconds")

# Driver Code

main()

Answer:

I am writing a python code.

def getInput():

   h = int(input("enter the height: "))

   v = int(input("enter the velocity: "))

   isValid(h,v)    

def isValid(h,v):

   if (h<= 0 or v<=0):

       print("not positive ")            

   else:

       height = maximumHeight(h,v)

       print("maximum height of the ball is", height," ft.")

       balltime = ground_time(h,v)

       print("The ball will hit the ground after", balltime, "s approximately.")

def maximumHeight(h,v):

   t = (v/32)

   maxheight = (h + (v*t) - (16*t*t))

   return maxheight    

def ground_time(h,v):

   t = 0.1

   while(True):

       heightofball = (h + (v*t) - (16*t*t))

       if (heightofball <= 0):

           break

       else:

           t += 0.1  

   return t

Explanation:

There are four functions in this program.

getInput() function is used to take input from the user which is height and velocity. h holds  the value of height and v holds the value of velocity. input() function is used to accept values from the user.

isValid() function is called after the user enters the value of height and velocity. This function first checks if the value of height and velocity is less than 0. If it is true the message not positive is displayed. If its false then maximumHeight() is called which returns the maximum height of the ball and function ground_time() is called to return the time when the ball will hit the ground.

maximumHeight() function first divides the value of velocity with 32 as the ball will reach its maximum  height after v/32 seconds. It then returns the maximum height by using the formula:  heightofball = (h + (v*t) - (16*t*t)).

ground_time() calculates the time the ball takes to reach the ground. There is a while loop to height after every 0.1 second and determine when the height is no longer a positive. It uses (h + (v*t) - (16*t*t)) formula to calculate the height and when the value of height gets less than or equal to 0 the loop terminates otherwise it keeps calculating the height while adding 1 to the value of t at each iteration. After the loop breaks, it returns the value of t.

To see the output of the maximum height and time taken by ball to reach the ground, you can call the getInput() function at the end of the above program as:

getInput()

Output:

enter the height: 9

enter the velocity: 10

maximum height of the ball is 10.6525  ft.

the ball will hit the ground after 1.2 s approximately.