After working with a girlfriend to learn Python3, code is she knocked, a little spicy eyes, only for reference.
1. Title: Enter "name", output "Hello, name"
For instructions on installing and opening the Python shell, refer to this: http://www.jb51.net/article/129327.htm
Steps:
File>new file Enter the following code
Python3 Code:
Name = Input ("Enter your Name:") print ("Hello,", name)
Results:
2. Play a word game and guess the height.
Python3 Code:
Print ("......") I love Willie ... ') tall = input ("You know how Tall Willie is:") guess = Int (tall) #将tall强制转型赋值给guessif guess = = 190: #判断 Print ("Your sister, it all knows!") ") Print (" bingo!! Guess right, you're awesome! Else:print ("Really stupid, don't want to play with you, Goodbye.") ") Print (" Granville is the best!!! ")
Results:
3. Built-in functions
Python3 view statements for built-in functions:
Dir (__builtins__)
If you want to know the specific function and usage description of a function, say int, use the following statement:
Help (int) #help加内置函数名称, you can find out the function and usage.
Original link: http://www.jb51.net/article/129453.htm
Python3 (b) simple input and output and built-in function view