Computers and Technology, 29.10.2021 07:00 queenkimm26
I am new to programming, and I have made this function using Python that prompts the user to enter two numbers; the output will be read the starting number counting up to the last number. I have got this much done, but I would also like it to count down if the starting number is larger than the previous number. So, for example, if the numbers entered are 2 and 8, the output will be 2 3 4 5 6 7 8. If the user enters the opposite, 8 to start and 2 for last, the output should be 8 7 6 5 4 3 2. I have tried using if statements, but I have not been successful; I can only seem to get the function to count up never down.
def main():
start = int(input( "Start? "))
last = int(input( "End? " ))
x = 0
for x in range(start, last + 1):
print(x, end = " ")
main()
Answers: 2
Computers and Technology, 22.06.2019 17:30
Where would you click to edit the chart data?
Answers: 1
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
Computers and Technology, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
I am new to programming, and I have made this function using Python that prompts the user to enter t...
Advanced Placement (AP), 08.11.2020 02:00
History, 08.11.2020 02:00
English, 08.11.2020 02:00
Mathematics, 08.11.2020 02:00
Mathematics, 08.11.2020 02:00
English, 08.11.2020 02:00
English, 08.11.2020 02:00
Health, 08.11.2020 02:10
Mathematics, 08.11.2020 02:10
English, 08.11.2020 02:10
Mathematics, 08.11.2020 02:10
Business, 08.11.2020 02:10