forked from shubhansu-kr/INT213-Python-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_Input.py
49 lines (32 loc) · 927 Bytes
/
02_Input.py
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
# How to take input from user - Using input function
# input()
"""
Input is always in string - Age is not a number it's a string.
Convert string into intger using int()
or take input inside int()
"""
name = input('Enter user_name ')
print('Hell0,', name)
age = input('Enter your age ')
# Age is just a string
print(f'You are {age * 12} months old') # prints input 12 times
age_int = int(age)
print (f'You are {age_int * 12} months old')
# Or we can use int input while taking input only
roll = int(input('Enter your roll '))
print (type(roll)) # integer input
# Boolean variables : Either false or not false
name = input ('Enter a Name ')
print (bool(name))
# Falsy Values in python
# The following are falsy values in Python:
# The number zero (0)
# An empty string ''
# False
# None
# An empty list []
# An empty tuple ()
# An empty dictionary {}
age = 20
age_above = age >= 18
print (age_above)