Skip to main content
deleted 2 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Explanation

@(s) % Anonymous function with input s: row vector of chars 65:90 % Row vector with ASCII codes of uppercase letters upper(s) % Input converted to uppercase ' % Transform into column vector == % Equality test, element-wise with broadcast. Gives a % matrix containincontaining true and false any( ,1) % Row vector containing true for columns that containhave at % at least one entry with value true mean( ) % Mean 

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Explanation

@(s) % Anonymous function with input s: row vector of chars 65:90 % Row vector with ASCII codes of uppercase letters upper(s) % Input converted to uppercase ' % Transform into column vector == % Equality test, element-wise with broadcast. Gives a % matrix containin true and false any( ,1) % Row vector containing true for columns that contain % at least one entry with value true mean( ) % Mean 

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Explanation

@(s) % Anonymous function with input s: row vector of chars 65:90 % Row vector with ASCII codes of uppercase letters upper(s) % Input converted to uppercase ' % Transform into column vector == % Equality test, element-wise with broadcast. Gives a % matrix containing true and false any( ,1) % Row vector containing true for columns that have at % least one entry with value true mean( ) % Mean 
deleted 6 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Explanation

@(s) % Anonymous function with input s: row vector of chars 65:90 % Row vector with ASCII codes of uppercase letters upper(s) % Input converted to uppercase ' % Transform into column vector == % Equality test, element-wise with broadcast. Gives a % matrix containin true and false any( ,1) % Row vector containing true for columns that contain % at least one entry with value true mean( ) % Mean 

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

Explanation

@(s) % Anonymous function with input s: row vector of chars 65:90 % Row vector with ASCII codes of uppercase letters upper(s) % Input converted to uppercase ' % Transform into column vector == % Equality test, element-wise with broadcast. Gives a % matrix containin true and false any( ,1) % Row vector containing true for columns that contain % at least one entry with value true mean( ) % Mean 
deleted 6 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave / MATLAB, 32 3133 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!Try it online!

Octave / MATLAB, 32 31 bytes

@(s)mean(any(65:90==upper(s)')) 

Try it online!

Octave / MATLAB, 33 bytes

@(s)mean(any(65:90==upper(s)',1)) 

Try it online!

deleted 47 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading