forked from livinNector/python-programming-questions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1 Data types
More file actions
118 lines (93 loc) · 1.55 KB
/
1 Data types
File metadata and controls
118 lines (93 loc) · 1.55 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
title: Operate on Mixed Data Types
---
# Problem Statement
Write a function `process_data` that takes three arguments: an integer `n`, a float `f`, and a string `s`. The function should:
1. Return the sum of `n` and `f`.
2. Convert the string `s` to uppercase.
3. Return the two results as a tuple.
**Example**
```py3
process_data(5, 4.5, "hello") # (9.5, "HELLO")
process_data(10, 3.2, "world") # (13.2, "WORLD")
```
# Solution
<template>
```py3
def process_data(n: int, f: float, s: str) -> tuple:
'''
Given an integer, a float, and a string, perform specific operations and return the results.
Arguments:
n: int - an integer value.
f: float - a floating-point number.
s: str - a string.
Return: tuple - A tuple containing the sum of n and f, and the uppercase version of s.
'''
return (n + f, s.upper())
```
</template>
# Public Test Cases
## Input 1
```
is_equal(
process_data(2, 3.5, "test"),
(5.5, "TEST")
)
```
## Output 1
```
True
```
## Input 2
```
is_equal(
process_data(7, 0.0, "python"),
(7.0, "PYTHON")
)
```
## Output 2
```
True
```
## Input 3
```
is_equal(
process_data(-5, 10.2, "Data"),
(5.2, "DATA")
)
```
## Output 3
```
True
```
# Private Test Cases
## Input 1
```
n = 0
f = 1.1
s = "coding"
is_equal(
process_data(n, f, s),
(1.1, "CODING")
)
n = 100
f = 99.99
s = "Mix"
is_equal(
process_data(n, f, s),
(199.99, "MIX")
)
n = -50
f = -50.5
s = "negative"
is_equal(
process_data(n, f, s),
(-100.5, "NEGATIVE")
)
```
## Output 1
```
True
True
True
```