Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

min, max characters

//Use the code below to set min and max characters for an input
//grabbing element from the DOM
const username = document.getElementById('username');

function checkLength(input, min, max) {
  if(input.value.length < min)
  {//below can be applied to a field, etc
    console.log(`${input.id} must be at least ${min} characters`)
  }
  else if(input.value.length > max){
    console.log(`${input.id} must be less than ${max} characters`)
  }
}
//call function
checkLength(username, 3, 15)
Comment

find max, min character

t = input("your text>>")
min_char = t[0]
max_char = t[0]

for item in t:
    if item<min_char:
      min_char = item
    if item>max_char:
      max_char = item

print(f"min_char: {min_char}")
print(f"max_char: {max_char}")
Comment

PREVIOUS NEXT
Code Example
Python :: python multilevel list comprehension 
Python :: code help 
Python :: python unresolved import local visual studio code 2019 
Python :: 1007 solution python 
Python :: pyglet key hold 
Python :: https://raw.githubusercontent.com/tim-yao/lighthouse-ci/d32f465bb6cda08ded4ce25c88c43a3103e4940a/.browserslistrc 
Python :: vijay 
Python :: find root of the path of file os package 
Python :: can I activate a function inside the definition of the same function 
Python :: numpy generlized ufunc 
Python :: python tf.maximum 
Python :: how to add import pydictionary in python 
Python :: python execute echo to file 
Python :: how to go from a url with a zip file to a csv 
Python :: python RandomForest 
Python :: Access value 
Python :: python slicing string 
Python :: gricsearchcv sample_weights 
Python :: How to Empty a Set in Python Using the clear() Method 
Python :: json file download 
Python :: python too many values to unpack 
Python :: python null check optional 
Python :: python if modulo 
Python :: valueerror python list 
Python :: python c api 
Python :: self argument in python 
Python :: python is not operator 
Python :: three periods in python 
Python :: Abstract Model inherit from another model django 
Python :: frequency domain parameter of speech 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =