我目前正在学习Python,并编写了一个程序来试验这门语言.但是,每当我使用它时,输出总是在其中有一个字母"u".我正在使用Pyscripter作为我的IDE.
这是我的代码:
print "whats your name"
age = raw_input()
print "Alright, so %r, I just realized what percent-r does actually or is meant for" % (age)
print "What next ur age",
age1 = raw_input()
print "you entered %r " % (age1)
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我看到这样的事情:
>>> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32.
>>> whats your name (i typed kk)
>>> Alright, so u'kk', i just realized what percent-r does actually or is meant for
>>> …Run Code Online (Sandbox Code Playgroud) 我做了一个密码检查程序,检查以下标准: -
至少应该有
就是这样.我没有给出任何下限.无论我给出什么输入(正确或不正确),程序都会给我与截图中附带的相同或类似的输出.
对于如: - ,Pratik10,pratik10,pratikten,pr@tiK10我得到的结果相同"Password is fine and valid".
为什么我的程序没有正确检查定义的条件?它甚至没有正确打印密码的计数器.
以下是我的代码:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
int main()
{
char x[100];
int i;
int uc=0;
int lc=0;
int num=0;
int misc=0;
printf("enter your password\n");
scanf("%s",x);
for(i=0;i<100;i++) {
if (isalpha(x[i])) {
if (isupper(x[i])) {
uc++;
}
if (islower(x[i])) {
lc++;
}
}
if (isdigit(x[i])) {
num++;
} …Run Code Online (Sandbox Code Playgroud)