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

Variables Datatypes Functions

The document outlines basic programming concepts including data types (string, float, boolean, integer), operators (arithmetic, logical, assignment, comparison), and conditional statements (if/else, case). It provides examples of using these concepts in Python, such as calculating the modulus of two numbers and defining a user-defined function for addition and subtraction. Additionally, it demonstrates how to take user input and utilize it in a simple calculator class.

Uploaded by

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

Variables Datatypes Functions

The document outlines basic programming concepts including data types (string, float, boolean, integer), operators (arithmetic, logical, assignment, comparison), and conditional statements (if/else, case). It provides examples of using these concepts in Python, such as calculating the modulus of two numbers and defining a user-defined function for addition and subtraction. Additionally, it demonstrates how to take user input and utilize it in a simple calculator class.

Uploaded by

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

# variables and datatypes

# types of datatypes

# 1. string
# 2. float
# 3. boolean
# 4.integer

# print(7<6)

# OPERATORS
# 1.arithmetic operators
# 2. conditional or logical operators
#3. assignment operator
# 4. comparison operator

# +,-,*,/,%,** - Arithmetic operator

# <,>,and,or,|,<=,>=,!= - Logical operators

# = - Assignment operator

# == - Comparism Operator

# num1 = 5
# num2 = 2

# result = num1 % num2

# print(result)

# CONDITIONAL STATEMENT

# 1. If/Else statement
# 2. Case statement

# input()

# print('enter your age')


# age = int(input())

# if((age>=18) and (age<=50)):


# print('the user is qualified')
# else:
# print('the user is NOT qualified')

# FUNCTIONS AND METHODS

# user defined function

# class calculator():

# def addition(num1,num2,num3):
# result = num1 + num2 + num3
# return result
# def subtraction(val1, val2, val3):
# result = val1 - val2 - val3
# return result

# __name__ == '__main__'

# value_1 = int(input('enter a value'))


# value_2 = int(input('enter another value'))
# value_3 = int(input('enter another value'))

# cal = calculator.addition(value_1,value_2,value_3)

# print(cal)

You might also like