Difference between revisions of "Z3/Z3Clarifications"
Jump to navigation
Jump to search
m |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
*[[ Z%5E3_Language_Documentation | Z3 Language Documentation]] | *[[ Z%5E3_Language_Documentation | Z3 Language Documentation]] | ||
| − | + | Clarifications on Z3 | |
| − | |||
| − | + | Q 24. In how many different ways can the letters of the word 'CORPORATION' be arranged so that the vowels always come together? | |
| − | word = "CORPORATION"; | + | How do we get a subset of a string value without using loop |
| − | vowels ="AEIOU"; | + | Ans: |
| − | vowelsarray=vowels.split(""); | + | word = "CORPORATION"; |
| − | + | vowels ="AEIOU"; | |
| − | wordletterswithoutvowels=word.split("").filter((x)=>!x.isin(vowelsarray)); | + | vowelsarray=vowels.split(""); |
| − | OR | + | wordletterswithoutvowels=word.split("").filter((x)=>!x.isin(vowelsarray)); |
| − | IsNotAVowel:=!x.isin(vowelsarray); | + | OR |
| − | word.split("").filter(IsNotAVowel); | + | IsNotAVowel:=!x.isin(vowelsarray); |
| − | OR | + | word.split("").filter(IsNotAVowel); |
| − | IsNotAVowel:=!x.isin("AEIOU".split("")); | + | OR |
| − | word.split("").filter(IsNotAVowel); | + | IsNotAVowel:=!x.isin("AEIOU".split("")); |
| − | + | word.split("").filter(IsNotAVowel); | |
| − | Result => CRPRTN | + | Result => CRPRTN |
| − | |||
Latest revision as of 00:16, 30 August 2016
Z3 Clarifications
Clarifications on Z3
Q 24. In how many different ways can the letters of the word 'CORPORATION' be arranged so that the vowels always come together?
How do we get a subset of a string value without using loop
Ans:
word = "CORPORATION";
vowels ="AEIOU";
vowelsarray=vowels.split("");
wordletterswithoutvowels=word.split("").filter((x)=>!x.isin(vowelsarray));
OR
IsNotAVowel:=!x.isin(vowelsarray);
word.split("").filter(IsNotAVowel);
OR
IsNotAVowel:=!x.isin("AEIOU".split(""));
word.split("").filter(IsNotAVowel);
Result => CRPRTN