|
311 | 311 | "print(D)"
|
312 | 312 | ]
|
313 | 313 | },
|
| 314 | + { |
| 315 | + "attachments": {}, |
| 316 | + "cell_type": "markdown", |
| 317 | + "metadata": {}, |
| 318 | + "source": [ |
| 319 | + "Operators Eg- + , * , /, etc. \n", |
| 320 | + "\n", |
| 321 | + "Operand Eg:c=a+b" |
| 322 | + ] |
| 323 | + }, |
| 324 | + { |
| 325 | + "attachments": {}, |
| 326 | + "cell_type": "markdown", |
| 327 | + "metadata": {}, |
| 328 | + "source": [ |
| 329 | + "Arithmetic operators" |
| 330 | + ] |
| 331 | + }, |
314 | 332 | {
|
315 | 333 | "cell_type": "code",
|
316 |
| - "execution_count": null, |
| 334 | + "execution_count": 9, |
317 | 335 | "metadata": {},
|
318 |
| - "outputs": [], |
319 |
| - "source": [] |
| 336 | + "outputs": [ |
| 337 | + { |
| 338 | + "name": "stdout", |
| 339 | + "output_type": "stream", |
| 340 | + "text": [ |
| 341 | + "a : 2\n", |
| 342 | + "b : 1\n", |
| 343 | + "Add two number : 3\n", |
| 344 | + "Subtract two numbers : 1\n", |
| 345 | + "Multiple two number : 2\n", |
| 346 | + "Divedes the first openrand by the second (float) : 2.0\n", |
| 347 | + "Divedes the first openrand by the second (floor) : 2\n", |
| 348 | + "returns the remainder when the first openrand is diveded by the second : 0\n", |
| 349 | + "Return first raised to power second : 2\n" |
| 350 | + ] |
| 351 | + } |
| 352 | + ], |
| 353 | + "source": [ |
| 354 | + "a=int(input(\"enter the number\"))\n", |
| 355 | + "b=int(input(\"enter the number\"))\n", |
| 356 | + "print(\"a :\",a)\n", |
| 357 | + "print(\"b :\",b)\n", |
| 358 | + "print(\"Add two number :\",a+b)\n", |
| 359 | + "print(\"Subtract two numbers :\",a-b)\n", |
| 360 | + "print(\"Multiple two number :\",a*b)\n", |
| 361 | + "print(\"Divedes the first openrand by the second (float) :\",a/b)\n", |
| 362 | + "print(\"Divedes the first openrand by the second (floor) :\",a//b)\n", |
| 363 | + "print(\"returns the remainder when the first openrand is diveded by the second :\",a%b)\n", |
| 364 | + "print(\"Return first raised to power second :\",a**b)" |
| 365 | + ] |
| 366 | + }, |
| 367 | + { |
| 368 | + "attachments": {}, |
| 369 | + "cell_type": "markdown", |
| 370 | + "metadata": {}, |
| 371 | + "source": [ |
| 372 | + "Comkparison Operators (It either returns True or False according to the condition)" |
| 373 | + ] |
| 374 | + }, |
| 375 | + { |
| 376 | + "cell_type": "code", |
| 377 | + "execution_count": 12, |
| 378 | + "metadata": {}, |
| 379 | + "outputs": [ |
| 380 | + { |
| 381 | + "name": "stdout", |
| 382 | + "output_type": "stream", |
| 383 | + "text": [ |
| 384 | + "x : 2\n", |
| 385 | + "y : 2\n", |
| 386 | + "Left openrand is grater then the right : False\n", |
| 387 | + "Left openrand is less then the right : False\n", |
| 388 | + "The both openrand are equal : True\n", |
| 389 | + "The both openrand is not equal : False\n", |
| 390 | + "Left openrand is grater than or equal to the right : True\n", |
| 391 | + "Left openrand is less than or equal to the right : True\n", |
| 392 | + "x is the same as y : True\n", |
| 393 | + "x is not the same as y : False\n" |
| 394 | + ] |
| 395 | + } |
| 396 | + ], |
| 397 | + "source": [ |
| 398 | + "x=int(input(\"enter the number\"))\n", |
| 399 | + "y=int(input(\"enter the number\"))\n", |
| 400 | + "print(\"x :\",x)\n", |
| 401 | + "print(\"y :\",y)\n", |
| 402 | + "print(\"Left openrand is grater then the right :\",x>y)\n", |
| 403 | + "print(\"Left openrand is less then the right :\",x<y)\n", |
| 404 | + "print(\"The both openrand are equal :\",x==y)\n", |
| 405 | + "print(\"The both openrand is not equal :\",x!=y)\n", |
| 406 | + "print(\"Left openrand is grater than or equal to the right :\",x>=y)\n", |
| 407 | + "print(\"Left openrand is less than or equal to the right :\",x<=y)\n", |
| 408 | + "print(\"x is the same as y :\",x is y)\n", |
| 409 | + "print(\"x is not the same as y :\",x is not y)" |
| 410 | + ] |
| 411 | + }, |
| 412 | + { |
| 413 | + "attachments": {}, |
| 414 | + "cell_type": "markdown", |
| 415 | + "metadata": {}, |
| 416 | + "source": [ |
| 417 | + "Logical operators perform Logical AND, Logical OR, and Logical NOT operations. It is used to combine conditional statements.\n" |
| 418 | + ] |
| 419 | + }, |
| 420 | + { |
| 421 | + "attachments": {}, |
| 422 | + "cell_type": "markdown", |
| 423 | + "metadata": {}, |
| 424 | + "source": [ |
| 425 | + "Bitwise Operators" |
| 426 | + ] |
| 427 | + }, |
| 428 | + { |
| 429 | + "cell_type": "code", |
| 430 | + "execution_count": 24, |
| 431 | + "metadata": {}, |
| 432 | + "outputs": [ |
| 433 | + { |
| 434 | + "name": "stdout", |
| 435 | + "output_type": "stream", |
| 436 | + "text": [ |
| 437 | + "A : 10\n", |
| 438 | + "B : 4\n", |
| 439 | + "AND operation : 0\n", |
| 440 | + "OR operation : 14\n", |
| 441 | + "Not operation : -11\n", |
| 442 | + "XOR operation : 14\n", |
| 443 | + "Right shift operation 1\n", |
| 444 | + "Left shift operation 16\n" |
| 445 | + ] |
| 446 | + } |
| 447 | + ], |
| 448 | + "source": [ |
| 449 | + "A=int(input(\"enter the number\"))\n", |
| 450 | + "B=int(input(\"enter the number\"))\n", |
| 451 | + "print(\"A :\",A)\n", |
| 452 | + "print(\"B :\",B)\n", |
| 453 | + "print(\"AND operation :\",A & B) # multiply the binary bit\n", |
| 454 | + "print(\"OR operation :\",A | B) # Add the the binary bit\n", |
| 455 | + "print(\"Not operation :\",~A)\n", |
| 456 | + "print(\"XOR operation :\",A ^ B)\n", |
| 457 | + "print(\"Right shift operation \",B>>2)\n", |
| 458 | + "print(\"Left shift operation \",B<<2)\n", |
| 459 | + "\n" |
| 460 | + ] |
320 | 461 | }
|
321 | 462 | ],
|
322 | 463 | "metadata": {
|
|
0 commit comments