osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

My pseudocode to Python?


On 8/19/19 10:43 AM, Stefan Ram wrote:
>    Can someone kindly translate my pseudocode to terse Python:
> 
> list = \
> [ 'afaueghauihaiuhgaiuhgaiuhgaeihui',
>    'erghariughauieghaiughahgaihgaiuhgaiuh',
>    'rejganregairghaiurghaiuhgauihgauighaei',
>    if x: 'argaeruighaiurhauirguiahuiahgiauhgaeuihi',
>    'reiugaheirughauierhgauiaeihauiehgiuaehuih'
>    'ejiaeigaiuegreaiugheiugheaiughauighaiughaiu'
>    'egairughauirghauiruiegihgruiehgiuaehgiaue' ]
> 
>    ? I want the list to have the seven strings shown as entries
>    if bool(x) is True, but otherwise the list should only have
>    six entries - without the entry directly behind "if x: ".
> 
> 

mylist = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
if not x:
    del mylist[3]


-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.