目前分類:Python練習題 (18)
- May 10 Mon 2021 02:33
Python roll the dice
- May 08 Sat 2021 20:16
Python with-open
Write a Python program that takes a text file as input and returns the number of words in words.txt
Write a Python program to count the number of lines in a text file.
- May 08 Sat 2021 19:35
Python Create a Time class
Create a Time class and initialize it with hours and minutes.
- May 08 Sat 2021 19:32
Python define a Shape class
Please define a Shape class as following and define Circle Class and Rectangle Class to inherit from Shape. In Circle and Rectange Class, please add function cal_area to calculate area and add function cal_perimeter to calculate perimeter.
- May 08 Sat 2021 16:23
Python BLACKJACK
BLACKJACK: Given three integers between 1 and 11, if their sum is less than or equal to 21, return their sum. If their sum exceeds 21 and there's an eleven, reduce the total sum by 10. Finally, if the sum (even after adjustment) exceeds 21, return 'BUST'
- May 08 Sat 2021 16:18
Python subsets&交集
Given an array of distinct positive numbers, the task is to calculate the number of subsets (or subsequences) from the array such that each subset contains consecutive numbers
Take two lists and write a program that returns a list that contains only the elements that are common between these two lists (without duplicates). Make sure your program works on two lists of different sizes
- May 07 Fri 2021 18:55
Python palindrome
Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.)
- May 07 Fri 2021 18:51
Python 計算兩個向量的距離
Given two vector, calculate distance between them
- May 06 Thu 2021 03:45
Python 計算字串中字元的字數&大小寫
Given a test string, please switch this string to lower and calculate frequency of each character
Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters.
- May 06 Thu 2021 03:38
Python 判斷質數
input a number greater than 1, detect if this number is prime number or not
if it is prime number, print "this is a prime number"
if it is not prime number ,print "this is not a prime number"
- May 06 Thu 2021 02:32
Python 九九乘法表
write 9*9 multiplication table
- May 06 Thu 2021 02:22
Python factorial-階乘&組合
- May 05 Wed 2021 21:08
Python use ord( )
- May 05 Wed 2021 20:03
Python-三角形面積計算
- May 05 Wed 2021 20:00
Python-Lucky number
Lucky number
input a integer number, detect if the number is considered lucky. If the number is lucky, print "lucky number". If not, print "regular number"
Definition of lucky number: the sum of the first three digits equals the sum of the last three digits in a number.
- May 03 Mon 2021 21:53
Python-攝氏華氏溫度轉換
Please do temperature conversion. Given a Celsius temperature, please change it to Fahrenheit
F=9/5*C+32
C=5/9(F-32)
- May 03 Mon 2021 21:45
Python-計算圓面積
Write a Python program which accepts the radius of a circle from the user and compute the area.
- May 03 Mon 2021 21:29
Python-BMI計算