首页 > 其他分享 >实验一

实验一

时间:2023-03-08 12:04:37浏览次数:28  
标签:x1 format x2 y1 实验 print y2

实验任务1

task1-1源码

print ("hey,u")
print ('hey','u')
x,y,z = 1,2,3
print (x,y,z)
print ('x =%d, y = %d, z = %d'%(x,y,z))
print ('x={},y={},z={}'.format(x,y,z))
print (f'x={x},y={y},z={z}')

print(x)
print(y)
print(z)

print(x,end=' ')
print(y,end=' ')
print(z)

 

运行测试截图

 

task1-2源码

x1,y1 = 1.2, 3.57
x2,y2 = 2.26, 8.7

print('{:-^40}'.format('输出1'))
print('x1 = {}, y1 = {}'.format(x1, y1))
print('x2 = {}, y2 = {}'.format(x2, y2))
print('{:-^40}'.format('输出2'))
print('x1 = {:.1f}, y1 = {:.1f}'.format(x1, y1))
print('x2 = {:.1f}, y2 = {:.1f}'.format(x2, y2))
print('{:-^40}'.format('输出3'))
print('x1 = {:<15.1f}, y1 = {:<15.1f}'.format(x1, y1))
print('x2 = {:<15.1f}, y2 = {:<15.1f}'.format(x2, y2))
print('{:-^40}'.format('输出3'))
print('x1 = {:>15.1f}, y1 = {:>15.1f}'.format(x1, y1))
print('x2 = {:>15.1f}, y2 = {:>15.1f}'.format(x2, y2))

运行测试截图

 

task1-3源码

name1, age1 = 'Bill', 19
name2, age2 = 'Hellen', 18
title = 'Personnel Information'
print(f'{title:=^40}')
print(f'name: {name1:10} age: {age1:3}') # 10和3分别指定数据项输出宽度
print(f'name: {name2:10} age: {age2:3}')
print(40*'=')

 

测试运行截图

 

标签:x1,format,x2,y1,实验,print,y2
From: https://www.cnblogs.com/prefectdown/p/17191482.html

相关文章

  • 实验1 C语言开发环境使用和编程初体验
    实验任务1程序源码//打印一个字符小人#include<stdio.h>intmain(){printf("O\n");printf("<H>\n");printf("II\n");printf("O\n");printf("<H>\n");......
  • 自动化测试软件UFT实验
    功能测试 上机练习 1. 录制Flight程序登录的脚本。2. 脚本要求:(1) 使用Systemutil.Run打开程序。(2) 创建三个Action,分别命名为01_Login/02_New Order/03_Logout, 在A......
  • 实验1 Python初体验
    实验任务1实验源码1#实验123print('task1')  运行测试截图 实验结论: 实验任务2 实验任务3......
  • 实验1 C语言开发环境使用和编程初体验
    一.实践任务1//打印一个字符小人#include<stdio.h>intmain(){printf("o\n");printf("<H>\n");printf("II\n");return0;}  //打......
  • 实验1
    //打印一个字符小人#include<stdio.h>intmain(){printf("o\n");printf("<H>\n");printf("II\n");return0;} ......
  • 干货系列:高通量测序后的下游实验验证方法——m6A RNA甲基化篇|易基因
    大家好,这里是专注表观组学十余年,领跑多组学科研服务的易基因。此前,我们分享了m6ARNA甲基化研究的数据挖掘思路(点击查看详情),进而筛选出m6A修饰目标基因。做完MeRIP-seq测......
  • C语言实验一
    源程序1#include<stdio.h>intmain(){printf("0\n");printf("<H>\n");printf("II\n");return0;}程序截图1源程序1.2#include<stdio.h>......
  • 实验1 C语言开发环境使用和编程初体验
    1.实验任务11)#include<stdio.h>intmain(){printf("o\n");printf("<H>\n");printf("II\n");printf("o\n");printf("<H>\n");prin......
  • 实验1
    task1源代码1.1#include<stdio.h>#include<stdlib.h>intmain(){ printf("O\n"); printf("<H>\n"); printf("II\n"); printf("O\n"); printf("<H>\n......
  • Java实验-Swing 网络聊天室
    实验要求:综合Swing界面、多线程和Java的网络通信功能,实现仿QQ聊天:(1)界面设计如下:(2)要求在服务器端利用多线程响应客户端请求;//服务线程(内部类),用于处理客户端的服务线......