gmary
发表于 2016-9-21 18:56:23
def my_abs(x):
if not isinstance(x,(int,float)):
raise TypeError('bad operand type')
if x >= 0:
return x
else:
return -x
print u'请输入数字:'
x=raw_input();
xx=my_abs(int(x))
print x+u'的绝对值为:%d' % xx
新人一枚,刚刚学习
汪福贵
发表于 2016-9-21 19:51:20
#include<stdio.h>
#define I a;
#define you b;
void main()
{
int i,j;
i=&a,j=&b; //取a和b的地址
printf("I的地址是%o\nyou的地址是%o",i,j);
if(i>j)
printf(you去拿外卖);
if(i<j)
printf(I去拿外卖);
if(i=j)
printf(I和you一起去拿外卖);
}
wu8113
发表于 2016-9-21 20:14:29
a=input('请输入你想说的话:')
print (a)
domenet
发表于 2016-9-21 21:16:14
eval('0-0')
sundance
发表于 2016-9-21 22:44:12
#include<stdio.h>
int main()
{
printf("hello world!\n");
return 1;
}
新手一枚
白小奕
发表于 2016-9-21 23:03:44
刚学汇编没多久,试着写几行代码,各位见笑{:10_250:}
data segment
string db 'hello word !',13,10,'$'
data ends
code segment
assume cs:code,ds:data
start:movax,data
mov ds,ax
lea dx,string
mov ah,9
mov ax,4c22h
int 21h
code ends
end start
lili200238
发表于 2016-9-21 23:53:57
main()
{
char i,j,k;/*i是a的对手,j是b的对手,k是c的对手*/
for(i='x';i<='z';i++)
for(j='x';j<='z';j++)
{
if(i!=j)
for(k='x';k<='z';k++)
{ if(i!=k&&j!=k)
{ if(i!='x'&&k!='x'&&k!='z')
printf("order is a--%c\tb--%c\tc--%c\n",i,j,k);
}
}
}
穷举法,今天看了好久才明白,大家学习是这样吗?感觉这样学习效率太低了{:10_266:}
一瞬之光
发表于 2016-9-22 00:10:17
temp = input('请输入一个数字计算它的阶乘')
while True:
if temp.isdigit():
number = int(temp)
while True:
a = 1
for i in range(number):
product = a*(i+1)
a = product
print(product)
temp = input()
if temp.isdigit():
number = int(temp)
else:
temp = input('输入有误,请重新输入')
else:
temp = input('输入有误,请重新输入')
浅葱白雪
发表于 2016-9-23 14:58:43
clear=list()
srect=list()
Da=['A','B','C','D','E','F','G','H','I','J','K','M','L','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
Xa=['a','b','c','d','e','f','g','h','i','j','k','m','l','n','o','p','q','r','s','t','u','v','w','x','y','z']
i=0
clear=list(input("请输入明文:"))
i=0
for i in range(len(clear)):
ifclear>='a' and clear<='z':
x=Xa.index(clear)
srect.append(Xa)
ifclear>='A' and clear<='Z':
x=Da.index(clear)
srect.append(Da)
else:
srect.append(clear)
i+=1
i=0
while i<len(srect):
print(srect,end='')
i+=1
两月之前做的题,不知道是哪的题,解密的
尛善领主
发表于 2020-1-25 17:56:25
while '无限'
成功一水
张林要努力啊
发表于 2020-1-31 11:39:06
#include <stdbool.h>
#include <stdio.h>
int main(void)
{
bool digit_seen = { false };
int a = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int b = { 0 };
int i;
int digit;
long n;
printf("Enter a number: ");
scanf("%ld", &n);
while (n > 0) {
digit = n % 10;
n /= 10;
b++;
}
printf("digit: ");
for (i = 0; i < 10; i++)
printf("%2d", a);
printf("\n");
printf("Occurrences;");
for (i = 0; i < 10; i++)
printf("%2d", b);
return 0;
蒋博文
发表于 2020-2-4 18:00:36
#include <stdio.h>
#define URL "http://www.fishc.com"
#define NAME "鱼C工作室"
#define BOSS "小甲鱼"
#define YEAR 2010
#define MONTH 5
#define DAY 20
int main()
{
printf("%s成立于%d年%d月%d日\n",NAME,YEAR,MONTH,DAY);
printf("%s是%s创立的...嘻嘻嘻,有点不好意思了\n",NAME,BOSS);
printf("%s的域名是%s\n",NAME,URL);
return 0;
}
神奇大大卷
发表于 2020-2-17 21:59:34
zifu=input("猜一猜正确的数字是什么:")
cai=int(zifu)
while cai != 8:
zifu=input("again:")
cai=int(zifu)
if cai==8:
print("你答对了")
print("非常好")
else:
if cai >8:
print('大了')
else:
print('小了')
print("结束了")
这个是看了视频后 自己写的。新手见谅。
丸子吃樱桃
发表于 2020-2-19 13:04:48
print ("hello,我是你的小计算机\n请在下方>>>处输入计算题来考考我吧!")
一个大白萌
发表于 2020-2-25 11:51:54
while 1 > 0:
b = int(input("请写入你的颜值:"))
if b > 100:
print('别做梦了,你这个丑八怪!')
break
elif b > 95:
print('倾国倾城')
elif:
if b > 80:
print('美女')
elif:
if b > 60:
print('还可以')
else:
print('路人甲')
sailortech
发表于 2020-2-26 10:48:08
#include<stdio.h>
int main()
{
printf("hello world!");
return 0;
}
这是我接触的第一个程序,C语言赛高!!!!!
wuqramy
发表于 2020-2-26 11:34:36
from easygui import *
import pickle
persondict = {}
f = open('C:\\little jiayu Python study\\我的练习\\persondict.txt','wb')
pickle.dump(persondict,f)
f.close()
pkl_file = open('C:\\little jiayu Python study\\我的练习\\persondict.txt','rb')
persondict = pickle.load(pkl_file)
pkl_file.close()
cheese = ['*用户名','*生日','电话号码','爱好','*用户密码']
cheese2 = ['用户名','生日','电话号码','爱好','用户密码']
list2 = []
msgbox('欢迎使用个人信息程序','个人信息程序')
while 1:
choose = buttonbox('请选择您需要的服务','个人信息程序',choices = ('添加个人信息','查询个人信息','退出程序'))
if choose == '添加个人信息':
while 1:
msgbox('好的,即将进入编辑界面...','个人信息程序')
list1 = list(multpasswordbox('用户信息编辑界面[带*的为必填项]','个人信息程序',cheese))
if list1 == '' or list1 == '' or list1 == '':
msgbox('必填项未填写完整!','个人信息程序',ok_button = '返回,重新填写')
continue
else:
break
persondict = {list1:list1}
msgbox('保存成功!','个人信息程序')
f = open('C:\\little jiayu Python study\\我的练习\\persondict.txt','wb')
pickle.dump(persondict,f)
f.close()
continue
elif choose == '查询个人信息':
while 1:
find = enterbox('请输入需要查找的用户名:','个人信息程序')
try:
fined = persondict
except KeyError:
msgbox('查找的用户不存在!','个人信息程序',ok_button = '返回,重新查找')
continue
msgbox('好的,即将显示用户资料...','个人信息程序')
msgbox('查询结果:' + '\n用户名:' + find + '\n生日:' + fined + '\n电话号码:' + fined + '\n爱好:' + fined + '\n密码:' + fined,'个人信息程序')
continue
else:
msgbox('好的,即将退出程序...','个人信息程序')
break
luobei
发表于 2020-2-26 11:40:21
#include<stdio.h>
int main()
{
printf("hello world!");
return 0;
}
刚开始学
王奥运
发表于 2020-2-27 16:09:51
def feber(n):
if n<=2:
return 1
else:
return feber(n-2)+feber(n-1)
江程
发表于 2020-3-17 20:33:08
import random
secret = random.randint(1,10)
print('········我爱宝宝········')
temp = input("不妨猜一下我现在心里面想的是哪个数字:")
n = 1
guess = int(temp)
while guess !=secret and n<3:
temp = input("哎呀,猜错了,请重新输入吧:")
n=n+1
guess = int(temp)
if guess == secret:
print("宝宝真聪明")
print("奖励宝宝一个亲亲")
else:
if guess > secret:
print("宝宝,大了大了~~")
else:
print("嘿,小了!小了!!")
print("游戏结束,不玩啦^_^")
嘿嘿,第4讲之后完成的