Skip to content

Commit 622b217

Browse files
Exercise_14
1 parent c724f16 commit 622b217

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

.idea/workspace.xml

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ print(sys.version_info)
340340

341341
## Question_12: ##
342342
**Description:**
343-
Write a Python program which accepts the radius of a circle from the user and compute the area.
343+
Write a Python program which accepts the radius of a circle from the user and compute the area.\
344+
Output:
345+
* r = 1.1
346+
* Area = 3.8013271108436504
347+
344348
**Solution:**
345349
```python
346350
import math
@@ -387,10 +391,18 @@ print("reversed: " + reverse_2(str_))
387391

388392
## Question_14: ##
389393
**Description:**
390-
Write a Python program which accepts a string and return as reverse order:
391-
392-
**Solution_2:**
394+
Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers.\
395+
Output :
396+
* List : ['3', ' 5', ' 7', ' 23']
397+
* Tuple : ('3', ' 5', ' 7', ' 23')
398+
**Solution_1:**
393399
```python
394-
code
400+
def prog_8():
401+
x = input()
402+
list_ = list(x.split(","))
403+
tuple_ = tuple(x.split(","))
404+
print(list_)
405+
print(tuple_)
406+
prog_8()
395407
```
396408
* * *

Solution.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,15 @@ def reverse_2(string):
291291
print("reversed: " + reverse_2(str_))
292292

293293

294+
# ========================= Question_13: ===========================================
295+
# Write a Python program which accepts a sequence of comma-separated numbers from user and generate
296+
# a list and a tuple with those numbers.
294297

295-
298+
def prog_8():
299+
x = input()
300+
list_ = list(x.split(","))
301+
tuple_ = tuple(x.split(","))
302+
print(list_)
303+
print(tuple_)
304+
prog_8()
296305
print("=============================================")

0 commit comments

Comments
 (0)