NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

觀念題:

===== 問題一:以下的代碼的輸出將是什麼? 寫出你的答案並解釋 =====
class Parent(object):
    x = 1 
class Child1(Parent):
    pass 
class Child2(Parent):
    pass  print Parent.x, Child1.x, Child2.x
Child1.x = 2
print Parent.x, Child1.x, Child2.x
Parent.x = 3
print Parent.x, Child1.x, Child2.x

===== 問題二:以下代碼將輸出什麼? 寫出你的答案並解釋 =====
list = ['a', 'b', 'c', 'd', 'e']
print list[10:]  

程式題:

===== 問題三:計算文章中英文單字出現的次數 =====
[說明]
請撰寫一程式,統計下面文章中各英文單字出現的次數
提示:
不管大小寫,皆視為同一單字 [範例]

畫面:
The article as below:
Hello, my English name is Jerry. I like fruits very much, but I don’t like eating vegetables.
Sometimes I like riding a bike and doing some exercises on the playground. I don’t like reading some books, but I like drawing pictures.
I like many animals, and I like English so much.
My mum is young, she is always very tired because she is very busy. 
Everyday she gets up early in the morning and cooks breakfast for us. In the evening, she often reads some newspaper before she goes to bed.
I love my mum, and she loves me too.
Yesterday was Sunday, I didn’t go to school, but I was busy.
In the morning, I got up at eight o’clock, then I ate breakfast. After breakfast, I cleaned my room, it was dirty but it is clean now. 
In the afternoon, I played badminton with my friends. 
In the evening, my sister and I ate some cookies, ice cream and drank some juice and milk, but I didn’t like chocolate.
After finishing my homework, I watched TV and listened to music.
I had a good time last Sunday.

輸出:
hello     1
my     7
english   2
name     1
is     5
jerry     1
i     18
like     8
fruits    1
very     3
much     2
but     5
don’t     2
eating     1
vegetables 1
sometimes  1
riding     1
a     2
bike     1
and     8 ...全部印出 

===== 問題四:迴圈偶數連加 =====
說明:
請使用迴圈敘述撰寫一程式,讓使用者輸入兩個正整數 a、b(a < b),
利用迴圈計算從 a 開始的偶數連加到 b 的總和。(a=1、b=100,則輸出結果為 2550(2 + 4 + … + 100 = 2550) [範例]
畫面: 請輸入a值
輸入: 1
畫面: 請輸入b值
輸入: 100
輸出: 1~100間的偶數相加總和為 2550 

===== 問題五:威力彩電腦隨機選號 =====
[說明]
請撰寫一程式,讓使用者輸入要幾組電腦隨機選號
提示:第一區數字範圍1~38,第二區數字範圍1~8,數字顯示請從小到大排序,數字不滿2位請補0 [範例]
畫面: 請問要幾組威力彩電腦選號?
輸入: 5
輸出: 第1組 (第一區)01, 02, 03, 04, 05, 06 (第二區)08
      第2組 (第一區)10, 15, 20, 25, 30, 38 (第二區)01
      第3組 (第一區)11, 22, 33, 35, 36, 37 (第二區)03
      第4組 (第一區)04, 12, 17, 22, 29, 33 (第二區)04
      第5組 (第一區)02, 03, 16, 24, 25, 36 (第二區)06
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.