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

Python Assignment 1

The document outlines a practical Python assignment consisting of ten tasks. These tasks include user input/output, basic arithmetic operations, geometry calculations, data type definitions, temperature conversion, string operations, modulus and logical operations, and type casting. Each task requires the implementation of specific Python programming concepts and functionalities.
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)
4 views1 page

Python Assignment 1

The document outlines a practical Python assignment consisting of ten tasks. These tasks include user input/output, basic arithmetic operations, geometry calculations, data type definitions, temperature conversion, string operations, modulus and logical operations, and type casting. Each task requires the implementation of specific Python programming concepts and functionalities.
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

Unit 1: Practical Python Assignment

1. Input/Output: Write a program that takes the user’s name as input


and prints the message: ”Welcome to Python Programming, [Name]!”
2. Basic Arithmetic: Create a script that takes two numerical inputs from
the user and outputs their Sum, Difference, and Product.
3. Power Operator: Write a program that asks for a base number and an
exponent, then calculates the result using the Python power operator:

Result = baseexponent

4. Geometry Calculation: Write a program to calculate the area of a


rectangle. The user should provide the length (l) and width (w):

Area = l × w

5. Data Types: Define three variables containing an integer, a float, and


a string. Use the type() function to display the data type of each.

6. Temperature Conversion: Write a program to convert a temperature


value from Celsius (C) to Fahrenheit (F ) using the following formula:
 
9
F = C× + 32
5

7. String Operations: Create two string variables, first name and last name.
Perform string concatenation to join them with a space and print the
result.
8. Modulus Operator: Develop a program that asks for a dividend and a
divisor, then calculates the remainder using the modulus (%) operator:

Remainder = Dividend (mod Divisor)

9. Logical Operators: Write a script that accepts a number (x) and eval-
uates the following compound logical condition, printing True or False:

10 < x < 50

10. Type Casting: Take a decimal number (float) via user input. Use ex-
plicit type casting to convert it to an integer (int) and print both values
to demonstrate truncation.

You might also like