import math;print('唯我超电磁炮永世长存!');print('X----');print(' ||||-');print('*'*10);
true =True;
false =False;
price =10;
rating =4.9;
name ='御坂美琴';
is_published = true;print(price);
name =input('你的名字是? ');print('你好! '+name);
color =input('喜欢的颜色是? ');print(name+' 喜欢 '+color);
birth =input('出生日期? ');print(type(birth));
age =2021-int(birth);print(type(age))print(age);
course =" ' 是单引号";
msg ='''
唯我超电磁炮永世长存!
你指尖跃动的电光,是我此生不变的信仰!
音无结弦之时,悦动天使之心,立于浮华之世,奏响天籁之音!
''';
msg ='Python for beginners';
msg_ = msg[:];print(msg_);
msg ='Jennifer';
msg_ = msg[1:-1];print(msg_);
first ='John';
last ='Smith';# msg = first+' ['+last+'] is a coder';
msg = f'{first} [{last}] is a coder';
msg ='Python for beginners';print(msg.upper());print(msg.lower());
msg ='Python for beginners';
exist ='Python'in msg;print(exist);print(10**3);
x =10;
x = x+3;
x =(2+3)*10-3;print(x);print(math.floor(2.9));
is_hot = false;
is_cold = false;if is_hot:print("It's a hot day");print('drink plenty of water');elif is_cold:print("It's a cold day");print("Wear warm clothes");else:print("It's a lovely day");print('enjoy you day');
price =1000000;
has_good_credit = true;# down_payment = 0;if has_good_credit:
down_payment =0.1*price;else:
down_payment =0.2*price;print(f'Down payment:${down_payment}');
has_high_income = true;
has_good_credit = true;
has_criminal_record = true;#if has_good_credit andnot has_criminal_record:print('可以贷款');
temperature =30;if temperature >30:print("It's a hot day");# print('drink plenty of water');# elif is_cold:# print("It's a cold day");# print("Wear warm clothes");else:print("It's a lovely day");
temperature =35;if temperature >30:print('天气好热');else:print('真是凉爽的一天啊');
name ='liusu';iflen(name)<3:print('名称至少是3位')eliflen(name)>50:print('名称必须小于50位');else:print('名称符合要求')
weight =int(input('体重? '));
unit =input('单位? ');if unit.upper()=='L':
weight =int(weight *0.45);print(f'你的体重是 {weight} kg')else:print(f'你的体重是 {weight} kg')2021-5-28*2021-6-18*level-1
i =1while i <=5:print(i*"*")
i +=1print('完成!')
secret_number =9
guess_count =1
guess_limit =3while guess_count <= guess_limit:
guess_number=int(input('number: '))if guess_number==secret_number:print('you win!')break
guess_count+=1else:print('you are failed')
command =''
started = false;while true:
command=input('> ')if command=='start':if started:print('the car already started')else:
started = true
print('the car started')elif command=='stop':if started:
started = false
print('the car stopped')else:print('the car already stopped')elif command =='quit':print('the program is quit')breakelif command=='help':print('''
start - to start the car
stop - to stop the car
quit - quit
''')else:print('sorry i can not understand that')for item inrange(50,100,3):print(item)
prices =[10,20,30]
total =0for price in prices:
total+=price
print(f'total={total}')for i inrange(4):for j inrange(3):print(f'({i},{j})')
numbers=[5,2,5,2,2]for x_count in numbers:
x =''for j inrange(x_count):
x = x+'x'print(x)
names =['流苏','飞扬','青丝','大飞','水洗','今夕','木系','获悉','突袭','炎之吐息','岩之枪']# print(names[2:4])
names[0]='唯我超电磁炮永世长存'print(names)
numbers =[3,6,2,10,8,4,10]max= numbers[0]for i in numbers:if i>max:max= i
print(max)
matrix =[[1,2,3],[4,5,6],[7,8,9]]for i in matrix:for j in i:print(j)
matrix[1][1]=20print(matrix[1][1])
numbers =[5,2,1,7,4,5]
index1 = numbers.index(7)print(numbers.count(5))
numbers.sort()
numbers.reverse()
num = numbers.copy()
numbers.append(10)print(num)
x1 =[2,2,4,6,3,4,6,1]
x2 =[]for x in x1:if x notin x2:
x2.append(x)print(x2)
numbers =(1,2,3)print(numbers[0])
coordinates =[45,78,56]
x = coordinates[0]
y = coordinates[1]
z = coordinates[2]
x,y,z = coordinates
print(x*y*z)
customer ={'name':'流苏','age':30,'is_verified': true
}
customer['age_']=1print(customer.get('age_',35))
phone ={'1':'one','2':'two','3':'three','4':'four','5':'five','6':'six','7':'seven','8':'eight','9':'nine','0':'zero'}
number =input('请输入您的电话号码: ')
out =''for item in number:
out = out + phone[item]+' 'print(out)
message =input('> ')
msg = message.split(' ')print(msg)defgreet_user(first_name,last_name):print(f'{first_name}{last_name} :唯我超电磁炮永世长存!')# print('音无结弦之时,悦动天使之心,立于浮华之世,奏响天籁之音!')print('start')
greet_user(first_name='御坂',last_name='美琴')print('finish')if true:print(25)