15 ответов
+ 4
mohammad amin soltani int(input()) for a number but if u want that each number he inputs like 123765 and u want to convert them into a list, so u can do it by using split.
int(input()).split()
Now it would turn into [1,2,3,7,6,5]
If they have spaces in them like 1 2 3 7 6 5 in input then change ur code a bit and add a space in split like,
int(input()).split(" ") so that it splits all the items aside of spaces into a list.
+ 3
For getting average of your list you can try the following code:
n=eval(input("Enter List :"))
m=len(n)
print("Average of list:", sum(n)/m)
+ 3
I’m not sure I got what you want to do, but you can try this
print(list(input()))
+ 2
Mohammad amin soltani
If you want to input list you can use eval function...
n=eval(input("Enter list:"))
#[2,5,7,8, 9]
And if integer then
n=int(input("Enter no.:"))
+ 2
Great! You are professional
+ 2
🙂😄👍 I am also learning Python ...
+ 1
If user enter 100 the output is 99 98 97 ............etc .. CHECK this code ...
https://code.sololearn.com/cpQFmIcKvhj4/?ref=app
0
How?
0
Thank you, but I want to recieve one list, can I want user to intern his list?and if you say yes tell me how, please.
0
Okay, thank you.
0
Whoops?
0
Infact I want to write a code that give the user average of his list .
0
Thanks
0
PsychoPython loll no man, just on an intermediate lvl, thnx tho
0
If data type is int() use int(input()) following the former if input has have certain separators use int(input).split("separator") to pack them in list form ,in case of data type string use input() directly rest same as int() to collect in form of list