Python and C++ (Partial) Syntax Comparison
Syntax  Description Python C++
 including a module/library  from math import *  #include <cmath>
 assignment operator  =, +=, -=, *=, /=, %=  same
 type integer value  int, long  short, int, long
 type decimal value  float  float, double, long double
 type boolean  bool: True/False or (not 0)/0  bool: true/false or (!0)/0
 type character  none  char
 type string  str  char mystring[50] or string
 for statement  for i in range(10):  for(i = 0; i < 10; i++)
 if statement  if x != 3:  if (x != 3)
 while statement  while x != 3:  while (x != 3)
 break out of a loop  break  same
 function definition  def myfunction():  int myfunction()
 function call  myfunction()  same
 and operator  and  &&
 or operator  or  ||
 not operator  not  !
 comparison operators  ==, !=, <, <=, >, >=  same
 arithmetic operators  +, -, *, /, %  same
 comments - single line  #  //
 comments - multiple lines  none  (but """triple-quoted strings""" are sometimes used)  /*    */
 pre and post increment/decrement operators  none  ++x, x++, --x, x--
 code blocks  via indentation  { }
 statement separator  end of line  ;
 constants  none  const int RATE = .018
 Input/Output  input, print  cin, cout, and many others.