1. 程式人生 > >路飛學城-Python開發集訓-第一章

路飛學城-Python開發集訓-第一章

pytho 表示 年齡 自我 薪水 字符 int score 正常

路飛學城-Python開發集訓-第一章
1.本章學習心得、體會
我:間接性勤奮。

我:學習方法論:輸入--輸出---糾正

我:對對對 走出舒適區, 換圈子, 轉思路,投資自我加籌碼。

我:圈子水平差不多,學歷差不多,沒成長,沒危機感。

我:找到比我強的人,借助外力的沖破自我的老思維。

我:熟悉的東西,刺激不出自己的新思路

我:投資自我,學習提高。


分享以上的思路和方法論,來自路飛的幹貨。


2.學習到的知識點總結。
-----最快的二進制轉化
a=int(input(‘輸入需要轉化的整數 :‘))
print(type(a))
print(‘b的二進制是:‘,bin(a))

b=input(‘輸入漢字:‘)
print(type(b))
print(‘你輸入的漢字是:‘,b)

c=float(input(‘輸入需要轉化的小數 :‘))
print(type(c))
print(‘c的小數表示是:‘,float(c))

----最好的格式化輸出
name = input(‘輸入姓名:‘)
age =int( input(‘輸入年齡:‘))
work = input(‘輸入職業:‘)
hometown = input(‘輸入籍貫:‘)
salary = float(input(‘應付工資:‘))
outpt = ‘‘‘
========輸入信息匯總=========
| 姓名: %s
| 年齡: %d
| 職業: %s
| 籍貫: %s
| 薪水: %f
============================
‘‘‘%(name,age,work,hometown,salary)
print(outpt)
marks=‘‘‘
%s = str 字符串
%d = dital 數字
%f = float 小數
‘‘‘
print(marks)


------分數對應等級
#_*_coding:utf-8_*_
# A:90-100
# B:80-89
# C:60-79
# D:40-59
# E:0-39

n=0
while n < 10 :
score = float(input(‘輸入你的學分,查詢你的等級 ;‘))
if score > 100 :
print(‘分數不能超過100分‘)
elif score >= 90 :
print(‘你是A級 。‘)
elif score >= 80 :
print(‘你是B級 。‘)
elif score >= 60 :
print(‘你是C級 。‘)
elif score >= 40 :
print(‘你是D級 。‘)
elif score >= 0 :
print(‘你是E級 。‘)
else :
print(‘分數超出正常範圍了。‘)
n +=1
------猜年齡 遊戲

----
#輸入姓名、性別 、年齡,判斷如果是女性且小於28歲,打印喜歡女神;如果是女性且大於28歲,打印姐弟戀吧,如果是男性則打印不搞基;
age = 18
n=0
while n < 3 :
userguess = input(‘輸入數字猜我的年齡:‘)
if int(userguess) > age:
print(‘猜大了‘)
elif int(userguess) < age:
print(‘猜小了 ‘)
else:
print(‘恭喜答對了‘)
break
n +=1
if n == 3:
play = input(‘還玩嗎? Y/N‘)
if play == "Y" or play ==‘y‘:
n = 0
else:
print(‘猜測遊戲結束‘)
exit

路飛學城-Python開發集訓-第一章