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
kotykmax [81]
3 years ago
14

Write a loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces. Sample output for

the given program: (must be in python)
90 -> 92 -> 94 -> 95
Note: There is a space after 95.
------------------------------------------------------------------------------------------------------------------------
hourly_temperature = [90, 92, 94, 95]
for temp in hourly_temperature:
for index,temp in enumerate(str(temp)):
if index != len(temp)-1:
print(temp,'->',end=' ')
else:
print(temp, end='')
print('') # print newline
------------------------------------------------------------------------------------------------------------------------
My expected out is:
90 -> 92 -> 94 -> 95
I keep getting:
90 -> 92 -> 94 -> 95 ->
NOTE: I can't edit the last line "print('') #print newline"
Computers and Technology
1 answer:
kaheart [24]3 years ago
4 0

Answer:

Following are the code to this question:

hourly_temperature = [90, 92, 94, 95]#defining a list that holds values

c= 0#defining a variable c

for temp in hourly_temperature:#defining a for loop to count list values

   c+= 1#defining c variable to increment the value of c

   for index,temp1 in enumerate(str(temp)):#defining for loop for spacing the list value

       if index == len(str(temp))-1 and c!= len(hourly_temperature):#defining if block that checks the length of list

           print(temp1,'->',end=' ')#print value

       elif c == len(hourly_temperature) and index == len(str(temp)) - 1:#defining elif block that checks the length of list

           print(temp1, end=' ')#print value

       else:#defining else block

           print(temp1, end='')#print value

Output:

90 -> 92 -> 94 -> 95  

Explanation:

In the above-given code, a list "hourly_temperature" is declared, in which an integer variable c is declared, that holds an integer value that is equal to 0, and two for loop is declared, and in the first loop is used for count list value, and inside the for loop is uses enumerate method to assigns an index for each item and use the conditional statement to check each list value and provide space in each element value.

You might be interested in
A relational database is different from a simple database because it has more than one _____.
arsen [322]

Answer:

A relational database is different from a simple database because it has more than one _____.

The answer to this should be more than one tables

Explanation:

The main difference between simple database and relational database is there data storing technique like simple database store data in the form of files and in relational database for data arrangement tables are used where the header is the name of of attributes/columns and rows contain the values of those attributes. Other difference is that simple database might be single user but relational database is multi user. There are many other difference are also available which make Relational Database the advance version.

I hope it will help you!

5 0
3 years ago
A statement describing both the requirements that must be met by a product or process amd the ways in which satisfaction of the
Lelechka [254]
I will rewrite your question and complete it.

A statement describing both the requirements that must be met by a product or process amd the ways in which satisfaction of the requirements will be measured is called a  ASTM test.

ASTM tests are given to check the requirements and standards on products or system.
5 0
3 years ago
Read 2 more answers
What is the best option for sharing Word documents on a Microsoft network because it provides finer degrees of versioning contro
babymother [125]

Answer:

SharePoint Server

Explanation:

One drive you are not being provided with the opportunities like the versioning, check-outs and content approval. However, through SharePoint Server, you are being leveraged with all these features. Through versioning, you can update the document anytime, and also keep track of previous versions as well as the changes that you are making. Through content approval, you can ensure various members have approved permission privilege with them regarding the publication of the content.

Through checkout and check-ins the users can have control ob the new versions of the document as well as while the check-in the document, they can comment on the changes they have made.

6 0
3 years ago
Write a program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newl
svp [43]

Answer:

I don't know  you should figure that out good luck

Explanation:

good luck

8 0
2 years ago
What is one problem caused by spending too much time studying at your computer? A. It increases stress and negatively affects yo
nignag [31]

Answer:

A - It increases stress and negatively affects your sleep.

Hope that helps. x

4 0
2 years ago
Other questions:
  • What special member function of a class is called whenever an instance of a class is created and initialized?
    15·1 answer
  • While doing research on the Internet, what kind of website should you avoid because the information may be biased? A) .org. B) .
    15·2 answers
  • How do you record yourself on a macbook pro
    9·1 answer
  • ________ allows the computer to get its configuration information from the network instead of the network administrator providin
    5·1 answer
  • Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
    5·1 answer
  • how risk can impact each of the seven domains of a typical IT infrastructure: User, Workstation, Local Area Network (LAN), Local
    7·1 answer
  • ¿Cuál es la función que cumplía los sofistas y Porque eran tan importantes?​
    13·1 answer
  • Which is an example of machine-to-machine communication?
    7·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
  • Edit the following statement so it uses the constant named YEAR:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!