Question

Write a program that reads a series of numbers from standard input and prints a list containing those numbers. A sentinel valSolve only with python please and show a little bit of explanation thank you so i can understand, i will thumbs up if correct :)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

# Python code

number = 0
my_list = []
while number != -999:
    number = int(input("Enter a number: "))
    if number != -999:
        my_list.append(number)

print(my_list)

#output

Enter a number: -998 Enter a number: 999 Enter a number: -999 [-998, 999]

//If you need any help regarding this solution....... please leave a comment...... thanks

Add a comment
Know the answer?
Add Answer to:
Solve only with python please and show a little bit of explanation thank you so i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please could you also do a little bit of explanation of how you did it please...

    please could you also do a little bit of explanation of how you did it please thank you Write a program that reads a series of numbers from standard input and prints a list containing those numbers. A sentinel value of -999 will indicate the end of the input values. Do not append the sentinel value onto the list. For example: Input Result 1 -999 Enter a number: 1 Enter a number: -999 [1] -99 999 -999 Enter a number:...

  • please solve using python thank you! Write a program which prompts the user to enter a...

    please solve using python thank you! Write a program which prompts the user to enter a number of rows, and prints a hollow square star pattern with 2 diagonals. Note: you can assume that the integer will always be > 1 and will be an odd number. For example: Input Result 5 Enter number of rows: 5 ***** ** ** * * * ** ** ***** 9 Enter number of rows: 9 ** ** ** * * * * *...

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • urgent Help needed in python program ! Thanx # This is a function definition. You can...

    urgent Help needed in python program ! Thanx # This is a function definition. You can ignore this for now. def parse_integer_list_from_string(string): """ Returns a list of integers from a string containing integers separated by spaces. """ # Split the line into a list of strings, each containing a number. number_string_list = string.split() # Create an empty list to store the numbers as integers. numbers = [] # Convert each string to an integer and add it to the list...

  • This is in python. I need to print out a specific message depending on the number...

    This is in python. I need to print out a specific message depending on the number that's input. for example, if the user inputs 1, program should print out "hello". if the user inputs 2, program should print out "hi". But also the program should keep asking for a number to be input after a valid number is input. For example, user inputs 1, program prints out "hello" and then asks the user to input another value. but also the...

  • Please be detailed in your explanation. Thank You! 28. To detect input bit pattern 110 with...

    Please be detailed in your explanation. Thank You! 28. To detect input bit pattern 110 with a Moore type FSM, total number of states needed IS (a) 3 [to (c) 5 (d) 6 29, How to reach the final state of getting "1 10% from input? (a) Previous state of getting "11", input 0 (b) Previous state of getting "1 1", input 1 (c) Previous state of getting "10", input 0 (d) Previous state of getting "10", input 1

  • Here is what i have so far... However i am having a little bit of trouble...

    Here is what i have so far... However i am having a little bit of trouble with it. when inputting a number the sum comes out perfect but when i break the digits up i cant do mmore than 4 digits and i cant do a negitive number... someone help. QUESTION: Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits. For example,...

  • PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK...

    PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK YOU! Bonus Question Implement an efficient algorithm (Python code) for finding the 11th largest element in a list of size n. Assume that n will be greater than 11. det find 11th largest numberlissy Given, lissy, a list of n integers, the above function will return the 11th largest integer from lissy You can assume that length of lissy will be greater than 11....

  • Please and thank you 2) (5 pts) Arrays & Vectors: write a program which prompts the...

    Please and thank you 2) (5 pts) Arrays & Vectors: write a program which prompts the user to enter numbers (terminated with a non-numeric), reads them simultaneously into an array of doubles and into a vector of doubles, then prints A) the array elements in the original order B) the vector elements in reverse order C) the average of the vector elements D) the largest of the vector elements Example program output, user input shown underlined Enter a list of...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT