GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pythonbasic/true_false_logic.py at main · analytics-sam/pythonbasic

Expand file tree

/

true_false_logic.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
54 lines (38 loc) · 1.18 KB
/

true_false_logic.py

Copy path

File metadata and controls

54 lines (38 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 29 02:10:55 2021
@author: mjach
"""
'''Boolean Logic True or False'''
'''
- 0(zero) is false rest is true even negative numbers
- empty data structures like list, sets, dict. and tuple are False
- List, sets, tupe and dict. with items within are True
- None is also False
'''
#Example
# print('10 > 5 is it true?:', 10 > 5 )
# '''To find out quickly either it is true or false use bool'''
# print('\nNone is true or false?:', bool(None))
# print(bool(10 > 5))
# print(bool(10 < 5))
# print(bool(-1)) # to check negative number true or false
# print(bool(0))# to check 0 zero true or flase
'''Empty string are also False'''
# print(bool('Salam')) # with string true
# print(bool('')) # empty string false
'''Empty list, sets, tuple and dict false'''
#list
# print('\nEmpty list:',bool(list()))
# print('Empty list:',bool([]))
# print('list with items:',bool([1]))
#sets
# print('\nEmpty sets:',bool(set()))
# print('Sets with items:',bool({1}))
#tuple
print('\nEmpty tuple:',bool(()))
print('Tuple with items:',bool(1,))
#dictionary
print('\nEmpty dict:',bool(dict()))
print('Empty dict:',bool({}))
print('Dict with items:',bool({1:'apple'}))
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.