Facebook
From Ivory Prairie Dog, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 137
  1. Soru:
  2.  
  3. Write a function, length, that takes in a list as the input.
  4. If the length of the list is greater than or equal to 5, return "Longer than 5".
  5. If the length is less than 5, return "Less than 5".
  6.  
  7. Cevap:
  8.  
  9. listegir = input("Listenin elemanlarını giriniz: ")
  10. Liste = listegir.split()
  11. def length(Liste):    
  12.     for i in Liste:    
  13.         if len(Liste) >= 5:        
  14.             return "Longer than 5"    
  15.         else:        
  16.             return "Less than 5"
  17. print(length(Liste))