小编dav*_*wad的帖子

Python:函数定义在所需输出的中间保持返回"None"

好的,所以我为我的女朋友为我们的6周年纪念做代码.我是编程的完整菜鸟.我正在编写一些非常简单的代码,基本上是数字输入的输入输出机器,以便用户(她)接收字符串输出.

当我运行我的代码时,我一直看到"无".为什么?开始.

def love(n):
  if n < 0 : 
    print "Why would it be negative?!" 
  if n == 0 : 
      print "well that is just hurtful" 
  if n == 1 :
    print "I REALLY love you" 
  if n == 2 : 
    print "You make me smile at least once, each and every day"
  if n == 3 : 
    print"you wouldn't believe how annoying it was to get this program to run properly! but it was worth it"
  if n == …
Run Code Online (Sandbox Code Playgroud)

python

1
推荐指数
1
解决办法
408
查看次数

n == 7给我一个缩进错误

# Rate Our Love !! 

def love(n):
    if n < 0 : 
        print "Why would it be negative?!" 
    elif n == 0 : 
        print "well that is just hurtful" 
    elif n == 1 :
        print "I REALLY love you" 
    elif n == 2 : 
        print "You make me smile at least once, each and every day"
    elif n == 3 : 
        print"you wouldn't believe how annoying it was to get this program to run properly! but it was worth it" …
Run Code Online (Sandbox Code Playgroud)

python

1
推荐指数
1
解决办法
72
查看次数

带C的多个条件编译宏

我正在尝试设置一个makefile来编译一个相当迟缓的程序的多个段.为了做到这一点,我希望Makefile能够一次传递MULTIPLE调试标志所以我可以一起测试多个不同的函数集.

所以在我的Makefile中:

debug:
    gcc -Wall -O -o my_malloc main.c -D experimental leak  <-- SECOND FLAG
    ./my_malloc 
Run Code Online (Sandbox Code Playgroud)

在我的C代码中我想做:

    #ifdef experimental
        printf("MALLOC PROGRAM IN DEBUGGING MODE\n");
    #endif
    //executing both conditionals at once in one line. 
    #ifdef leak
    puts("TESTING LEAK DETECTION");
    #endif
Run Code Online (Sandbox Code Playgroud)

c gcc makefile conditional-compilation compiler-flags

0
推荐指数
1
解决办法
889
查看次数