Sunday, 26 April 2020

What is Variable, Datatype and C# Datatypes

Variables :
  • It is location in memory (RAM) to temporary store a value during execution of Program / Software.
  • As the name suggests, the value of variable can change during execution of program.
  • A variable is made of 3 things.
                - Datatype
                - Name
                - Value (optional)

DataType :
   - It means what type of value we can store in the variable.
  • Numbers such 123, 10.50 etc
  • Strings such as UK, Canada etc
  • Data such 11/4/2020

Name :
  • It identifies the variable. For example, firstName, lastName, age
Value :
  • What actual value is stored in variable.
List of DataTypes in C# :
  1. Integer → Numbers such as 120, 345 etc
  2. Decimal → Number such as 3.5, 4.5 etc
  3. Char → Single character such as A,a,B,z
  4. Bool → True or False value
  5. String → More than one characters value such as John Smith, Mark Smith, Canada , Landon etc.
Syntax :
              DataType variableName = value;

Naming Rules :
 一  Names may consists of letters (A-Z or a-z), digits and underscores
  •  e.g firstName, firstNumber, _Age, firstNumber1 (correct)
  • #FirstName, @Email (wrong)

一 Name must begin with a letter or underscore.
  • e.g. firstName or _firstName (correct)
  • 1stName or 2ndNumber (wrong)
一Name must not have spaces.
  • e.g. first Name (wrong)
  • firstName (correct)
一 Names must not have reserved word or C# keywords. List of C# keyword are shown in the table.




Naming Conventions :
ー Names must be meaningful
  • e.g. firstNameString, cnicString, studentldlnteger (correct)
  • a,b, obj1 (wrong)
ー  Name must include its datatype
  • e.g. firstNameString, cnicString, studentldlnteger (correct)
  • FirstName, firstname, CNIC or Studentld (wrong)
ー Name must begin with lowercase letter and then capitalize each word of the name
  • e.g. firstNameString, cnicString, studentldinteger (correct)
  • FirstName, firstname, CNIC or StudentId (wrong)



Introduction of C# | First C# Program | C# Vs Java |

C# Introduction 
  • Computer Programming : It is a process of creating computer programs or in other word software to solve particular problem. 
               - Word Processor
               - Hospital Management
               - Spreadsheet
  • It is a Object Oriented Programming Language from Microsoft Corporation in year 2000.
  • C# is a part of .Net Framework and currently in version 16.3.
  • It is helps in developing variety of application such as windows based, Database based, Web Services, Web Application and more. 
C# Vs Java : Both are Object Oriented

C# - 
  1. Required CLR (Common Language RunTime)
  2. GOTO Statement is present
  3. Support Structure and Unions
  4. Support Unchecked Exception
  5. Less Secure than Java
Java -
  1. Required JRE (Java Runtime Environment)
  2. No GOTO statement 
  3. No Structure and Union
  4. Supports both Checked and Unchecked Exception
  5. Much Secure
First C# Program :-

Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author) pdf

This easy-to-follow and classroom-tested textbook guides the reader through the fundamentals of programming with Python, an accessible language which can be learned incrementally.

Features: incudes numerous examples and practice exercises throughout the text, with additional exercises, solutions and review questions at the end of each chapter; highlights the patterns which frequently appear when writing programs, reinforcing the application of these patterns for problem-solving through practice exercises; introduces the use of a debugger tool to inspect a program, enabling students to discover for themselves how programs work and enhance their understanding; presents the Tkinter framework for building graphical user interface applications and event-driven programs; provides instructional videos and additional information for students, as well as support materials for instructors, at an associated website.
Buy: Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author)
Buy: Python Programming Fundamentals (Undergraduate Topics in Computer Science) Kindle Edition by Kent D. Lee (Author)

PDF Download:

List in Python | Part 6 | Castor Classes

Topics covered in this video: 1)max 2)min 3)index 4)lexicographical sorting of list made of string element Python for beginners: https://www.youtube.com/watch?v=egq7Z...


Split string by arbitrary number of white spaces | Python | Castor Classes

Code:

class Solution:
    def reverseWords(self, s: str) -> str:
        s=s+" ";
        b="";
        l=[];
        for i in s:
            if(i!=' '):
                b=b+i;
            elif(b!=''):
                l.append(b);
                b="";
        l.reverse();
        return " ".join(l);

Detail explanation of algorithm: Brahmastra of Word extraction from a string https://www.youtube.com/watch?v=3VWI1... Check the problem statement here: https://leetcode.com/problems/reverse... Python for beginners: https://www.youtube.com/watch?v=egq7Z

Saturday, 25 April 2020

Hello World | Python | Castor Classes

Topics covered in this video:
1)print method
2)type method
3)How to take string input from the user
4)How to take integer input from the user

Data Type Conversion | Python | Castor Classes

The Python Workbook: A Brief Introduction with Exercises and Solutions Hardcover – 4 February 2015 by Ben Stephenson (Author)

While other textbooks devote their pages to explaining introductory programming concepts, The Python Workbook focuses exclusively on exercises, following the philosophy that computer programming is a skill best learned through experience and practice. Designed to support and encourage hands-on learning about programming, this student-friendly work contains 174 exercises, spanning a variety of academic disciplines and everyday situations. Solutions to selected exercises are also provided, supported by brief annotations that explain the technique used to solve the problem, or highlight specific points of Python syntax. No background knowledge is required to solve the exercises, beyond the material covered in a typical introductory Python programming course.

Undergraduate students undergoing their first programming course and wishing to enhance their programming abilities will find the exercises and solutions provided in this book to be ideal for their needs.
Buy: The Python Workbook: A Brief Introduction with Exercises and Solutions Hardcover – 4 February 2015 by Ben Stephenson (Author)

Power of a number | Python | Castor Classes



Friday, 24 April 2020

Number Data Type | Python | Castor Classes

Reverse Words in a String(Part 2) | GeeksForGeeks | Python | Castor Classes

Code: t=int(input()); ie=0; while (ie<t): a=input(); e=a.split("."); output=[]; for i in e: a=list(i); a.reverse(); es="".join(a); output.append(es); print(".".join(output)); ie=ie+1; Prerequisites: Reverse Words in a String III | LeetCode | Python | Castor Classes https://www.youtube.com/watch?v=m067u... Python for beginners: https://www.youtube.com/watch?v=egq7Z... Web 🌐http://www.clcoding.com/ Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/piraw...

Reverse Words in a String III (Part 1) | LeetCode | Python | Castor Classes

Code:


class Solution:
    def reverseWords(self, s: str) -> str:
        e=s.split(" ");
        output=[];
        for i in e:
            a=list(i);
            a.reverse();
            es="".join(a);
            output.append(es);
        return " ".join(output);
Python for beginners: https://www.youtube.com/watch?v=egq7Z... Web 🌐http://www.clcoding.com/ Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/piraw...

Replace all 0's with 5 | Python | Castor Classes

Code:

n=int(input("Enter the number:"));
s=str(n);
g="";
for i in s:
    if(i=='0'):
        g=g+'5';
    else:
        g=g+i;
t=int(g);
print(t)
       

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Convert a word to list of characters using list & Palindrome | Python | Castor Classes

Code:

class Solution:
    def isPalindrome(self, x: int) -> bool:
        e=str(x);
        a=list(e);
        a.reverse();
        w="".join(a);
        if(e==w):
            return True;
        else:
            return False;

Prerequisite: Single Number | Practice Problem on List | Python | Castor Classes: https://www.youtube.com/watch?v=mIQBl... Single Number II | Practice Problem on List | Python | Castor Classes https://www.youtube.com/watch?v=qnBML... Single Number III | LeetCode | Practice Problem on List | Python | Castor Classes https://www.youtube.com/watch?v=8JEUM... List in Python | Part 1 | Castor Classes: https://www.youtube.com/watch?v=P2ogQ... List in Python | Part 2 | Castor Classes: https://www.youtube.com/watch?v=vNxxQ... List in Python | Part 3 | Castor Classes https://www.youtube.com/watch?v=aUfow... Iterate over a list & string | List in Python | Part 4 | Castor Classes https://www.youtube.com/watch?v=4Zrfk... Convert list to string | List in Python | Part 5 | Castor Classes https://www.youtube.com/watch?v=mLHOF... Python for beginners: https://www.youtube.com/watch?v=egq7Z...


Thursday, 23 April 2020

Single Number III | LeetCode | Practice Problem on List | Python | Castor Classes

Code is given in the comment section. Prerequisite: Single Number | Practice Problem on List | Python | Castor Classes: https://www.youtube.com/watch?v=mIQBl... Single Number II | Practice Problem on List | Python | Castor Classes https://www.youtube.com/watch?v=qnBML... List in Python | Part 1 | Castor Classes: https://www.youtube.com/watch?v=P2ogQ... List in Python | Part 2 | Castor Classes: https://www.youtube.com/watch?v=vNxxQ... List in Python | Part 3 | Castor Classes https://www.youtube.com/watch?v=aUfow... Iterate over a list & string | List in Python | Part 4 | Castor Classes https://www.youtube.com/watch?v=4Zrfk... Convert list to string | List in Python | Part 5 | Castor Classes https://www.youtube.com/watch?v=mLHOF... Python for beginners: https://www.youtube.com/watch?v=egq7Z...


Single Number II | Practice Problem on List | Python | Castor Classes

Code is given in the comment section. Prerequisite: Single Number | Practice Problem on List | Python | Castor Classes: https://www.youtube.com/watch?v=mIQBl... List in Python | Part 1 | Castor Classes: https://www.youtube.com/watch?v=P2ogQ... List in Python | Part 2 | Castor Classes: https://www.youtube.com/watch?v=vNxxQ... List in Python | Part 3 | Castor Classes https://www.youtube.com/watch?v=aUfow... Iterate over a list & string | List in Python | Part 4 | Castor Classes https://www.youtube.com/watch?v=4Zrfk... Convert list to string | List in Python | Part 5 | Castor Classes https://www.youtube.com/watch?v=mLHOF... Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Single Number | Practice Problem on List | Python | Castor Classes

Code: n=[2,2,1]; m=0; for i in n: if(n.count(i)%2!=0): m=i; break; print(m) Prerequisite: List in Python | Part 1 | Castor Classes: https://www.youtube.com/watch?v=P2ogQ... List in Python | Part 2 | Castor Classes: https://www.youtube.com/watch?v=vNxxQ... List in Python | Part 3 | Castor Classes https://www.youtube.com/watch?v=aUfow... Iterate over a list & string | List in Python | Part 4 | Castor Classes https://www.youtube.com/watch?v=4Zrfk... Convert list to string | List in Python | Part 5 | Castor Classes https://www.youtube.com/watch?v=mLHOF... Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Popular Posts

Categories

100 Python Programs for Beginner (49) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (929) Python Coding Challenge (351) Python Quiz (21) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses