-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
user_input = int(input('hpw many test cases : ')) | ||
for i in range(user_input): | ||
operation = input('please enter operation string') | ||
operation_list = operation.split() | ||
print(operation_list) | ||
if operation_list[0] == 'add': | ||
first_number = int(operation_list[1]) | ||
second_number = int(operation_list[2]) | ||
print(first_number + second_number) | ||
elif operation_list[0] == 'sub': | ||
first_number = int(operation_list[1]) | ||
second_number = int(operation_list[2]) | ||
print(first_number - second_number) | ||
elif operation_list[0] == 'mul': | ||
first_number = int(operation_list[1]) | ||
second_number = int(operation_list[2]) | ||
print(first_number * second_number) | ||
elif operation_list[0] == 'div': | ||
first_number = int(operation_list[1]) | ||
second_number = int(operation_list[2]) | ||
print(first_number / second_number) | ||
|
||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
no_of_elem = int(input()) | ||
map_={ | ||
'int':[], | ||
'str':[], | ||
'float':[], | ||
|
||
} | ||
|
||
for i in range(no_of_elem): | ||
dt = input('enter data type: ') | ||
value=input('enter value for above data type: ') | ||
if dt =='str': | ||
map_['str'].append(value) | ||
elif dt == 'int': | ||
map_['int'].append(int(value)) | ||
elif dt == 'float': | ||
map_['float'].append(float(value)) | ||
else: | ||
print('please initialize a empty list for {dt}'.format(dt)) | ||
print(map_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#only add and subtract input dikhega(add 4 5 100 20 ) | ||
user_input = int(input('how many numbers : ')) | ||
sum = 0 | ||
mul = 1 | ||
for i in range(user_input): | ||
operation = input('please enter operation string') | ||
operation_list = operation.split() | ||
print(operation_list) | ||
if operation_list[0] == 'add': | ||
for j in range(1,len(operation_list)): | ||
sum = int(sum) + int(operation_list[j]) | ||
print(sum) | ||
if operation_list[0] == 'mul': | ||
for j in range(1,len(operation_list)): | ||
mul = int(mul) * int(operation_list[j]) | ||
print(mul) |