Day2_Language Elements

"""
使用变量保存数据并进行算术运算
Author:黄骏捷
Date:2019-09-28
"""

a=123
b=321
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a//b)
print(a%b)
print(a**b)
print('-------------------------')

"""
使用type()检查变量的类型
"""
c=12.345
k=1+5j
d='hello,world'
e=True
print(type(a))
print(type(c))
print(type(k))
print(type(d))
print(type(e))
print('-------------------------')

"""
使用input()函数获取键盘输入(字符串)
使用int()函数讲输入的字符串转换成整数
使用print()函数输出带占位符的字符串
"""
a = int(input('a = '))
b = int(input('b = '))
#print(a+b)
print('%d + %d = %d' % (a,b,a+b))
print('%d + %d = %f' % (a,b,a/b))
print('------------------------------')
"""
Example 1:华氏温度转换成摄氏温度
公式:$C=(F-32)\div 1.8$
"""
f = float(input('请输入华氏温度: '))
c = (f-32)/1.8
print('%.1f 华氏度 = %.1f摄氏度' %(f,c))
print('------------------------------')
"""
Example 2:根据半径计算周长和面积
"""
import math
radius = float(input('请输入圆的半径: '))
perimeter = 2*math.pi*radius
area = math.pi*radius**2
print('周长:%.2f    面积:%.2f' %(perimeter,area))
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Are you aware that C Programming is one of the most popular and most commonly used programming languages today? Did you know many expert developers have started with learning C in order to become knowledgeable in computer programming? Were you aware that grade schools and high schools have begun implementing C Programming in their curriculum's? Are you wanting a simple way to understand a step by step action to learning C Programming? While skipping all the technical jargon so many learners fear in programming? If you are having doubts learning the language, do not! C is actually easy to learn. Compared to C++, C is much simpler! You do not need to spend years to become a master of this language. Well start right here! Learn the coding necessary in less than a day, become profound and knowledgeable to move up the ladder to becoming a proficient programmer! It start right now and by the time you finish and implement the steps here, you will have learned everything there is to know in less than a day! Steps covered to become proficient in C Programming include... The basics of c programming With Thousands Of C Code Drills. Learn to create a program to interact with the user Learn to create a program to think and perform specific functions. Building programs to run efficiently with looping Much more programming tips! Table of Contents Chapter 1. Preface – Page-6, || Introduction to C. Chapter 2. Elements of C Programming Language. Chapter 3. Control statements (conditions). Chapter 4. Control statements (Looping). Chapter 5. One dimensional Array. Chapter 6. Multi-Dimensional Array. Chapter 7. String (Character Array). Chapter 8. Your Brain on Functions. Chapter 9. Your Brain on Pointers. Chapter 10. Structure, Union, Enum, Bit Fields, Typedef. Chapter 11. Console Input and Output. Chapter 12. File Handling In C. Chapter 13. Miscellaneous Topics. Chapter 14. Storage Class. Chapter 15. Algorithms. Chapter 16. Unsolved Practical Problems. Chapter 17. PART-II-
Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day, Covers HTML5, CSS3, and jQuery 7th Series: Sams Teach Yourself Paperback: 768 pages Publisher: Sams Publishing; 7 edition (January 10, 2016) Language: English ISBN-10: 0672336235 ISBN-13: 978-0672336232 Thoroughly revised and updated with examples rewritten to conform to HTML5, CSS3, and contemporary web development practices, this easy-to-understand, step-by-step tutorial helps you quickly master the basics of HTML and CSS before moving on to more advanced topics such as graphics, video, and interactivity with JavaScript and jQuery. In just one hour a day, you’ll learn the skills you need to design, create, and maintain a professional-looking website. No previous experience required. By following each short, one-hour lesson in this book, anyone can learn the basics of web development. Learn at your own pace. You can work through each lesson sequentially to make sure you thoroughly understand all the concepts and methodologies, or you can focus on specific lessons to learn the techniques that interest you most. Test your knowledge. Each lesson ends with a Workshop section filled with questions, answers, and exercises for further study. Learn how to... Fully implement the HTML5 and CSS3 standards Work with text and create links Add images and graphics to your page Use CSS to style a site and position elements on a page Structure a page with HTML5 Use responsive web design to make your pages look good on different-sized screens Use JavaScript to add dynamic elements and interactivity on your pages Leverage jQuery to add JavaScript features to your pages Design for the mobile web Get your site online and let people know it’s there Optimize your site for search engines
This book is a complete reference to the C programming language and the C runtime library. As an “In a Nutshell” book, its purpose is to serve as a convenient, reliable companion for C programmers in their day-to-day work. It describes all the elements of the language and illustrates their use with numerous examples. The present description of the C language is based on the 2011 international C standard, ISO/IEC 9899:2011, widely known as C11. This standard supersedes the C99 standard, ISO/IEC 9899:1999, and its Technical Corrigenda, TC1 of 2001, TC2 of 2004, and TC3 of 2007. The first international C standard, ISO/IEC 9899:1990, was published in 1990 and supplemented in 1995 by Normative Addendum 1 (ISO/IEC 9899/AMD1:1995). The 1990 ISO/IEC standard corresponds to the ANSI standard X3.159, which was ratified in late 1989 and is commonly called ANSI C or C89. The new features of the 2011 C standard are not yet fully supported by all compilers and standard library implementations. In this book, we have therefore labeled 2011 features—such as multithreading, type-generic macros, and new standard library functions—with the abbreviation C11. Extensions that were introduced by the C99 standard are labeled with the abbreviation C99. This book is not an introduction to programming in C. Although it covers the fundamentals of the language, it is not organized or written as a tutorial. If you are new to C, we assume that you have read at least one of the many introductory books, or that you are familiar with a related language, such as Java or C++.
1.XML 1.1. 概念:XML(eXtensible Markup Language),是一种可扩展的标记语言 1.2. 作用: XML是跨平台和跨语言的 不同的语言都支持XML解析(将XML转换为对应语言中的数据) 1. 数据交换格式(一般不用了,用json代替了) 2. 配置文件都使用XML格式,框架都是用xml和Properties作为配置文件。 1.3. 使用:(掌握) 语法: <?xml version="1.0" encoding="UTF-8"?> <!--注释快捷键:ctrl + shift + / --> <!-- 第一行,必须有。定义XML的版本和字符集 --> <!-- XML中的注释 --> XML的语法格式: 第一行用了定义xml文件的,写版本号和字符集 1.注释不能放到第一行 1.必需有声明,声明必需在第一行。 2.文档声明的字符编码必需和文档本身的编码一致 2.标签不能交叉嵌套使用(标签名字随便定义) 1. 双标签 : <双标签></双标签>一般是有下一级的 2. 单标签 :<单标签/> 如果没有下一级,就可以用单标签 3.有开始有结束 4.不数字开头,只能以字母或下划线开头; 5.只能有一个根标签;表示不能再有其他平级标签 6.严格区分大小写 7.一个标签不能有两个相同属性(属性名随便定义) 属性直接写在头标签内,格式:属性名="属性值" 8.特殊符号需要转义 或者可以放到CDATA区 <![CDATA[这里写特殊符号]]> html特殊符号,转义符号 9.编码格式统一: 1.开发环境:项目环境、系统环境 2.当前文件内encoding字符集 10.不能以xml(或者XML,Xml等)开头W3C保留日后使用; 例如:最好不要使用 <xml:xx></xml: xx>W3C保留以后在使用 11.名称字符之间不能有空格或者制表符; 例如<四川 省> 12.名称字符之间不能使用冒号;<xml:xx></xml: xx> 注意: 1.Xml中空格和换行都表示数据,严格区分大小写 1.4 XML约束:(了解) 1. 概念:就是限制一个XML文件中标签和属性等的使用,只能按照某种规则书写 便于其他程序员学习。 2. 作用: 1. 代码校验 2. 代码提示 3. 利于达成共识形成规范 3. 约束分类: 1. DTD约束:Document Type Definition文档类型定义 例如: <!ELEMENT contacts (linkman+)> <!ELEMENT linkman (name,email,address,group)> <!ELEMENT name (#PCDATA)> <!ELEMENT email (#PCDATA)> <!ELEMENT address (#PCDATA)> <!ELEMENT group (#PCDATA)> 2. schema约束:xml Schema Definition xsd文件 例如: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://itsource.cn" elementFormDefault="qualified"> <xs:element name="contacts"> <xs:complexType> <xs:sequence maxOccurs='unbounded'> <xs:element name="linkman"> <xs:complexType> <xs:sequence> <xs:element name='name' type='xs:string' /> <xs:element name='email' type='xs:string' /> <xs:element name='address' type='xs:string' /> <xs:element name='group' type='xs:string' /> </xs:sequence> <xs:attribute name="id" type="xs:long" use="required"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 1.5. XML解析(最重要) DOM: 文档对象模型 将一个XML(html)文档 的每一个元素解析成java中的一个一个的对象 D Document 文档(XML文档) : 磁盘上面的xml文件 O Object 对象(Java对象) : 把xml文件封装成Java对象 M Model 模型 解析过程中用到的类: Document Node(节点) Element (元素) Attribute(属性) - Attr Text(文本) dom4j解析: 支持xpath解析,就可以可以直接输入一个路径查找: 由于DOM4J在解析XML时只能一层一层解析,所以当XML文件层数过多时使用会很不方便, 结合XPATH就可以直接获取到某个元素 使用dom4j支持xpath的操作的几种主要形式   第一种形式     /a/b/c: 表示一层一层的,a下面 b下面的c   第二种形式      //b: 表示和这个名称相同,表示只要名称是b,都得到 第三种形式     /* : 所有元素 第四种形式     a[1]: 表示第一个a元素     a[last()]:表示最后一个a元素 第五种形式     //a[@id]: 表示只要a元素上面有id属性,都得到 第六种形式     //a[@id='b1'] 表示元素名称是a,在a上面有id属性,并且id的属性值是b1 使用dom4j支持xpath具体操作 默认的情况下,dom4j不支持xpath,如果想要在dom4j里面是有xpath, 第一步需要,引入支持xpath的jar包,如下: jaxen-1.1-beta-6.jar 在dom4j里面提供了两个方法,用来支持xpath     selectNodes("xpath表达式"),获取多个节点        selectSingleNode("xpath表达式"),获取一个节点 步骤: 1. 在项目下创建一个lib文件夹folder 2. 复制dom4j的jar包到lib文件夹中 3. 选中jar右键buildpath 4. 在测试类中使用dom4j解析XML。(今天开始学习别人的api) dom4j中使用到的方法: 1.创建SaxReader对象 SAXReader reader = new SAXReader(); 2.设置命名空间 reader.getDocumentFactory().setXPathNamespaceURIs(map); 3. SAXReader对象调用read方法,将当前XML文件,转换为Document对象 document = reader.read(file); 4. 获取根节点 root = document.getRootElement(); 5. 通过父签添加子标签(元素) Element element = root.addElement("标签名");//返回值就是要添加的元素对象 给子标签添加值 element.setText("标签值"); 6. 给当前标签添加属性:xxx ,值是:xxx Element attribute = linkman.addAttribute("属性名","值"); 通过属性对象attribute获取属性值 attribute.setText("值"); 通过属性对象attribute获取属性值 String 值 = attribute.getText(); 7. 获取当前元素标签名 String name = e.getName(); 获取当前元素标签值 String text = e.getText(); 8. 获取指定名字的子标签(元素) root.element(String name); 9. 获取所有子标签(元素) root.elements(); 10.在dom4j里面提供了两个方法,用来支持xpath      selectNodes("xpath表达式"),获取当前名字的多个节点 selectSingleNode("xpath表达式"),获取一个节点
C Programming Professional Made Easy 2nd Edition Great new publication with first time ever released professional programming! Are you aware that C Programming is one of the most popular and most commonly used programming languages today? Did you know many expert developers have started with learning C in order to become knowledgeable in computer programming? Were you aware that your children are learning C Programming today in their schools? Are you wanting a shortcut from basic to expert in one day and all the technical jargon removed so its made easy to understand? If you are having doubts learning the language, do not! C is actually easy to learn. Compared to C++, C is much simpler! You do not need to spend years to become a master of this language. Well start right here! Learn the coding necessary in less than a day, become profound and knowledgeable to move up the ladder to becoming a proficient programmer! It start right now and by the time you finish and implement the steps here, you will have learned everything there is to know in less than a day! Steps covered to become proficient in C Programming include... The basics elements of C Learn what C Programming Language is Learn to to understand C Program Then all the fun of learning C Programming Much more programming tips! Purchase your copy right now and take advantage of this books bonus of great content for a low low price! Table of Contents Chapter 1 The Basic Elements Of C Chapter 2 What is C Programming Language Chapter 3 Understanding C Program Chapter 4 Learn C Programming Chapter 5 Storage Classes Chapter 6 Operators Chapter 7 Decision Making Chapter 8 C Loops Chapter 9 Type Casting and Error Handling

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值