FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tutorials/core-python/Core_Python/com/UserInput.py at master · deepdalsania/tutorials · GitHub
deepdalsania
/
tutorials
Public
Notifications
You must be signed in to change notification settings
Fork
7
Star
8
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tutorials
/
core-python
/
Core_Python
/
com
/
UserInput.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (31 loc) · 1.06 KB
Breadcrumbs
tutorials
/
core-python
/
Core_Python
/
com
/
UserInput.py
Copy path
File metadata and controls
37 lines (31 loc) · 1.06 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
# give output as string because input function default takes string value
'''a = input("Enter 1st number : ")
b = input("Enter 2nd number : ")
print(a+b)'''
# type casting but its takes memory space for other variable
'''a = input("Enter 1st number : ")
x = int(a)
b = input("Enter 2nd number : ")
y = int(b)
print(a+b)'''
# this is first way of type casting
'''a = input("Enter 1st number : ")
b = input("Enter 2nd number : ")
print(int(a)+int(b))'''
# its take int value conversion at inputting time
a
=
int
(
input
(
"Enter 1st number : "
))
b
=
int
(
input
(
"Enter 2nd number : "
))
print
(
a
+
b
)
# take char
'''ch = input('Enter a character : ')
print(ch)
c = input('Enter a character : ')
print(c[0])
a = input('Enter a character : ')[0]
print(a)'''
# evaluate expression using eval function
'''res = eval(input('Enter an expression : '))
print(res)'''
''' The raw_input([prompt]) function reads one line from standard input and returns
it as a string (removing the trailing newline). but this function available in
Python 2.x now it's renamed as input in python 3.x'''
Back
|
FazBrowse Home
|
New Git URL