Python日常更新,get新知識

來源:互聯網
上載者:User

標籤:coding   int   臨時   輸入   機器   file   odi   結果   AC   

 

# -*- coding: UTF-8 -*-#  

 

# Filename : test.py

# author by : www.runoob.com

 

# 使用者輸入攝氏溫度

 

# 接收使用者輸入

cel = float(input(‘輸入攝氏溫度: ‘))

 

# 計算華氏溫度

fahrenheit = (cel * 1.8) + 32

print(‘%0.1f 攝氏溫度轉為華氏溫度為 %0.1f ‘ %(cel,fahrenheit))

#簡化下

print(‘輸入攝氏溫度%0.1f轉化為華氏溫度為%0.1f‘%(cel,(cel*1.8)+32))

 

# -*- coding: UTF-8 -*-

 

# Filename : test.py

# author by : www.runoob.com

 

# 使用者輸入

 

x = input(‘輸入 x 值: ‘)

y = input(‘輸入 y 值: ‘)

 

# 建立臨時變數,並交換

 

x,y = y,x

print(‘交換後 x 的值為: {}‘.format(x))

print(‘交換後 y 的值為: {}‘.format(y))

 

#程式都是按順序執行

#看似很矛盾,其實符合機器語言

 

# -*- coding: UTF-8 -*-

 

# Filename : test.py

# author by : www.runoob.com

 

# 使用者輸入

 

x = input(‘請輸入x的值:‘)

y = input(‘再輸入y的值:‘)

 

#來交換吧

x,y = y ,x

 

#哈哈輸出執行結果吧

print("x的值交換之後竟然變成了{}".format(x))

print(‘y的值交換之後竟然變成了{}‘.format(y))

 

#程式都是按順序執行

#看似很矛盾,其實符合機器語言

Python日常更新,get新知識

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.