python - Print to same line -
i new stack overflow , have question regarding jython. don't know if same python syntax applies or not. lay question out , see have say.
this trying accomplish:
define function takes list , number parameters. function prints numbers in list bigger number (the second parameter). function returns how many such bigger numbers exist in list.
call function twice following 2 sets of parameter respectively:
list1=[1, 4, 6 , 9, 5, 3, 0] num1=3 list1=[9, 4, 6 , 9, 5, 3, 2] num1=9
i realize coding might messy month learning this, or pointers appreciated in how structure code.
thanks!
you can use list comprehension
:
def count_modify(l, n): print [i in l if > n] count_modify([1, 4, 6 , 9, 5, 3, 0], 3) count_modify([9, 4, 6 , 9, 5, 3, 2], 9)
output:
[4, 6, 9, 5] []
Comments
Post a Comment