Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Pythonメモと課題

Last updated at Posted at 2023-05-21

コードの雛形

ipython

  • anaconda prompt起動
  • ipython
  • 1+1
  • quit

VSCode

  • anaconda prompt起動
  • cd Desktop/compA23/python_code
  • cdを打った後にフォルダーをドラッグアンドドロップする
  • code .
  • 新規ファイルの作成
  • q1_hello.py
  • 編集
  • 右向き三角をクリック
  • or python hello.py (on terminal)

課題

python print

最初の一歩としてprintでの出力.

  print("Hello world.")
  > python hello.py
  Hello world.

mdでcodeに色をつけるには,バックコート(back-quote)(shift-@)でコードを囲んで,pythonとかを後ろに指定すると,その文法に沿って色付け(colorize)してくれる.

calendar

  • 新しいファイルを作成
    • ただしimportするmoduleと同じ名前だと,
    • ライブラリ moduleではなく
    • 自ファイルを読もうとして,
    • 動かない
import calendar
print(calendar.month(1961,3))
>python calendar_1.py 
     March 1961
Mo Tu We Th Fr Sa Su
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

誕生秘話

Bobは,分娩室の外のソファで生まれました.


  • source ~/Desktop/lecture_24s/comp_a24/d7_11_python/d7_print_calendar.org
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?