0% found this document useful (0 votes)
6 views3 pages

Python Basics: Syntax and Data Types

The document outlines an experiment focused on basic Python programming, emphasizing the creation of simple scripts to understand syntax, keywords, and data types. It includes algorithms and source code for various programs, such as displaying messages, reading user input, and performing arithmetic operations. The conclusion highlights the successful demonstration of fundamental Python concepts through these exercises.

Uploaded by

kola18
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)
6 views3 pages

Python Basics: Syntax and Data Types

The document outlines an experiment focused on basic Python programming, emphasizing the creation of simple scripts to understand syntax, keywords, and data types. It includes algorithms and source code for various programs, such as displaying messages, reading user input, and performing arithmetic operations. The conclusion highlights the successful demonstration of fundamental Python concepts through these exercises.

Uploaded by

kola18
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

Experiment 1: Basic of Python Programming

Aim: To understand Scripting Language Programming using Python to create basic syntax, keywords, and data types in Python.

Algorithm:
Step 1: Start the Python interpreter.

Step 2: Display a message using print( ) .

Step 3: Demonstrate variables of different data types: integer, float, string, boolean.

Step 4: Display the values and their types using type().

Step 5: Stop

Program:
1. Write a program to display Basic Syntax and Data Types

Source Code :
print("Hello, World!")

integer_var = 10

float_var = 3.14

string_var = "Python"

bool_var = True

print("Integer:", integer_var, "Type:", type(integer_var))

print("Float:", float_var, "Type:", type(float_var))

print("String:", string_var, "Type:", type(string_var))

print("Boolean:", bool_var, "Type:", type(bool_var))

Output:
SCREEN SHOT

Program:
2. Write a program to display Your name, Institute name, Class Roll Number, Registration number, Depertment, Semester and
Year.

Source Code :

Output:
SCREEN SHOT

Program:
3. Write a program to read variables from the user.

Source Code :
val1 = input("Enter Your Mother’s Name")

val2 = int(input("Enter Her Age: "))

val3 = float(input("Enter Her Weight"))

print("My Mother’s name is ", val1)


print("My age is ", val2)

print("My weight is ",val3,"Kg")

4. Write a program to swapping two value’s using third variable.

Output:
SCREEN SHOT

5. Write a program to swapping two value’s without using third variable.

Source Code :

Output:
SCREEN SHOT

6. Write a program to perform addition , subtraction, Multiplication, Division, Integer Division and Modulo Division on Two
Integers Numbers.

Source Code :

Output:
SCREEN SHOT

7. Write a program to perform addition , subtraction, Multiplication, Division, Integer Division and Modulo Division on Two
floating point Numbers.

Source Code :

Output:
SCREEN SHOT

8. Write a program to calculate area of triangle.

Source Code :

Output:
SCREEN SHOT

9. Write a program to convert Fahrenheit degree into degree Celsius. [c=5/9 X (f-32)].

Output:
SCREEN SHOT

10. Write a program to convert Seconds into Hours , Minutes and Seconds.

Source Code:

Output:
SCREEN SHOT
Conclusion:
After using this code, we understand that basic Python syntax and data types of simple programs were demonstrated successfully,
including how to print and read variables.

You might also like