Home > Backend Development > Python Tutorial > python programming quick start example

python programming quick start example

零下一度
Release: 2017-07-03 14:21:08
Original
1506 people have browsed it
def collatz(number):
    while number != 1:
        if number % 2 == 0:
            number = number // 2
            print(number)
        elif number % 2 == 1:
            number = 3 * number + 1
            print(number)

print('Enter number: ')
number = int(input())
collatz(number)
Copy after login
<strong>-------------------------------------------<br></strong>
Copy after login

Enter number:
3
10
5
16
8
4
2
1

Suddenly it feels like there is nothing to comment on Yes, the tips in the book are all mentioned

The Github address of Stepping into the Pit:

I am learning, there is no high-quality code, so take your time.

 <br>
Copy after login

The above is the detailed content of python programming quick start example. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template