assignment of day four
1.Numeric type
(1)integer
Use
Is to show people's age;phone number ;id numbers etc.
Define
age_Nick=18 #nick is eighteen years old
print(id(age_Nick))#140733086069536
print(type(age_Nick#<class 'int'>
print(age_Nick)#18
How to use
plus minus,multiply,divide or some logical comparison > <
(2)float
Usefulness
Is to show height weight salary etc.
Define
salary = 2.1 # salary=float(2.1)
print(id(salary))#2188554482512
print(type(salary))#<class 'float'>
print(salary)#2.1
How to use
The same to int plus minus,multiply,divide or some logical comparison > <
2.string type
Use
To show the name ,hobby etc.
Define
name1 = 'Nick'
name2 = "Egg"
print(id(name1))#2039780276080
print(type(name1))#<class 'str'>
print(name1)#Nick
name3 = """Nick
Egg"""
print(name3)#Nick
#Egg
How to use
string type can only plus multiply or logical comparison
3.list
Use
To store multiple value such as multiple girlfriend multiple hobbies .
Define
hobby = 'read'
hobby_list = [hobby, 'run', 'girl']
print(id(hobby_list))#3013323084360
print(type(hobby_list))#<class 'list'>
print(hobby_list)#['read', 'run', 'girl']
How to use
Our aim is not to store but to take I'll show the way to take value from list and plz remenber the start number is 0
4.Dictionary
Use
Is to store many many value from
key value
way ,and while taking can follow the key,key can describe value.
Define
user_info = {'name': 'nick', 'gender': 'male', 'age': 19,
'company_info': ['oldboy', 'shanghai', 50]}
print(id(user_info))#1738629399160
print(type(user_info))#<class 'dict'>
print(user_info)#{'name': 'nick', 'gender': 'male', 'age': 19, 'company_info': ['oldboy', 'shanghai', 50]}
How to use
dictionary taking value is no more rely on indexes,but rely on the key ,though the [key],can get key's value.
4.Wordcloud
import jieba
import wordcloud
# import module
from imageio import imread
mk=imread('wujo.png')
s="蔡徐坤 把 唱 跳 手起刀落 rap 篮球 打成筛子 流量明星 口红 男扮女装 鸡你太美 随后 获得 出道后 首个 个人 音乐类 奖项 亚洲新歌榜 2018 年度盛典“ 最受欢迎 潜力 男歌手"
s_list=jieba.lcut(s)
print(s_list)
s=''.join(s_list)
w=wordcloud.WordCloud(font_path='C:\Windows\Fonts\simsun.ttc',mask=mk,background_color='white')
w.generate(s)
w.to_file('cxk1.png')
assignment of day four的更多相关文章
- Atitit GRASP(General Responsibility Assignment Software Patterns),中文名称为“通用职责分配软件模式”
Atitit GRASP(General Responsibility Assignment Software Patterns),中文名称为"通用职责分配软件模式" 1. GRA ...
- user initialization list vs constructor assignment
[本文连接] http://www.cnblogs.com/hellogiser/p/user_initialization_list.html [分析] 初始化列表和构造函数内的赋值语句有何区别? ...
- Swift 提示:Initialization of variable was never used consider replacing with assignment to _ or removing it
Swift 提示:Initialization of variable was never used consider replacing with assignment to _ or removi ...
- 代写assignment
集英服务社,强于形,慧于心 集英服务社,是一家致力于优质学业设计的服务机构,为大家提供优质原创的学业解决方案.多年来,为海内外学子提供了多份原创优质的学业设计解决方案. 集英服务社,代写essay/a ...
- [Top-Down Approach] Assignment 1: WebServer [Python]
Today I complete Socket Programming Assignment 1 Web Server Here is the code: #!/usr/bin/python2.7 # ...
- default constructor,copy constructor,copy assignment
C++ Code 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 ...
- Programming Assignment 5: Kd-Trees
用2d-tree数据结构实现在2维矩形区域内的高效的range search 和 nearest neighbor search.2d-tree有许多的应用,在天体分类.计算机动画.神经网络加速.数据 ...
- Programming Assignment 4: 8 Puzzle
The Problem. 求解8数码问题.用最少的移动次数能使8数码还原. Best-first search.使用A*算法来解决,我们定义一个Seach Node,它是当前搜索局面的一种状态,记录了 ...
- Programming Assignment 2: Randomized Queues and Deques
实现一个泛型的双端队列和随机化队列,用数组和链表的方式实现基本数据结构,主要介绍了泛型和迭代器. Dequeue. 实现一个双端队列,它是栈和队列的升级版,支持首尾两端的插入和删除.Deque的API ...
- 逆转序列的递归/尾递归(+destructuring assignment)实现(JavaScript + ES6)
这里是用 JavaScript 做的逆转序列(数组/字符串)的递归/尾递归实现.另外还尝鲜用了一下 ES6 的destructuring assignment + spread operator 做了 ...
随机推荐
- nginx安装教程(详细)
所见即所得编辑器, editorhtml{cursor:text;*cursor:auto} img,input,textarea{cursor:default}.cke_editable{curso ...
- Centos7防火墙使用
修改时区 Centos7 #修改时区 timedatectl set-timezone Asia/Shanghai 开启防火墙 #添加一条规则 firewall-cmd --zone=public - ...
- Java数据类型简介
Java数据类型 以下两行Java代码定义了两个整数:num1和num2: num1和num2是两个int类型的变量. int关键字指定它的后面是变量的名称,并表示数据类型整数,例如:10,15,70 ...
- 洛谷P1629 邮递员送信 最短路-Djistra
先上一波题目qwq https://www.luogu.org/problem/P1629· 复习了一波 dijstra 的 priority_queue(优先队列)优化的写法 tips: 求单项路中 ...
- Linux NIO 系列(03) 非阻塞式 IO
目录 一.非阻塞式 IO 附:非阻塞式 IO 编程 Linux NIO 系列(03) 非阻塞式 IO Netty 系列目录(https://www.cnblogs.com/binarylei/p/10 ...
- 通用唯一标识码UUID的介绍及使用。
什么是UUID? UUID全称:Universally Unique Identifier,即通用唯一识别码. UUID是由一组32位数的16进制数字所构成,是故UUID理论上的总数为16^32 = ...
- linux Cron 定时任务(centos 7.2 测试可用)
1.Cron(学习笔记) 计划任务,是任务在约定的时间执行已经计划好的工作. 格式如下 Seconds Minutes Hours DayofMonth Month DayofWeek Year ...
- 关于JS递归函数求斐波那契数列两种实现方法
百度已经解释的很详细了,但是不写注释还真是看不懂,递归,就直接套公式了,for循坏,我们就用EXCEL看一下规律 可以看到B是A+B的和,A往后就是B的值,所以我们需要第三个变量来保存他们的和,取出B ...
- Python安装和使用教程(windows)
点击进入幕布视图浏览 https://mubu.com/doc/a8VGCUfqqw 一.Python下载 1.进入Python官网:https://www.python.org/ 2.选择windo ...
- Error (10170): Verilog HDL syntax error at passwd.v(21) near text "if"; expecting an identifier ("if" is a reserved keyword ), or "endmodule", or a parallel statement
你得加上时序啊笨蛋