This is my code:
import os
from typing import Mapping
from colorama import Fore , init
init()
os.system("cls" or "clear")
clear = lambda: os.system('cls')
#GIVE A NUMBER
num = int(input(Fore.GREEN+"Please Enter A Number: "))
#GIVE A LIST NUMBER
listed = input(Fore.GREEN+"Please Enter A List Of Number: ")
# CONVERT INPUT(STR) TO LIST:
listed = [listed]
#CONVERT LIST(STR) TO LIST(INT)
listed= list(map(int, listed))
#APPEND NUMBER TO LIST:
listed.append(num)
#SORT LIST
listed = listed.sort()
#PRINT LIST
print(Fore.RED+listed)
and i got these error: Please Enter A Number: 12
Please Enter A List Of Number: 12,35,25
Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\roya\1.py", line 14, in
listed= list(map(int, listed))
ValueError: invalid literal for int() with base 10: '12,35,25'
What should i do to convert all number is in input to int????
os.system("cls" or "clear")only works on Windows."cls" or "clear"always evaluates to"cls". You need to actually test the platform to determine which one to use if you want it to be portable. - ShadowRanger