0% found this document useful (0 votes)
7 views2 pages

Python Basics Summary

The document provides a summary of Python basics, including variables, input/output, conditions, logical operators, and emoji printing. It explains how to calculate total and average marks, and includes a final program that assesses grades based on user input for marks in Maths and Science. The program also determines pass/fail status and assigns grades based on average scores.

Uploaded by

Yash Patil
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)
7 views2 pages

Python Basics Summary

The document provides a summary of Python basics, including variables, input/output, conditions, logical operators, and emoji printing. It explains how to calculate total and average marks, and includes a final program that assesses grades based on user input for marks in Maths and Science. The program also determines pass/fail status and assigns grades based on average scores.

Uploaded by

Yash Patil
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
You are on page 1/ 2

■ Python Basics Summary

1. Variables & Input/Output


- input() → take input
- int(), float() → convert type
Example:
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello", name, "your age is", age)

2. Conditions (if / else / elif)


- if: check condition
- elif: multiple checks
- else: default

3. Logical Operators
- and, or, not

4. Total & Average


total = maths + science
average = total / 2

5. Emoji Printing
■ Pass → \u2705
■ Fail → \u274c

6. f-String
print(f"Hello {name}, your marks are {marks}")

7. Final Program (Marks + Grade System)


maths = float(input("Enter marks of Maths: "))
science = float(input("Enter marks of Science: "))

total_marks = maths + science


average = total_marks / 2

print(f"■ Total Marks: {total_marks}")


print(f"■ Average Marks: {average}")

if maths >= 35:


print("■ Pass in Maths")
else:
print("■ Fail in Maths")

if science >= 35:


print("■ Pass in Science")
else:
print("■ Fail in Science")

if maths >= 35 and science >= 35:


print("■ Overall Pass")
else:
print("■ Overall Fail")
if average >= 80:
print("■■ Grade A")
elif average >= 70:
print("■ Grade B")
elif average >= 60:
print("■ Grade C")
elif average >= 50:
print("■ Grade D")
elif average >= 35:
print("■ Grade E")
else:
print("■ Grade F")

You might also like