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.

enter image description here

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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -