Sep 15, 2024
a = 10
, b = 20
.input()
function to get name and age.
name = input('Enter your name: ')
print()
.a
, b
, c
and perform operations: multiply and add.
result = a * b * c
if score > 70: print('Good Student')
if condition:
checks for a true condition.for i in range(1, 11): print(i)
prints numbers 1 to 10.while i < 5: print(i)
.def
keyword. Can take parameters and return values.
def add(a, b): return a + b
add(10, 20)
.class Student:
defines a student class with attributes.student1 = Student()
.class Teacher(Student):
inherits from Student.try: ... except ValueError:
to catch specific errors.with open('file.txt', 'r') as f:
.