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 做了 ...
随机推荐
- Example of dynamic programmatic description
- Suppose there are some itineraries in the Itinerary page, and you want to check on all of them. Se ...
- activiti7查询历史数据
package com.zcc.activiti02; import org.activiti.engine.HistoryService;import org.activiti.engine.Pro ...
- PHP 图片裁切
PHP CLASS TO CREATE IMAGE THUMBANILS Some years ago, I wrote a PHP class to create image thumbnails ...
- Linux NIO 系列(02) 阻塞式 IO
目录 一.环境准备 1.1 代码演示 二.Socket 是什么 2.1 socket 套接字 2.2 套接字描述符 2.3 文件描述符和文件指针的区别 三.基本的 SOCKET 接口函数 3.1 so ...
- (1.2)学习笔记之mysql体系结构(数据库文件)
InnoDB存储引擎体系结构图 1.InnoDB数据库的结构 (1)redo log:这里的redo log不是数据的redo log,InnoDB本也是一个数据库,身具有的redo log,所以这里 ...
- 33-python基础-python3-列表插入元素-insert()方法-append()方法-extend()方法
1-insert()方法 insert()方法可以在列表任意下标处插入一个值. insert()方法的第一个参数是新值的下标,第二个参数是要插入的新值. 2-append()方法 调用 append( ...
- PAT程序设计
VS2013中自行对齐的快捷键操作: CTRL+K+F 1.定义二维数组 ]=]; 2.绝对值函数 int abs(int i) 返回整型参数i的绝对值 double cabs(struct comp ...
- Rikka with Competition
Rikka with Competition 给出一个大小为n的集合\(\{a_i\}\),每次从集合中随机挑出一对数\(a_i,a_j\),如果\(|a_i-a_j|>K\),那么从集合中删掉 ...
- Android开发笔记之ArrayAdapter
1,ArrayAdapter的item中的条目的布局文件的正确写法: item.xml <?xml version="1.0" encoding="utf-8&qu ...
- 62. File类常用方法
为了怕混淆,先说明一些下面要出现的名词意思:例如:D:\\新建文件夹 (2)\\a.txt 和 D:\\新建文件夹 (2)\\aaaa D:\\新建文件夹 (2) 父路径 a.txt ...