Overview Write a program that reads an integer from the user and then prints the Hailstone sequence starting from that number "What is the hailstone sequence?" you might ask. Well, there are two rules: • If n is even, then divide it by 2 • If n is odd, then multiply it by 3 and add 1 Continue this sequence until you hit the number 1.​

Overview Write A Program That Reads An Integer From The User And Then Prints The Hailstone Sequence Starting

Answers

Answer 1

n=int(input("Enter number: "))

while n != 1:

   print(n)

   if n%2==0:

       n//= 2

   else:

       n = (n*3)+1

print(n)

I wrote my code in python 3.8. If you want to print the 1, keep the last line of code otherwise delete it.


Related Questions


Can I control my digital footprint?



Answers

Answer:

yes you can

Explanation:

Answer:

Yes you can

Explanation:

1. Enter your name into several search engines.

2. Double check your privacy settings, but don't trust them.

3. Create strong, memorable passwords.

4. Keep all your software up to date.

5. Review your mobile use.

6. Build your reputation through your behavior.

How will you define a text?

Answers

Answer:

Text refers to content rather than form; for example, if you were talking about the text of "Don Quixote," you would be referring to the words in the book, not the physical book itself. Information related to a text, and often printed alongside it—such as an author's name, the publisher, the date of publication, etc.—is known as paratext.

The idea of what constitutes a text has evolved over time. In recent years, the dynamics of technology—especially social media—have expanded the notion of the text to include symbols such as emoticons and emojis. A sociologist studying teenage communication, for example, might refer to texts that combine traditional language and graphic symbols.

Explanation:

I Hope it help

Help me please. I'LL MARK BRAINIEST

Answers

Answer:

A and B

Explanation:

yes

what is two examples of software and hardware?​

Answers

Answer:

Hardware Software

If hardware is damaged, it is replaced with new one. If software is damaged, its backup copy can be reinstalled.

Ex: Keyboard, Mouse, Monitor, Printer, CPU, Hard disk, RAM, ROM etc. Ex: Ms Word, Excel, Power Point, Photoshop, MySQL etc.

Explanation:

Answer:

hardware= key board ,mouse

software =excel,power point.

Other Questions
Find the value of x in the triangle shown below. Chase is making a cake for his daughter's birthday. The normal recipe calls for 8 ounces of butter and 16 ounces of sugar. Chase then decides to make a slightly smaller cake and only use 6 ounces of butter. How many ounces of sugar will he need in his smaller cake? How could a loyalist respond to the Patriots' arguments against British taxation? How can the taxes Britain collects HELP the colonists? What is 83% as a decimal SHOW WORK IF U CAN HELP ASAP!! The speed of the wooden bar is changed so that the bar hits the water fewer times each second. What happens to the frequency of the waves produced?A. IncreasesB. Does not change C. Decreases Analyze the map below and answer the question that follows.A satellite map of the Middle East. A country next to Iran and Turkmenistan is highlighted. A black star marks the capital Kabul.Image courtesy of NASA and the CIA World FactbookThe map above shows the countries of the Middle East. The country of Afghanistan is highlighted; what is its capital?A.BaghdadB.IstanbulC.KabulD.RiyadhPlease select the best answer from the choices providedABCD Which of the following statements is true?OA. Chemical reactions can either absorb thermal energy or release thermal energy.Chemical reactions can only absorb thermal energy.OC.Chemical reactions can neither absorb thermal energy nor release thermal energy.OD.Chemical reactions can only release thermal energy. On January 1, 2012, Sunland Company purchased for $690000, equipment having a useful life of ten years and an estimated salvage value of $40200. Sunland has recorded monthly depreciation of the equipment on the straight-line method. On December 31, 2020, the equipment was sold for $160000. As a result of this sale, Sunland should recognize a gain of in 2001 an outbreak of hoof-and-mouth disease in europe led to the burning of millions of cattle carcasses. discuss the demand and supply implication caused by the outbreak, for an in-depth analysis of the discussion topic you may use all of the resources available to you. what impact would you expect on the supply of cattle hides, hide prices, the supply of leather goods, and the price of leather goods Expanding an EmpireWarm-UpWhy might a country want to increase its power or expand its territory? Check all that apply.to bolster its defensesto restrict its military expensesto limit trade with other nationsto acquire new territory and resourcesto gain access to new economic marketsto spread its values to other parts of the world A flying squirrel's nest is 6 meters high in a tree. From its nest, the flying squirrel glides 8 meters to reach an acorn that is on the ground. How far is the acorn from the base of the tree? If necessary, round to the nearest tenth. is this a real person Corey need a 24 boards that are 47 1/2 inches long A. How many feet a boards should he buy? Explains.B. if you can only buy 8-fot boards, how many should he buy? explain *VIOLINIST* URGENT HELPFill in bubbles with note names (letters)YOU MUST INCLUDE FLATS AND SHARP SIGNS Read these lines from "lf" by Rudyard Kipling. The first three lines are an example of If you can dream - and not make dreams your master; If you can think - and not make thoughts your aim; If you can meet with Triumph and Disaster And treat those two impostors just the same; O dialogue O repetition O stanzas. O onomatopeia which of the following choices is a possible length for DF? 17 39 19 Describe how a business such as a supermarket or a department store uses classification to make it easier for its customers to find a particular type of merchandise. During the early 1900s, Spokane emerged as a leader inshipping and trade.arts and culture.agriculture and industry.fishing and mining. How would you describe yourself in relation to geography? Why did the United States interfere in Iran in the 1950s? What was the result of their interference?