# remove duplicate words from a sentence # using count() string = "accessible accurate active adaptable admirable adventurous agreeable alert ambitious amiable amusing appreciative articulate artistic assertive athletic attentive attractive balanced benevolent big-thinking bold breezy brilliant calm capable captivating caring casual cautious charismatic charming cheerful clean clear-headed clever colorful compassionate complex confident conscientious conservative considerate consistent constant constructive contemplative convincing cooperative courageous courteous crafty creative cultured curious cute daring decent decisive dedicated deep delicate dependable determined dignified directed disciplined discreet dutiful dynamic earnest easygoing educated efficient elegant eloquent empathetic energetic enthusiastic ethical exciting expedient experimental extraordinary extravagant fair faithful farsighted fashionable fiery flamboyant flexible focused folksy forgiving forthright frank freethinking friendly fun-loving generous gentle genuine glamorous good-natured gracious grateful hardworking healthy helpful heroic honest honorable humble humorous hypnotic idealistic imaginative impressive incisive independent individualistic innovative insightful intelligent intense interesting intuitive inventive kind knowledgeable likable logical loquacious lovable loyal lyrical mature mellow methodical moderate modern modest neat objective open optimistic orderly organized original passionate patient patriotic peaceful perceptive personable persuasive playful polished popular practical precise principled profound protective purposeful punctual rational realistic reflective relaxed reliable resourceful respectful responsible romantic secure self-sufficient selfless sensitive sociable solid sophisticated spontaneous stable steady strong studious sweet sympathetic thorough tidy tolerant trusting uncomplaining understanding undogmatic vivacious warm well-rounded wise witty abrasive abrupt absentminded aggressive aimless aloof amoral angry antisocial anxious apathetic argumentative arrogant barbaric belligerent bewildered bigoted bizarre bland blunt boorish bossy braty brutal callous cantakerous careless catty childish clumsy cocky cold complacent conceited conformist confrontational confused controlling cowardly crass crazy critical crude cruel cynical deceitful deceptive defeated defensive demanding desperate destructive devious discontented discourteous dishonest disloyal disorganized disrespectful disruptive distant distractible disturbing dogmatic dominating domineering dull egotistical envious erratic escapist evasive fanatical fearful fickle finicky fixed flaky foolish forecful forgetful frightening frivolous fussy gloomy gossipy greedy grumpy guarded gullible hateful helpless hostile humorless hypocritical ignorant impatient impractical impressionable impulsive inattentive inconsiderate indecisive indifferent indulgent inflexible inhibited insecure insensitive insincere intolerant irrational irresponsible irritable jealous judemental know-it-all lazy macho malicious manipulative materialistic meddlesome melodramatic messy mischievous miserable miserly misguided moody morbid nagging naive narcissistic narrow-minded needy negative neglectful nervous neurotic nosy obnoxious obsessive opinionated oversensitive panicky paranoid perfectionistic pessimistic petty picky pompous possessive power-hungry predatory prejudiced presumptuous pretentious prideful pushy quarrelsome reactive reckless regretful repressed resentful rigid rude sad sadistic sanctimonious scary scatterbrained scheming secretive sedentary self-centered self-destructive self-indulgent self-loathing selfish shallow shortsighted sleazy sloppy sneaky spoiled stingy stubborn subservient sullen superficial suspicious tactless temperamental thoughtless timid unappreciative uncaring uncommunicative unconvincing uncooperative undisciplined unemotional unethical unfriendly ungrateful unimaginative unintelligent unprincipled unrealistic unreliable unruly untrusting uptight vain vindictive violent volatile vulgar vulnerable weak-willed whiny withdrawn workaholic worrier accessible active adaptable admirable adventurous agreeable alert allocentric amiable anticipative appreciative articulate aspiring athletic attractive balanced benevolent brilliant calm capable captivating caring challenging charismatic charming cheerful clean clear-headed clever colorful companionly compassionate conciliatory confident conscientious considerate constant contemplative cooperative courageous courteous creative cultured curious daring debonair decent decisive dedicated deep dignified directed disciplined discreet dramatic dutiful dynamic earnest ebullient educated efficient elegant eloquent empathetic energetic enthusiastic esthetic exciting extraordinary fair faithful farsighted felicific firm flexible focused forecful forgiving forthright freethinking friendly fun-loving gallant generous gentle genuine good-natured gracious hardworking healthy hearty helpful herioc high-minded honest honorable humble humorous idealistic imaginative impressive incisive incorruptible independent individualistic innovative inoffensive insightful insouciant intelligent intuitive invulnerable kind knowledge leaderly leisurely liberal logical lovable loyal lyrical magnanimous many-sided masculine (manly) mature methodical maticulous moderate modest multi-leveled neat nonauthoritarian objective observant open optimistic orderly organized original painstaking passionate patient patriotic peaceful perceptive perfectionist personable persuasive planful playful polished popular practical precise principled profound protean protective providential prudent punctual pruposeful rational realistic reflective relaxed reliable resourceful respectful responsible responsive reverential romantic rustic sage sane scholarly scrupulous secure selfless self-critical self-defacing self-denying self-reliant self-sufficent sensitive sentimental seraphic serious ***** sharing shrewd simple skillful sober sociable solid sophisticated spontaneous sporting stable steadfast steady stoic strong studious suave subtle sweet sympathetic systematic tasteful teacherly thorough tidy tolerant tractable trusting uncomplaining understanding undogmatic unfoolable upright urbane venturesome vivacious warm well-bred well-read well-rounded winning wise witty youthful absentminded aggressive ambitious amusing artful ascetic authoritarian big-thinking boyish breezy businesslike busy casual crebral chummy circumspect competitive complex confidential conservative contradictory crisp cute deceptive determined dominating dreamy driving droll dry earthy effeminate emotional enigmatic experimental familial folksy formal freewheeling frugal glamorous guileless high-spirited huried hypnotic iconoclastic idiosyncratic impassive impersonal impressionable intense invisible irreligious irreverent maternal mellow modern moralistic mystical neutral noncommittal noncompetitive obedient old-fashined ordinary outspoken paternalistic physical placid political predictable preoccupied private progressive proud pure questioning quiet religious reserved restrained retiring sarcastic self-conscious sensual skeptical smooth soft solemn solitary stern stoiid strict stubborn stylish subjective surprising soft tough unaggressive unambitious unceremonious unchanging undemanding unfathomable unhurried uninhibited unpatriotic unpredicatable unreligious unsentimental whimsical abrasive abrupt agonizing aimless airy aloof amoral angry anxious apathetic arbitrary argumentative arrogantt artificial asocial assertive astigmatic barbaric bewildered bizarre bland blunt biosterous brittle brutal calculating callous cantakerous careless cautious charmless childish clumsy coarse cold colorless complacent complaintive compulsive conceited condemnatory conformist confused contemptible conventional cowardly crafty crass crazy criminal critical crude cruel cynical decadent deceitful delicate demanding dependent desperate destructive devious difficult dirty disconcerting discontented discouraging discourteous dishonest disloyal disobedient disorderly disorganized disputatious disrespectful disruptive dissolute dissonant distractible disturbing dogmatic domineering dull easily discouraged egocentric enervated envious erratic escapist excitable expedient extravagant extreme faithless false fanatical fanciful fatalistic fawning fearful fickle fiery fixed flamboyant foolish forgetful fraudulent frightening frivolous gloomy graceless grand greedy grim gullible hateful haughty hedonistic hesitant hidebound high-handed hostile ignorant imitative impatient impractical imprudent impulsive inconsiderate incurious indecisive indulgent inert inhibited insecure insensitive insincere insulting intolerant irascible irrational irresponsible irritable lazy libidinous loquacious malicious mannered mannerless mawkish mealymouthed mechanical meddlesome melancholic meretricious messy miserable miserly misguided mistaken money-minded monstrous moody morbid muddle-headed naive narcissistic narrow narrow-minded natty negativistic neglectful neurotic nihilistic obnoxious obsessive obvious odd offhand one-dimensional one-sided opinionated opportunistic oppressed outrageous overimaginative paranoid passive pedantic perverse petty pharissical phlegmatic plodding pompous possessive power-hungry predatory prejudiced presumptuous pretentious prim procrastinating profligate provocative pugnacious puritanical quirky reactionary reactive regimental regretful repentant repressed resentful ridiculous rigid ritualistic rowdy ruined sadistic sanctimonious scheming scornful secretive sedentary selfish self-indulgent shallow shortsighted shy silly single-minded sloppy slow sly small-thinking softheaded sordid steely stiff strong-willed stupid submissive superficial superstitious suspicious tactless tasteless tense thievish thoughtless timid transparent treacherous trendy troublesome unappreciative uncaring uncharitable unconvincing uncooperative uncreative uncritical unctuous undisciplined unfriendly ungrateful unhealthy unimaginative unimpressive unlovable unpolished unprincipled unrealistic unreflective unreliable unrestrained unself-critical unstable vacuous vague venal venomous vindictive vulnerable weak weak-willed well-meaning willful wishful zany accepting accessible accurate active activistic adaptable admirable adventurous advocative affable affectionate agreeable alert allocentric ambitious amiable amusing anticipative appreciative artful articulate artistic aspiring athletic attentive attractive authentic balanced benevolent brave breezy bright brilliant broad-minded calm capable captivating careful caring challenging charismatic charming cheerful chummy circumspect clean clear-headed clever colorful compassionate competent complimentary conciliatory confident congenial conscientious considerate consistent constant constructive contemplative convincing cooperative courageous courteous creative cultured curious cute daring debonair decent decisive dedicated deep dependable determined dignified diligent diplomatic directed disciplined discreet dramatic dreamer driven dutiful dynamic earnest easygoing ebullient educated efficient elegant eloquent empathetic empathic encouraging energetic enthusiastic esthetic ethical exciting expressive extraordinary exuberant fair faithful fancy farsighted fashionable felicific firm flexible focused forceful forgiving forthright frank freethinking friendly fun-loving funny gallant generous gentle genuine giving good-natured gracious grateful gregarious guileless happy hardworking healthy hearty helpful heroic high-minded high-spirited honest honorable hopeful humble humorous idealistic imaginative impressive incisive incorruptible independent individualistic innovative inoffensive insightful insouciant intelligent interesting intuitive inventive invulnerable joyful kind knowledge knowledgeable leader leisurely liberal likable logical lovable loving loyal lucky lyrical magnanimous many-sided mature mellow methodical meticulous mindful moderate modern modest multi-leveled neat nice non-authoritarian nurturing obedient objective observant open open-minded optimistic orderly organized original outgoing outspoken painstaking passionate paternalistic patient patriotic peaceful perceptive perfectionist persistent personable persuasive philanthropic placid playful polished polite popular positive practical pragmatic precise principled productive professional proficient profound progressive protean protective proud providential prudent purposeful punctual pure purposeful quiet rational realistic reasonable reflective relaxed reliable reserved resilient resourceful respectful responsible responsive reverential romantic rustic sage sane scholarly scrupulous secure self-assured self-confident self-critical self-denying self-disciplined self-effacing self-reliant self-sufficent selfless sensitive sentimental seraphic serious ***** sharing shrewd simple sincere skilled skillful smart sober sociable solid sophisticated spontaneous stable steadfast steady stoic strong studious suave subtle successful supportive sweet sympathetic systematic talented talkative tasteful teacherly thorough thoughtful thrifty thrilling tidy tolerant tractable trusting trustworthy uncomplaining understanding undogmatic unfoolable unselfish upright urbane venturesome versatile vivacious warm well-mannered well-read well-rounded wholesome winning wise witty youthful zealous abrasive abrupt afraid aggressive agonizing aimless airy aloof amoral angry anxious apathetic arbitrary argumentative arrogant artificial asocial barbaric bewildered boisterous bizarre bland blunt boisterous boorish bossy brittle brutal calculating callous cantankerous careless cautious challenging charmless childish closed-minded clumsy coarse cold colorless complacent complaining compulsive conceited condemnatory conformist confused contemptible conventional cowardly crafty crass crazy criminal critical crude cruel cynical decadent deceitful deceptive delicate demanding dependent desperate destructive devious difficult dirty disconcerting discontented discouraging discourteous dishonest disloyal disobedient disorderly disorganized disputatious disrespectful disruptive dissolute dissonant distractible disturbing dogmatic domineering dull easily discouraged egocentric enervated envious erratic escapist excitable expedient extravagant extreme faithless fanatical fatalistic fawning fearful fickle fiery finicky fixed flaky flamboyant foolish forgetful fraudulent frightening frivolous gloomy graceless grand greedy grim gullible harsh hateful haughty hedonistic hesitant hidebound high-handed hostile ignorant impulsive imitative impatient impractical imprudent impulsive inconsiderate incurious indecisive indulgent inert inflexible inhibited insecure insensitive insincere insulting intense intolerant irascible irrational irresponsible irreverent irritable jealous judgmental lazy libidinous loquacious malicious manipulative mannered mannerless mawkish mealymouthed mechanical meddlesome meretricious messy mischievous miserable misguided mistaken money-minded monstrous moody morbid muddle-headed naive narcissistic narrow narrow-minded natty needy negative negativistic neglectful nervous neurotic nihilistic obnoxious obsessive obvious odd offhand one-dimensional one-sided opinionated opportunistic oppressed outrageous overbearing overimaginative paranoid passive passive-aggressive pedantic perverse pessimistic petty pharisaical phlegmatic picky plodding pompous possessive power-hungry predatory prejudiced presumptuous pretentious prim procrastinating profligate provocative pugnacious puritanical quirky reactionary reactive reckless regimental regretful repentant repressed resentful ridiculous rigid ritualistic rowdy rude ruined rustic sadistic sanctimonious sarcastic scheming scornful secretive sedentary self-centered self-indulgent selfish shallow short-tempered shortsighted single-minded sloppy slovenly sly small-thinking sneaky softheaded sordid steely stiff stingy strong-willed stubborn stupid submissive superficial superstitious surly suspicious tactless tasteless temperamental tense thievish thoughtless timid treacherous troublesome unappreciative unassertive uncaring uncertain uncharitable unconvincing uncooperative uncreative uncritical unctuous undisciplined unforgiving unfriendly ungrateful unhealthy unimaginative unimpressive unlovable unpolished unpredictable unprincipled unrealistic unreflective unreliable unresponsive unrestrained unstable vacuous vague vain venal venomous vindictive violent vulgar vulnerable weak weak-willed willful wishful absentminded ambitious amusing artful ascetic assertive authoritarian big-thinking boyish breezy businesslike busy calculating casual cerebral chummy circumspect competitive complex confidential conservative contradictory cerebral crisp cute deceptive delicate determined dominating dreamy driving droll dry earthy effeminate emotional enigmatic experimental extraverted familial feminine firm folksy formal freewheeling frugal glamorous guileless hedonistic high-spirited hurried hypnotic iconoclastic idiosyncratic impassive impersonal impressionable intense introverted invisible irreligious irreverent liberal logical manly masculine maternal melancholic mellow modern moralistic mystical neutral noncommittal noncompetitive obedient old-fashioned ordinary outspoken paternalistic patriotic physical placid political predictable preoccupied prim private progressive proud pure questioning quiet quirky religious reserved restrained retiring sarcastic self-conscious sensual shy silly skeptical slow sly smooth soft solemn solitary stern stoic strict stubborn stylish subjective surprising tough transparent trendy unaggressive unambitious unceremonious unchanging undemanding undogmatic unfathomable unhurried uninhibited unpatriotic unpredictable unreligious unsentimental well-meaning whimsical zany accepting affectionate caring compassionate empathetic happy loving sensitive warmhearted wholehearted analytical articulate bright brilliant creative curious educational imaginative ingenious inquisitive intelligent knowledgeable logical observant reflective scholarly smart thoughtful well-read witty affable amiable approachable charming communicative considerate cooperative friendly gracious hospitable humorous relational sociable supportive ethical fair faithful genuine honest honorable just principled respectful responsible righteous truthful trustworthy unbiased active adventurous ambitious daring dynamic eager energetic enthusiastic expressive fearless funny spirited vibrant youthful zestful brave courageous decisive determined firm hardworking persistent resolute steadfast strong tenacious assertive confident determined influential leaderly motivated proactive progressive strategic artful artistic creative eloquent expressive imaginative inventive observant playful wondrous cheerful easygoing empathetic fun-loving good-natured grounded honest humble idealistic inspiring kind modest noble optimistic patient peaceful pleasant selfless spiritual stable tranquil understanding dependable disciplined loyal punctual reliable stable trustworthy accomplished capable competent efficient helpful methodical organized productive skilled successful adaptable broad-minded flexible growth-oriented mindful open-minded tolerant versatile positive uplifting well-balanced agitated anxious dramatic emotional excitable frenetic frightened hysterical insecure jittery labile melancholic moody nervous overemotional overwhelmed paranoid restless tense thin-skinned tremulous worrier arrogant boastful conceited haughty know-it-all narcissistic patronizing pretentious smug vain conniving deceitful disingenuous duplicitous liar mendacious shifty sneaky untrustworthy abusive aggressive aloof anti-social belligerent brutal bullying criminal cruel destructive hostile jealous malicious manipulative ruthless sadistic violent bigoted dogmatic intolerant judgemental narrow-minded xenophobic abrasive blunt callous careless disrespectful inconsiderate insensitive rude tactless uncaring uncharitable unfriendly apathetic complacent indolent lazy procrastinator irresponsible undisciplined cowardly insecure timid unconfident bitter cynical negative pessimistic resentful sulky compulsive impatient impetuous impulsive reckless foolish frivolous immature juvenile silly egocentric hedonistic self-centered self-destructive selfish bizarre idiosyncratic odd strange amoral fanatical zealot zealous angry annoying arbitrary artificial clueless clumsy crude devious difficult dishonest disorganized distracted distraught dominating envious fickle greedy harsh ignorant inappropriate inconsistent insincere intemperate irritable jealous mischievous morbid obstinate overbearing passive-aggressive petty phony stubborn superficial unethical ungrateful unhelpful unimaginative unintelligent unkind unreliable unsympathetic unwise vengeful weak whiny accepting acclaimed accommodating accomplished admirable advanced adventurous amusing artful artistic assertive authentic bold brainy brave brilliant broad-minded captivating careful charitable charming collaborative concerned considerate constant creative daring dazzling delightful discerning eager ebullient educated educational eloquent empathetic encouraging engaging exceptional exciting extraordinary exuberant farsighted fascinating fearless forthcoming fun fun-loving funny gentle glad growth-oriented happy health-conscious high-achieving impressive incorruptible influential inspiring interesting invigorating irrepressible joyful judicious leaderly level-headed leveled-headed likable lovable magnanimous masterful mighty multi-talented noteworthy organized outgoing peaceable percipient permissive perspicacious pioneering playful pleasant polished popular powerful productive prolific punctual quick-witted relational righteous risk-taking sagacious savvy self-confident self-disciplined selfless service-oriented significant situational smart sociable staunch strategic teachable tenacious thoughtful tireless unbiased upbeat uplifting vivid welcoming well-balanced well-informed well-read wholehearted willing wondrous abhorrent abrasive abusive addictive aggressive agitated ***** ambiguous amoral angry angst-ridden annoying antagonistic anti-social anxious arrogant artificial artless asinine aspersive assailable autocratic avoidant awful babbler backbiting backstabbing bad-mannered banal barbarous barren bawdy belittling belligerent bigoted bitter bizarre blase blind blundering boastful boorish boring bossy braggart brash brutal brutish bullying bumptious burdensome callous cantankerous careless carnal caustic censorious chauvinistic clannish closed-minded clueless clumsy coarse cold cold-hearted complacent conceited condescending confused conniving contemptuous contentious contrary cowardly crabby crass crazed crazy criminal critical crude cruel curmudgeonly daft damaging debauched deceitful defamatory defensive degenerate degraded demeaning demoralizing dense dependent derisive desperate despicable despiteful destructive devious difficult dim dimwitted discompassionate discontented dishonest disingenuous disloyal dismissive disorderly disorganized disparaging disrespectful disruptive dissolute distasteful distracted distraught disturbing dogmatic doltish dominating domineering dramatic dreadful dreary drudging drunkard dull duplicitous dysfunctional egocentric embarrassing envious erring exacting excitable exhausting extravagant extremist fanatical feckless feeble fickle fiendish foolish foppish foul fractious frenetic frenzied frightened frivolous frothy furtive garrulous gloomy gluttonous greedy grim gross grumpy gullible gutless halfwitted harmful harsh hateful haughty hedonistic hellish horrible hostile hurtful hypocritical hysterical iconoclast idle ignoble ignorant ill-bred ill-mannered ill-natured immature immoral impatient impertinent impetuous impious impolite impractical improper imprudent impudent impulsive inadequate inane inappropriate inconsiderate inconsistent incorrigible indecorous indiscreet indolent ineffectual inefficient inescapable inhibited insecure insensitive insidious insincere insipid insolent insufferable insular intemperate intolerant intransigent intrusive invidious irascible irksome irreligious irresolute irresponsible irritable irritating jealous jittery judgemental judgmental juvenile knavish know-it-all labile lackadaisical lame lascivious lazy lecherous lewd liar libertine loathsome long-winded loquacious loud loutish low lukewarm lurid mad maladroit malcontented malevolent malicious malignant malingering mandatory maniacal manipulative maudlin meek megalomaniacal melancholic mendacious merciless messy mischievous miserable misguided mocking monotonous moody morbid morose mundane murky naive narcissistic narrow narrow-minded nasty needy negative nervous neurotic nihilistic nitpicky noisome noxious oblivious obnoxious obsessive obstinate obstreperous obtuse odd odious offensive ominous oppressive overbearing overblown overemotional overwhelmed overwrought painful paranoid passive passive-aggressive pathetic pathological patronizing pedantic peevish perfidious perverse pessimistic petty petulant pharisaic phony pitiful poisonous pouty pretentious prideful procrastinator profane punitive quarrelsome queasy querulous questionable racist rambunctious rancid rancorous reckless remiss remorseless repellant reprehensible repressed repressive reprobate repugnant repulsive resentful restless retaliatory reticent revolting ridiculous risible rude ruthless sadistic salacious sanctimonious sappy sarcastic scandalous scornful screechy secretive self-centered self-conscious self-destructive selfish sensationalist senseless shallow shameful shiftless shifty short-tempered shy silly simplistic sinful single-minded skittish slanderous sleazy slimy sloppy slow slow-witted sluggish sly small-minded smug sneaky snide snobby sordid spineless spiteful stagnant stern sticky stiff stingy strange strife-ridden stupefying stupid stuttering sublunary sulky superficial surly suspicious tactless tasteless tawdry teasing tedious tense terrible testy thin-skinned thoughtless threatening timid tired tiresome tone-deaf totalitarian touchy toxic tremulous tricky trite truculent unappreciative unapproachable uncaring uncharitable uncivil unclean uncommunicative uncompetitive unconcerned unconfident uncooperative uncreative unctuous uncultured undermining undisciplined uneducated unethical unfriendly ungoverned ungrateful unhealthy unhelpful unimaginative unintelligent uninteresting unjust unkind unknowledgeable unlikable unmannerly unpalatable unpleasant unprincipled unproductive unrealistic unrefined unreflective unreliable unreserved unruly unscrupulous unseemly unsightly unsuitable unsympathetic untactful unteachable untoward untrustworthy unvirtuous unwise unwitting unworthy unyielding vain venal vengeful venomous vicious victimized vile villainous vindictive violent virulent vulgar wanton wasteful weak wearisome whiny wicked woeful worrier worthless wretched wrongheaded xenophobic zealot " words_str = string.split() result = [] for word in words_str: # store unique words in list if (string.count(word)>=1 and (word not in result)): result.append(word) print(' '.join(result))
Write, Run & Share Python code online using OneCompiler's Python online compiler for free. It's one of the robust, feature-rich online compilers for python language, supporting both the versions which are Python 3 and Python 2.7. Getting started with the OneCompiler's Python editor is easy and fast. The editor shows sample boilerplate code when you choose language as Python or Python2 and start coding.
OneCompiler's python online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample python program which takes name as input and print your name with hello.
import sys
name = sys.stdin.readline()
print("Hello "+ name)
Python is a very popular general-purpose programming language which was created by Guido van Rossum, and released in 1991. It is very popular for web development and you can build almost anything like mobile apps, web apps, tools, data analytics, machine learning etc. It is designed to be simple and easy like english language. It's is highly productive and efficient making it a very popular language.
When ever you want to perform a set of operations based on a condition IF-ELSE is used.
if conditional-expression
#code
elif conditional-expression
#code
else:
#code
Indentation is very important in Python, make sure the indentation is followed correctly
For loop is used to iterate over arrays(list, tuple, set, dictionary) or strings.
mylist=("Iphone","Pixel","Samsung")
for i in mylist:
print(i)
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while condition
#code
There are four types of collections in Python.
List is a collection which is ordered and can be changed. Lists are specified in square brackets.
mylist=["iPhone","Pixel","Samsung"]
print(mylist)
Tuple is a collection which is ordered and can not be changed. Tuples are specified in round brackets.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
Below throws an error if you assign another value to tuple again.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
myTuple[1]="onePlus"
print(myTuple)
Set is a collection which is unordered and unindexed. Sets are specified in curly brackets.
myset = {"iPhone","Pixel","Samsung"}
print(myset)
Dictionary is a collection of key value pairs which is unordered, can be changed, and indexed. They are written in curly brackets with key - value pairs.
mydict = {
"brand" :"iPhone",
"model": "iPhone 11"
}
print(mydict)
Following are the libraries supported by OneCompiler's Python compiler
Name | Description |
---|---|
NumPy | NumPy python library helps users to work on arrays with ease |
SciPy | SciPy is a scientific computation library which depends on NumPy for convenient and fast N-dimensional array manipulation |
SKLearn/Scikit-learn | Scikit-learn or Scikit-learn is the most useful library for machine learning in Python |
Pandas | Pandas is the most efficient Python library for data manipulation and analysis |
DOcplex | DOcplex is IBM Decision Optimization CPLEX Modeling for Python, is a library composed of Mathematical Programming Modeling and Constraint Programming Modeling |