SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

I don't know how to code "Counting Cards", can you give me some prompt?

Altcademy Team wrote on 7 February 2018


Here is a pseudo code I would give you as prompt:
var count = 0; function cc(card) { // Only change code below this line // Modify count based on value of card // count++ if card is 2, 3, 4, 5, 6 // count-- if card is 10, 'J', 'Q', 'K', 'A' // else, don't modify count // If count > 0 return count + " Bet" // If count <= 0 return count + " Hold" // Only change code above this line } // Add/remove calls to test your function. // Note: Only the last will displaycc(2); cc(3); cc(7); cc('K'); cc('A');

Trusted by

Students and instructors from world-class organizations

Imperial College London
Carnegie Mellon University
City University of Hong Kong
Hack Reactor
Cisco Meraki
University of Oxford
Swift
Bazaarvoice
Waterloo
Uber
AtlanTech
Tumblr
Boston College
Bombardier Aerospace
University of St. Andrews
New York University
Minerva Schools at KGI
Merrill Lynch
Riot Games
JP Morgan
Morgan Stanley
Advanced Placement®
Google
KPMG
The University of Hong Kong
University of Toronto
SCMP
Moat
Zynga
Hello Toby
Deloitte
Goldman Sachs
Yahoo
HSBC
General Assembly
Tesla
McGill University
Microsoft

Join the upcoming Cohort #97

Enroll for January 6th, 2025