Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* Adator. prog.
  + feladatsor
  + quick link

Teaching

* Prog. for Data Sci.
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2025/26/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Number of occurrences

See also std.algorithm.searching.

(1) count() with strings
def main():
    s = "aa.bb.cc.dd"

    print(s.count("."))  # 3
import std.stdio;
import std.algorithm.searching;  // count()

void main()
{
    string s = "aa.bb.cc.dd";

    writeln(s.count(".")); // 3
}

It works with lists too

(2) count() with lists
def main():
    #        v     v     v
    li = [1, 2, 6, 2, 9, 2]

    print(li.count(2))  # 3
import std.stdio;
import std.algorithm;

void main()
{
    //            v     v     v
    auto li = [1, 2, 6, 2, 9, 2];

    writeln(li.count(2)); // 3
}
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 July 08, 23:02