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
kenny6666 [7]
2 years ago
7

Write a program that asks the user how many numbers will be entered and then has the user enter those numbers. When this is done

, report to the user the position of the first 7 entered and the last 7 entered. By position we mean, for example, that if the first 7 is the 2nd number entered then its position would be 2.

Computers and Technology
1 answer:
KATRIN_1 [288]2 years ago
7 0

Answer:

<em>The program written in Python 3 is as follows;</em>

<em>The program does not make use of comments; however, see explanation section for detailed line by line explanation of the program</em>

num = int(input("Number of Inputs: "))

mylist = []

userinput = int(input("Enter a digit: "))

i = 1

while i < num:

     mylist.append(userinput)

     userinput = int(input("Enter a digit: "))

     i += 1

   

try:

     first7 = mylist.index(7)+1

     print('The first position of 7 is ',first7)

     last7 = num - 1 - mylist[::-1].index(7)

     print('The last position of 7 is ',last7)

except:

     print('7 is not on the list')

Explanation:

This line prompts user for the number of inputs

num = int(input("Number of Inputs: "))

This line declares an empty list

mylist = []

This line inputs the first number into the empty list

userinput = int(input("Enter a digit: "))

The italicized lines represent an iteration that allows user to input the numbers into the empty list.

<em>i = 1</em>

<em>while i < num:</em>

<em>      mylist.append(userinput)</em>

<em>      userinput = int(input("Enter a digit: "))</em>

<em>      i += 1</em>

The try-except is used to check the presence of 7 in the list

try:

This checks the first occurrence of 7

     first7 = mylist.index(7)+1

This prints the first occurrence of 7

     print('The first position of 7 is ',first7)

This checks the last occurrence of 7

     last7 = num - 1 - mylist[::-1].index(7)

This prints the last occurrence of 7

     print('The last position of 7 is ',last7)

The following is executed if there's no occurrence of 7

except:

     print('7 is not on the list')

See Attachments for sample runs

You might be interested in
you're troubleshooting an ip addressing issue, and you issue a command to view the system's tcp/ip configuration. the command yo
Leviafan [203]

Based on the above, the operating systems the person is  working on is known to be called Linux.

<h3>What is Linux used for?</h3>

Linux is known to be a kind of an open-source Unix-like operating system that is known to be focused on the Linux kernel, which is said to be a kind of an operating system kernel that was said to have been first released on September 17, 1991.

This was released by a man called by Linus Torvalds. Linux is known to be packaged as a form of Linux distribution. It is said to be used as a Server OS made for web servers, it is also used for database servers, file servers, email servers and others.

Therefore, Based on the the given description above, the operating systems the person is  working on is known to be called Linux.

Learn more about Linux from

brainly.com/question/12853667
#SPJ1

You are troubleshooting an IP addressing issue, and so issue a command to view the TCP/IP configuration of the system. The command you use produces the following output:

fxp0: flags=8843&lt;UP, BROADCAST, RUNNING, SIMPLEX, MULTICAST&gt; mtu 1500

inet6 fe80: :2a0:83ff:fe30:57a%fxp0 prefixlen 64 scopeid 0x1

inet 192.168.1.235 netmask 0xfffffx00 broadcast 255.255.255..255

ether 00:a0:83:30:05:7a

media: Ethernet autoselect (100BaseTX &lt;full-duplex&gt;)

status: active

1o0: flags=8049&lt;UP, LOOPBACK, RUNNING, MULTICAST&gt; mtu 16384

inet6 : : 1prefixlen 128

inet6 fe90: : 1%1o0 prefixlen 64 scopeid 0x7

inet 127.0.0.1 netmask 0xff000000

Which of the following operating systems are you working on?

3 0
1 year ago
File formats are linked to certain programs.<br><br> True<br> False
Lostsunrise [7]
What was the answer?
7 0
3 years ago
Read 2 more answers
(asking again because point-hogs exist)
yawa3891 [41]

The answer is 2-to-the-power-of-n, since for every input, the number of different combinations doubles. From your list I think answer A is meant to indicate 2ⁿ.

6 0
2 years ago
On the CallCenterReport worksheet, add formulas that will summarize the issues for the department entered in cell B3. In cell B6
grin007 [14]

Answer:

In cell B6, formula =INDEX(INDIRECT($B$3),A6)

CallCenter Worksheet Details:

The image of the CallCenter Report worksheet for reference to the question asked is attached below.

Explanation:

Firtsly, an absolute reference in Excel refers to a reference that is "locked" so that rows and columns won't change when copied. To do this,we put a $ dollar sign ( =A$1,) before the row coordinate to lock only the row.

A relative reference in Excel is a cell address without the $ sign in the row and column coordinates example A1.

Having known what absolute and relative reference are, we wlil write the below formula in cell B6 that will later be copied to cell B9:

: =INDEX(INDIRECT($B$3),A6)

5 0
2 years ago
3. How can you correct the color of your photos automatically?​
natita [175]

Answer:

use the lightroom

download the app haha

4 0
3 years ago
Read 2 more answers
Other questions:
  • Match each vocabulary word to its definition.
    8·1 answer
  • Prior to the development of e-commerce, web sites primarily delivered static html pages. true
    11·1 answer
  • I need help making a survey for highschool students in my school any topics/questions?
    9·1 answer
  • Class CTRivers describes collection of CT rivers. It has no data, and it provides the following service methods. None of the met
    13·1 answer
  • A database is used instead of a spreadsheet when?
    7·1 answer
  • Technician A says that front and rear U-joints on a RWD axle should operate at different angles to prevent vibration. Technician
    10·1 answer
  • How does the use of the computer impact businesses
    13·1 answer
  • g 'write a function that takes as input a list and outs a new list containing all elements from the input
    5·1 answer
  • Question 7 (True/False Worth 3 points)
    8·2 answers
  • Python - Write a program to print the multiplication table as shown in the image by using for loops.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!