Question

Write a python script that takes a six-digit integer from the user and separate the number...

Write a python script that takes a six-digit integer from the user and separate the number into its
individual digits. You program should then display each digit separated by a comma each.

For example, if the user types in the number 654321, the script should display: 6,5,4,3,2,1

You can assume that the user enters the correct number of digits.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
n = int(input("Enter 6 digit number: "))
res = str(n%10)
n = n // 10
while(n>0):
    rem = n % 10
    res = str(rem)+","+res
    n = n // 10
print(res)

Add a comment
Know the answer?
Add Answer to:
Write a python script that takes a six-digit integer from the user and separate the number...
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
  • Using C# to build this program   Digits of an Integer (Project Name: DigitParser) - Write an...

    Using C# to build this program   Digits of an Integer (Project Name: DigitParser) - Write an app that inputs one number consisting of five digits from the user, separates the number into its individual digits and displays the digits separated from one another by three spaces each. For example, if the user types 42339, the app should display 4 2 3 3 9 Assume that the user enters the correct number of digits. What happens when you execute the app...

  • using c# visual studio 3.28 (Digits of an Integer) Write an app that inputs one number...

    using c# visual studio 3.28 (Digits of an Integer) Write an app that inputs one number consisting of five digits from the user, separates the number into its individual digits and displays the digits separated from one another by three spaces each. For example, if the user types 42339, the app should display 4 2 3 3 9 Assume that the user enters the correct number of digits. What happens when you execute the app and type a number with...

  • Write an application (SpaceDigits) that: (in java) a. inputs one number consisting of five digits from...

    Write an application (SpaceDigits) that: (in java) a. inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print “4 2 3 3 9.” (Hint: The number input is five digits long, dividing it by 10000 gives the leftmost digit. digit1 = number / 10000 ) b. determines...

  • Python: Write a code to ask a number (one digit) from the user and prints the...

    Python: Write a code to ask a number (one digit) from the user and prints the respective row of the multiplication table. For example, if the user enters 5, the following lines will be printed. Note that, if the user enters any number outside the range of 1-9, the program should display an error message. 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25...

  • Write a python program that does the following. a. It asks the user to enter a...

    Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...

  • Python Script format please! 1. Write a script that takes in three integer numbers from the...

    Python Script format please! 1. Write a script that takes in three integer numbers from the user, calculates, and displays the sum, average, product, smallest, and largest of the numbers input. Important things to note: a. You cannot use the min() or max() functions, you must provide the logic yourself b. The calculated average must be displayed as an integer value (ex. If the sum of the three values is 7, the average displayed should be 2, not 2.3333). Example:...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

  • PYTHON: Dice Rolling Write a script that takes input for the number of dice to roll...

    PYTHON: Dice Rolling Write a script that takes input for the number of dice to roll and for the number of sides for the dice. Roll that many n-sided dice and store the values an array. Take the number of sides of the dice and the number of dice as typed inputs from the user. Output should be a comma separated list of the die numbers with no spaces like this: 6,4,1,3,1 Write a script that will simulate the roll...

  • In Python, write a program that asks the user for a positive integer number. If the...

    In Python, write a program that asks the user for a positive integer number. If the user enters anything else, the program would ask the user to re-enter a number or enter -1 to quit. If it is a positive number, the program then prints out a multiplication table that goes up to that number. For example, if the user enters 10, the output would look something like this. https://www.vectorstock.com/royalty-free-vector/multiplication-table-on-white-background-vector-2721686

  • in python only 15. Write a program that reads a five-digit positive integer and breaks it...

    in python only 15. Write a program that reads a five-digit positive integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as 16384

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