write a program using integers user_num and x as input, and output user_num divided by x three times.
James
Guys, does anyone know the answer?
get write a program using integers user_num and x as input, and output user_num divided by x three times. from EN Bilgi.
python
Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250 Note: In Python 3, integer divis...
Write a program using integers user_num and x as input, and output user_num divided by x three times
Ask Question
Asked 1 year, 9 months ago
Modified 1 month ago
Viewed 21k times -1
Write a program using integers user_num and x as input, and output user_num divided by x three times.
Ex: If the input is: 2000 2 Then the output is: 1000 500 250
Note: In Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded).
Here is my code that I have:
user_num = int(input())
x = int(input()) for i in range(3): user_num/= x
print (int(user_num), end=' ')
I just need to add a end line with the output comes up with 250.
python Share
edited Jan 10, 2021 at 20:33
Trenton McKinney 44.9k27 27 gold badges 112 112 silver badges 116 116 bronze badges
asked Oct 1, 2020 at 14:02
Adam Dickenson 111 1 gold badge 2 2 silver badges 4 4 bronze badges
Please read meta.stackoverflow.com/questions/285551/… –
Thierry Lathuille
Oct 1, 2020 at 14:04
What is the question? –
jakub
Oct 1, 2020 at 14:06
Add a comment
5 Answers
5 Answers Introducing: Trending sort
You can now choose to sort by Trending, which boosts votes that have happened recently, helping to surface more up-to-date answers.
Trending is based off of the highest score sort and falls back to it if no posts are trending.
0
it's shockingly much simpler than y'all are making it. The program wants a straight forward answer.
user_num = int(input())
x = int(input())
print (user_num // x , user_num // x // x , user_num // x// x // x)
Share
answered Jan 11, 2021 at 6:56
ACouture 11 Add a comment 0
This is in C but you can see the logic.
#includeint main(void) { int userNum; int x; int ans1; int ans2; int ans3;
scanf("%d", &userNum);
scanf("%d", &x); ans1 = userNum/x; ans2 = ans1/x; ans3 = ans2/x;
printf("%d %d %d\n", ans1, ans2, ans3);
return 0; } Share
answered Oct 5, 2021 at 18:18
Elenie 111 1 bronze badge Add a comment 0
''' Type your code here. '''
user_num = int(input())
x = int (input()) i = 0 while i <= 2 : if i <= 1: user_num //= x
print(user_num, end= " ")
i += 1 elif i == 2: user_num //= x print(user_num) i += 1 Share
answered May 26 at 1:27
user19202665 1
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. –
JayPeerachai May 26 at 3:08 Add a comment -2
This should work just fine
user_num = int(input())
x = int(input()) results = [] for i in range(3): user_num/= x
results.append(str(int(user_num)))
print(' '.join(results))
Share
edited Oct 1, 2020 at 14:18
answered Oct 1, 2020 at 14:05
Goldwave 5422 2 silver badges 11 11 bronze badges 1
The second one worked and didn't have a unneeded space at the end the first one had in unneeded space at the end. –
Adam Dickenson
Oct 1, 2020 at 14:11
Add a comment -2
user_num = int(input())
x = int(input())
user_num1 = user_num // x
user_num2 = user_num1 // x
user_num3 = user_num2 // x
print(user_num1, user_num2, user_num3)
Share
edited Jan 10, 2021 at 17:20
Adrian Mole 43.4k113 113 gold badges 45 45 silver badges 72 72 bronze badges
answered Jan 10, 2021 at 17:09
jdoyle603 1 1
Please include a description along with your code, rather than just posting code. –
Shane Bishop
Jan 10, 2021 at 17:48
Add a comment
Not the answer you're looking for? Browse other questions tagged python or ask your own question.
The Overflow Blog
Exploring the interesting and strange results from our 2022 Developer Survey...
Seeing is believing: The Stack Overflow Podcast now available as video
Featured on Meta
Testing new traffic management tool
Duplicated votes are being cleaned up
Trending: A new answer sorting option
Updated button styling for vote arrows: currently in A/B testing
12 people chatting Python
49 mins ago - Karl Knechtel
Related
721
Speed comparison with Project Euler: C vs Python vs Erlang vs Haskell
0
Python program prompts user to enter number until they enter 0, then program adds even and odd integers
2
How can I delete integers from list (of integers and strings) by taking which value to delete from user input?
0
I can't see what's wrong with my code. I can't write a simple calculator
0
ValueError Exception
0
Python exception handler not working and I can't see why
Solved USE PYTHON. Make sure answer is not in decimal. Just
Answer to Solved USE PYTHON. Make sure answer is not in decimal. Just
© 2003-2022 Chegg Inc. All rights reserved.
Answered: Write a program using integers user_num…
Solution for Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output…
Skip to main content
Start your trial now! First week only $4.99!
Literature guidesConcept explainersWriting guidePopular textbooksPopular high school textbooksPopular Q&ABusinessAccountingEconomicsFinanceLeadershipManagementMarketingOperations ManagementEngineeringBioengineeringChemical EngineeringCivil EngineeringComputer EngineeringComputer ScienceElectrical EngineeringMechanical EngineeringLanguageSpanishMathAdvanced MathAlgebraCalculusGeometryProbabilityStatisticsTrigonometryScienceAdvanced PhysicsAnatomy and PhysiologyBiochemistryBiologyChemistryEarth ScienceHealth & NutritionNursingPhysicsSocial ScienceAnthropologyGeographyHistoryPolitical SciencePsychologySociology
Engineering
Computer Engineering
Q&A Library
Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250
Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250
Question
Transcribed Image Text:Home B Announcements - IT-140-J61 x zy Section 1.21 - IT 140: Introdu zy Section 1.3 - IT 140: Introduct X b Answered: Run the program + Ô https://learn.zybooks.com/zybook/SNHUIT140V3/chapter/1/section/21 = zyBooks My library > IT 140: Introduction to Scripting v3 home > 1.21: LAB: Divide by x E zyBooks catalog 2 Help/FAQ 8 Jose Roque 1.21 LAB: Divide by x Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250 Note: In Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded). 247772.2002516.qx3zqy7 LAB 1.21.1: LAB: Divide by x 0/ 10 АCTIVITY main.py Load default template.. 1 user_num - int(input ()) 2 3 x = int(input()) 5 for_in range (3): 6 7 user_num = user_num//x 2:16 AM P Type here to search A 83°F AQI 175 7/5/2021 近
Expert Solution
Want to see the full answer?
Check out a sample Q&A here
SEE SOLUTION
Students who’ve seen this question also like:
Computer Networking: A Top-Down Approach (7th Edition)
Computer Networks And The Internet. R1RQ
Want to see this answer and more?
Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*
*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Related Computer Engineering Q&A
Find answers to questions asked by students like you.
Q: Write a program using integers user_num and x as input, and output user_num divided by x three…
A: user_num = int(input())x = int(input()) for i in range(3): user_num = user_num // x…
Q: Write a program using integers user_num and x as input, and output user_num divided by x three…
A: Program code: if __name__ == '__main__': #get user inputs user_num = int(input()) x =…
Q: In Python: Write a program using integers user_num and x as input, and output user_num divided by x…
A: Program: #main function if __name__ == '__main__': #get user inputs user_num, x =…
Q: Write a program using integers userNum and divNum as input, and output userNum divided by divNum…
A: As per the given question, we have to input two numbers from user and display the result of division…
Q: Write a program using integers user_num and x as input, and output user_num divided by x three…
A: According to the Question below the Solution: Program Output:
Q: Write a program using integers user_num and x as input, and output user_num divided by x three…
A: Answer: Program in Python3 user_num = int(input()) x = int(input()) for i in range(3):…
Q: Write a program using integers userNum and divNum as input, and output userNum divided by divNum…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time…
A: age_years = float(input('Enter your age in years:\n')) weight_lbs = float(input('Enter your weight…
Q: Write a program using integers userNum and x as input, and output userNum divided by x three times.
A: #include<stdio.h> int main() { int userNum, x; scanf("%d",…
Q: Write a program that takes two integer numbers from user N and x, then calculate the following sum:…
A: Here is Your Code n = int(input("Please Enter a Number N "))x = int(input("Please Enter a Number x…
Q: Write a simple LMC (little man computer) program that requests the user to input3 numbers (say, A,…
A: 1. input first number 2. store in first using sta 3. input second number using inp 4. add it to…
Q: Write a program that calculates the change due a customer by denomination; that is, how many…
A: Answer is given below .
Q: python Write a program with total change amount as an integer input, and output the change using…
A: Step 1: Accept Amount Step 2: Convert dollar to cents Step 3: Convert dollar from cents Step 4: Get…
Guys, does anyone know the answer?