iT邦幫忙

2024 iThome 鐵人賽

DAY 3
0
Python

一起來用 Snakify 練練手系列 第 3

【一起來用 Snakify 練練手】Day3 Lesson 1 練習題參考解答

  • 分享至 

  • xImage
  •  

Lesson1 單元的題目的是簡單的

  • Sum of three numbers
a = int(input())
b = int(input())
c = int(input())
print(a+b+c)
  • Hi John
name = input()
print("Hi "+ name)
  • Square
a = int(input())
print(a**2)
  • Area of right-angled triangle
b = int(input())
h = int(input())
print(b*h/2)
  • Hello, Harry!
name = input()
print("Hello, "+name +"!")
  • Apple sharing
n = int(input())
k = int(input())

print(k // n)
print(k % n)
  • Previous and next
a = int(input())
print("The next number for the number " + str(a) + " is " + str(a+1))
print("The previous number for the number " + str(a) + " is " + str(a-1) )
  • School desks
a = int(input())
b = int(input())
c = int(input())
print(a // 2 + b // 2 + c // 2 + a % 2 + b % 2 + c % 2)

上一篇
【一起來用 Snakify 練練手】Day2 Lesson 1 概念
下一篇
【一起來用 Snakify 練練手】Day4 Lesson 2 概念
系列文
一起來用 Snakify 練練手21
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言