scores = [10, 20, 30, 20, 40]
print(len(scores))
print(min(scores))
print(max(scores))
print(sum(scores))
print(scores.index(20))
print(20 in scores)
print(100 in scores)
scores = [10, 20, 30, 20, 40]
print(20 in scores)
print(100 in scores)
scores = [10, 20, 30, 20, 40]
del scores[2]
print(scores)
scores = [10, 20, 30, 20, 40]
scores.insert(1, 15)
print(scores)
using namespace std;
int f() {
static int x = 0;
++x;
return x;
}
int main()
{
cout << f() << endl;
cout << f() << endl;
cout << f() << endl;
}
using namespace std;
int f() {
int x = 0;
++x;
return x;
}
int main()
{
cout << f() << endl;
cout << f() << endl;
cout << f() << endl;
}
scores = [10, 20, 30, 20, 40]
scores.append(60) #メソッド
print(scores)
using namespace std;
int main()
{
int n, divisors;
n = 10;
divisors = 0;
for (int i = 1; i <= n; ++i) {
if (n % i == 0) ++divisors;
}
cout << n << "の約数の数:" << divisors << endl;
}
using namespace std;
int add1(int x) {
return x + 1;
}
int main()
{
int result = add1(1);
cout << result << endl;
}
scores = [10,20,30,20,40]
scores[1] = 100
print(scores)
package sample;
public class Hello {
public static void main(String[] args) {
int old, height;
old = 20;
height = 184;
System.out.println(“年齢:” + old);
System.out.println(“慎重:” + height);
}
}