生信

python 初始第一课笔记

2018-08-20  本文已影响0人  我最有才

Python is the most popular open-source software in the world .When you want to control something ,it is worth your learning. Now let`s go to learn it together.

Firstly,i will introduce a program to you the one i finished it as long as i had learnt the first lecture from the wibsite-class Wangyiyun ,a Chinese website.

1. when we want people press their numbers that they think it so cool num,we can use the function -  input(no matter what you type here ,then when you enter ,the program will remind you to press the numbers that interest you. ) .Just like this:  a=input(),however,when we calculate the b=a*a,we will find it wrong.not will correct the struture of the a with a= int(a),then we can calculate b=a*a,perfect result,yes?

2. When we are intended to make the programs start just like exe in windows,we can use #!/usr/bin/env python3 (notice:it is only used in linux or unix)

The following is my copy programs with some changes there.

a=input("press your wanted numbers")

a=int(a)

b=a*a-a-1

c=a*b

if (a<1):

    print("a<1")

    print(c)

else:

    print("a is not less than 1")

    print(c-a)

print("we are done with the program")

The important is user`s number by themselves and the  loops here.

上一篇 下一篇

猜你喜欢

热点阅读