Question

how would you do this in python3 and store it in a tuple? int num; cin...

how would you do this in python3 and store it in a tuple?

int num;

cin >> num;

int val1, val2, val3;

for (int i=0; i<num; i++) {

cin >> val1 >> val2 >> val3;

#store values into tuple

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

num = int(input())
for i in range(num):
    t = tuple([input().split()])
    print(t)



Add a comment
Know the answer?
Add Answer to:
how would you do this in python3 and store it in a tuple? int num; cin...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The program has errors. Identify and make the necessary changes to make the program work. Remember...

    The program has errors. Identify and make the necessary changes to make the program work. Remember to follow the rules of functions and arrays. Here is the expected output Total = 20 Average = 15 Area = 150 Area = 70 Enter a value: 10 Value 1 entered = 10 Enter an integer: 20 Value 2 entered = 20 Enter an integer: 30 Value 3 entered = 30 .................................................................. #include <iostream> using namespace std; void total(int, int, int); double average(int...

  • (USING THE PROGRAM MARS) Using the MemoryAccess program we wrote in class as a starting point,...

    (USING THE PROGRAM MARS) Using the MemoryAccess program we wrote in class as a starting point, write a program called LoadStore # Title : Memory access.asm #Desc: Practice initially memory, #in val1 = 0x0a; #int val2 = 0x0b; #int result; #string resultstring = " final answer : "; #string returnchar = "\n"; #void main() { #   result = val1 + val2; #   cout<<< resultstring << returnchar; #} .data val1: .word 0x0a   #store 0xa into variable val1 val2: .word 0x0b   #store...

  • int num; int total = 0; cout << "Enter a number from 1 to 10."; cin...

    int num; int total = 0; cout << "Enter a number from 1 to 10."; cin >> num; switch (num) {    case 1:    case 2:   total = 5;    case 3:   total = 10;    case 4:   total = total + 3;    case 8:   total = total + 6;    default: total = total + 4; } cout << total; A. 10 B. 0 C. 23 D. 3 E. None of these

  • Given the following function: int fun1(int count){ int Num ; for (i = 0; i <...

    Given the following function: int fun1(int count){ int Num ; for (i = 0; i < count; ++i) { cin >> Value; if (i == 0) Num = Value; else if (Value > Num) Num = Value; } return Num ; } What is the output of the following C++ code segment if the following list is entered? (Input list:  5 -15 -90 -2 -60 -30) int Num = 0 , Value, numValues; cin >> numValues; if (numValues > 0) cout...

  • c++ #include using namespace std; int main() {    int n, x, num, j = 0;...

    c++ #include using namespace std; int main() {    int n, x, num, j = 0;    cin >> n >> x;    int*arr = new int[n];    for (int i = 0; i < n; i++)    {        cin >> num;        if (num < x)        {            arr[j] = num;            j++;        }    }    for (int i = 0; i < j; i++)    {...

  • Hello, please correct the following C++ CODE it is not working on visual studio: (I WILL RATE, NO...

    Hello, please correct the following C++ CODE it is not working on visual studio: (I WILL RATE, NO INCOMPLETE OR WRONG SOLUTIONS PLEASE) // CPP program to evaluate a given // expression where tokens are // separated by space. #include using namespace std; // Function to find precedence of // operators. int precedence(char op){ if(op == '+'||op == '-') return 1; if(op == '*'||op == '/') return 2; return 0; } // Function to perform arithmetic operations. int applyOp(int a,...

  • Do you have a flowgorithim flow chart for this code? #include <stdio.h> int main() { int num,i=0,sum=0; float aver...

    Do you have a flowgorithim flow chart for this code? #include <stdio.h> int main() { int num,i=0,sum=0; float average; int customerNumbers[num]; int customerSales[num]; printf("How many customers do you want to track?\n"); scanf("%d",&num); while(i<num) { printf("Enter the customer number. "); scanf("%d",&customerNumbers[i]); printf("Enter the sales for the customer "); scanf("%d",&customerSales[i]); i++; } printf("Sales for the Customer"); printf("\nCustomer Customer"); printf("\nNumber Sales"); for(i=0;i<num;i++) { printf("\n %d \t %d",customerNumbers[i], customerSales[i]); sum=sum+customerSales[i]; } average=(int)sum/num; printf("\n Total sales are $%d",sum); printf("\n Average sales are $%.2f",average); printf("\n --------------------------------------------");...

  • Question 49 1.25 pts Given two variables, val1 and val2, which expression would you use to...

    Question 49 1.25 pts Given two variables, val1 and val2, which expression would you use to test whether or not they are equal? O val1 = val2 val1 == val2 val1 equals val2 O val1 and val2 Question 58 1.25 pts Suppose the following statement is in a program: count = 56 After this statement executes, the count variable will reference a value of this data type. O currency O int O float O str Question 60 1.25 pts When...

  • #include <stdio.h> #include <stdlib.h> int aaa(); int main() { int ddd,eee = aaa (ddd,eee); printf("new num...

    #include <stdio.h> #include <stdlib.h> int aaa(); int main() { int ddd,eee = aaa (ddd,eee); printf("new num 1 = %d, new num2 = %d.\n", ddd,eee); return 0; } int aaa(int bbb,int ccc) {    bbb = 111;    ccc = 222;    printf("num 1 = %d, num 2 = %d.\n", bbb,ccc);    return bbb ,ccc;   } Output: num 1 = 111, num 2 = 222. new num 1 = 0, new num2 = 222. ************************************************************** I am learning function in C....

  • public boolean remove (int num) removes the first occurrence of the number num from the bag...

    public boolean remove (int num) removes the first occurrence of the number num from the bag Implement remove(int num) method that removes the first occurrence of the number num in the list array. If the number num does not exist then the method does not do anything. If removal is successful and the number removed is not the last number in the list, then shift the elements by one place to the left in the list (i.e. fill in the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT