0% found this document useful (0 votes)
20 views1 page

Python Variable Operations and Swapping

The document outlines a series of programming tasks involving variable declarations and operations in a programming language. It includes tasks for performing arithmetic operations on integers and floats, handling boolean variables, concatenating strings, calculating averages from user inputs, and swapping values of two integers. Each task is accompanied by example inputs and expected outputs.

Uploaded by

habibminhazuddin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Python Variable Operations and Swapping

The document outlines a series of programming tasks involving variable declarations and operations in a programming language. It includes tasks for performing arithmetic operations on integers and floats, handling boolean variables, concatenating strings, calculating averages from user inputs, and swapping values of two integers. Each task is accompanied by example inputs and expected outputs.

Uploaded by

habibminhazuddin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Declare two variables: one int and one float.

Assign values to both and print their


sum, sub, mul, div
input output
Enter a number: 3 Sum: 7.4
Enter another number: 4.4 Sub: -1.4
Mul:
Div

2. Declare a bool variable named isPassed. Set it to true and print:


“You have passed: true”
3. Create two string variables: firstName and lastName. Combine them and print the
full name with a space in between.
Input output
Enter first name: Sakib Full name: Sakib Khan
Enter last name: Khan
4. Take 5 integer inputs from the user, calculate the average, and print it.
Input output
4 2
4
5
1
-4

5. Swap two integer variables using a third variable. Show the values before and after
swapping
Input output
Enter a number: 10 Before swap:
Enter another number: -5 X = 10
Y = -5
After swap:
X = -5
Y = 10

You might also like