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 做了 ...
随机推荐
- Pandas Series数据结构基本操作
>>> import pandas >>> import numpy as np >>> from pandas import Series,Da ...
- .NET简介
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 微软跨语言运行的主要机制就如上图类似,其最重要的部分是CLR和MSIL:其中MSIL是微软中间语言,它的主要的作用是将不同 的语言,如:C ...
- selenium学习笔记(1)
selenium http://selenium-python.readthedocs.io/index.html https://www.seleniumhq.org/projects/ide/ 声 ...
- Spring Cloud配置中心内容加密
从配置获取的配置默认是明文的,有些像数据源这样的配置需要加密的话,需要对配置中心进行加密处理. 下面使用对称性加密来加密配置,需要配置一个密钥,当然也可以使用RSA非对称性加密,但对称加密比较方便也够 ...
- Puppeteer自动化测试cnode.js中文社区
如果完全不了解puppeteer的朋友可以去看看我的这篇随笔:https://www.cnblogs.com/zlforever-young/p/11569890.html 开始之前需要了解的知识:E ...
- Java中date和calendar的用法
获取现在系统的时间和日期看起来是一件非常神奇的事情,但是当使用date和calendar之后发现仍然非常神奇. 1.date 使用date日期之前需要导入包: import java.text.Sim ...
- linux下如何挂载磁盘
1.显示磁盘使用情况:#df 2.显示磁盘:#fdisk -l 3.格式化分区:#mkfs.ext4 /dev/vdb1 //注:将/dev/vdb1格式化为ext4类型(文件类型 ...
- QMap的key也可以是一个结构体类吗?
QMap<usbsnvidpid, QVector<QString>> USBVIDPIDTIME; USBVIDPIDTIME.insert(m_vidpidsn, time ...
- fzu 1901 next+脑洞
题目大意: 给你一个字符串str,对于每个str长度为p的前缀,如果str[i]==str[p+i](p+i<len),那么我们认为它是一个periodic prefixs.求所有满足题意的前缀 ...
- Python的历史及介绍
Python的诞生 Python的创始人吉多·范罗苏姆(Guido van Rossum),在1989年12月的圣诞节期间,为了打发时间,决定开发一种新的脚本解释程序,作为ABC语言的继承. 现在,p ...