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
allochka39001 [22]
3 years ago
3

Given a variable t that is associated with a tuple whose elements are numbers, write some statements that use a while loop to co

unt the number of times the first element of the tuple appears in the rest of the tuple, and associate that number with the variable repeats. Thus if the tuple contains (1,6,5,7,1,3,4,1), then repeats would be assigned the value 2 because after the first "1" there are two more "1"s.
Computers and Technology
1 answer:
Nataly [62]3 years ago
5 0

Answer:

The solution code is written in Python:

  1. tuple = (1,6,5,7,1,3,4,1)
  2. repeats = 0
  3. first = tuple[0]
  4. index = 1
  5. while index < len(tuple):
  6.    if(first == tuple[index]):
  7.        repeats += 1
  8.    index = index + 1
  9. print(repeats)

Explanation:

Firstly, we create a tuple that contains (1,6,5,7,1,3,4,1)  (Line 1).

Next, declare a variable, repeats and initialize it with zero (Line 3).

Next, we use index zero to get the first element value from tuple and assign it to variable<em> first </em>(Line 4).  

Then we are ready to use while loop to traverse through the tuple (Line 7). Please note the initial index is set at 1 instead of zero as we want to start from second element of the tuple to find if there is any number is equal to the first element (Line 8). If so, we add one to variable repeats (Line 9).

After completion of loop, we shall get the repeats with value of 2 (Line 13).  

You might be interested in
What software application can be used to send and receive email messaging and management appointments in calendar's
anyanavicka [17]

Answer:

Outlook

Explanation:

3 0
3 years ago
Select the data type for each example below. <br> Possible answers<br> -Int<br> -float <br> -string
Shkiper50 [21]

Answer:

2.5 = float

'2.5' = str

3 = int

Explanation:

The data type: "float" is used for positive or negative decimals.

The data type: "str" is used for a sequence of letters, numbers, or symbols. Since the decimal used apostrophes, this means it's a character literal.

The data type: "int" is used for any positive or negative whole number.

7 0
3 years ago
How do people interact with chromebooks
geniusboy [140]

It is a laptop so they are able to take them with them whit them they are the most potable laptop able over any apple product you can get in the same category

8 0
4 years ago
Read 2 more answers
Seth is considering advertising his business using paid search results.What do you think makes paid search advertising so effect
pychu [463]

You haven't given any statements to choose from, but I can explain why paid search results are effective.

Paid seach results market to consumers that are interested in the product or similar products. These consumers are more likely to buy the product, since they are searching for a similar term. Paid search results can reach many people in very little time, and their resulting marketing benefits are almost instantaneous.

5 0
3 years ago
Read 2 more answers
In DTP, a good rule of thumb is to use as many special effects as you need to make your documents look interesting.
Margarita [4]
It all depends back on who youre present it t

younger ages (Primary-Middle),
Its Ok to use plenty of special effects, but dont ovedue your DTP with effects, so that they still can get the point.

Older ages (High & above)
Older people usually more serious than older ages to pursue their careers, so less effect, more points


5 0
3 years ago
Other questions:
  • Write a program that determines the price of a movie ticket (similar to the one in the chapter). The program asks for the custom
    9·1 answer
  • How do Filament 3D printers build a model?
    8·1 answer
  • Do yall play games..............................................................................................................
    8·2 answers
  • A class of cryptographic algorithms which requires two separate keys, one of which is secret (or private) and one of which is pu
    11·1 answer
  • To give your app users the ability to open your app directly from other apps by clicking a link, you should use:.
    11·1 answer
  • Clasifica los documentos comerciales en activo, pasivo o patrimonial para cada operacion:
    14·1 answer
  • You are going to visit a national park, and have never been there before. You are using a map to try and make the distance trave
    11·1 answer
  • Write a recursive method called, doMyMath, which takes as input any positive integer and calculates the factorial (use comments
    13·1 answer
  • SHORT ANSWERS:
    7·1 answer
  • A pcr-based method to detect a specific pathogen in a specimen works by amplifying a ________ that is specific to the prospected
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!