Posts

Showing posts with the label Codig

Variable & Data Types (Session 3)

 Variable: A variable is a name given to a memory location in a program.  Variables do not need to be declared with any particular  type , and can even change type after they have been set. For example: a = 28 b =21.26 c ="Mustajab" In short, we can say that here variable is a container to store a value . Example: x = 28 y =  "Mustajab" print (x) print (y) Here Mustajab is str type and 28 is int type. Many Values to Multiple Variables: Python allows us to assign values to multiple variables in one line: x, y, z =  "Student1" ,  "Student2" ,  "Student3" print (x) print (y) print (z) Rules for defining a variable name:  A variable name can contain alphabets, digits, and underscore. A variable name can only start with an alphabet and underscore. A variable can’t start with a digit. No white space is allowed to be used inside a variable name. Task : Read about Whitespace Characters in Python. Data Type: Python is a great language that...

How to add Timer in Your C++ Program:

 Use this code to add Timer in your code for Linus use clear instead of cls: #include <iomanip>  #include <iostream>  #include <stdlib.h>  #include <unistd.h>  using namespace std;     // hours, minutes, seconds of timer  int hours = 0;  int minutes = 0;  int seconds = 0;     // function to display the timer  void displayClock()  {      // system call to clear the screen      system("cls");         cout << setfill(' ') << setw(55) << "         TIMER         \n";      cout << setfill(' ') << setw(55) << " --------------------------\n";      cout << setfill(' ') << setw(29);      cout << "| " << setfill('0') << setw(2) << hours << " hrs | ";      c...