Please write a program which asks the user to type in an upper limit. The program then prints out numbers so that each subsequent number is the previous one doubled, starting from the number 1. That is, the program prints out powers of two in order. The execution of the program finishes when the next number to be printed would be greater than the limit set by the user. No numbers greater than the limit should be printed. Upper limit: 8 1 2 4 8 Upper limit: 20 1 2 4 8 16 Upper limit: 100 1 2 4 8 16 32 64 1 Sample output # Write your solution here Sample output Please don't use the value True as the condition of your while loop in this exercise! What are powers of two? The first power of two is the number 1. The next one is 1 times 2, which is 2. The next is 2 times 2, which is 4. The next is 4 times 2, which is 8, and so forth. Each power in the sequence is multiplied by two to produce the next one. Sample output

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Can you use Python programming language to wirte this  code?

Thank you very much!

Please write a program which asks the user to type in an upper limit. The program
then prints out numbers so that each subsequent number is the previous one
doubled, starting from the number 1. That is, the program prints out powers of two in
order.
The execution of the program finishes when the next number to be printed would be
greater than the limit set by the user. No numbers greater than the limit should be
printed.
Upper limit: 8
1
2
4
Upper limit: 20
5246
8
16
Upper limit: 100
1
2
4
8
16
32
64
1
Sample output
# Write your solution here
Sample output
Please don't use the value True as the condition of your while loop in this exercise!
What are powers of two? The first power of two is the number 1. The next one is 1
times 2, which is 2. The next is 2 times 2, which is 4. The next is 4 times 2, which is 8,
and so forth. Each power in the sequence is multiplied by two to produce the next
one.
Sample output
Transcribed Image Text:Please write a program which asks the user to type in an upper limit. The program then prints out numbers so that each subsequent number is the previous one doubled, starting from the number 1. That is, the program prints out powers of two in order. The execution of the program finishes when the next number to be printed would be greater than the limit set by the user. No numbers greater than the limit should be printed. Upper limit: 8 1 2 4 Upper limit: 20 5246 8 16 Upper limit: 100 1 2 4 8 16 32 64 1 Sample output # Write your solution here Sample output Please don't use the value True as the condition of your while loop in this exercise! What are powers of two? The first power of two is the number 1. The next one is 1 times 2, which is 2. The next is 2 times 2, which is 4. The next is 4 times 2, which is 8, and so forth. Each power in the sequence is multiplied by two to produce the next one. Sample output
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY