CCC: coding crash course (1)

Internal material.

Basic programming course

Ubuntu

OS: Operating System

--Example 1 Windows, macOS, Linux --Example 2 iOS, Android

Linux: Free OS

--Example Ubuntu-This OS will be used in the future.

Ubuntu

To communicate with the OS with the keyboard, use a terminal. From now on, when "$ xxxx" is written, it means to type "xxxx" in the terminal and press Enter. From now on, when "\ # comment etc." is written, it means that it is written as "comment etc." as an aid to understanding.

\ # For example, on taro's terminal, it is displayed like this.

$ whoami taro

$ pwd /home/taro

$ ls -l drwxr-xr-x 2 taro staff 64 May 14 20:12 Desktop drwxr-xr-x 2 taro staff 64 May 14 20:12 Downloads

$ mkdir project Create a directory (folder) called \ # project.

$ ls -l drwxr-xr-x 2 taro staff 64 May 14 20:12 Desktop drwxr-xr-x 2 taro staff 64 May 14 20:12 Downloads drwxr-xr-x 2 taro staff 64 May 14 20:12 project

$ cd project Move to a directory (folder) called \ # project.

$ ls -l -rw-r--r--@ 1 taro staff 564 May 14 20:40 test1.py

python

$ python test1.py

Execute the program from the terminal in the form of.


# test1.py

import numpy
#Import (load) numpy module

print('Hello, world')

y = 570*3

print(y)


name = 'Taro'

print(name)

x = numpy.pi + y


#print('%s says x is %lf' % (name, x))

print('--')
list_name = ['taro', 'hanako', 'madoka']

list_test_score = [95, 100, 120]



#len(A)And the length of A(length)Is displayed.
print( len(list_names)  )

print( list_name[0], list_test_score[0] )
print( list_name[1], list_test_score[1] )
print( list_name[2], list_test_score[2] )


#Display automatically with for loop.
for i in range(len(list_names)):
    print ('%s test score is %d' % (list_name[i], list_test_score[i]))
    print('--')


Recommended Posts

CCC: coding crash course (1)
CCC: coding crash course (3)
CCC: coding crash course (2)
CCC: coding crash course (4) Make the numbers appearing in pi 3.141562 .... into a histogram
CCC: coding crash course (5) Find out the frequency of words and letters that appear in Steve Jobs speeches