Python User interaction Program

Source: Internet
Author: User

#进行交互, Row_input is equivalent to input in Python3.
1 username = input ("Username:")2 job = input ("  Your job:")3 age = Int (input ("your Age:"#  string into int
#字符串拼接 ↓
1info =" "2 ------Now--------------3 Name:" "+ Username +" "4 Job:" "+ Job +" "5 " "6 #----------------------7Info_2 =" "8 ------now_2--------------9 name:%s #字符串stringTen job:%s One age:%d #只能是int A " "%(username,job,age) -  -Info_3 =" " the ------Now_3-------------- - Name:{name_1} - job:{job_2} - Age:{age_3} + " ". Format (Name_1=username,job_2=job,age_3=age)#parameters inside {} can be defined by themselves -  + Print(Info,'\ n') A Print(info_2) at Print(Info_3) - #Judging Type - Print(Type (age))

#输出结果

1 USERNAME:GDR2 your job:it3Your age:244 5------Now--------------6 NAME:GDR7 Job:it8  9 Ten  One------Now_2-------------- AName:gdr#Strings String - Job:it -Age:24#can only be int the  -  -------Now_3-------------- - NAME:GDR + Job:it -Age:24 +  A<class 'int'>

Python User interaction Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.