Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python 

Snippet info

Language

Python

Visibility

public

Author

doruk.ayd20

Created

2025-01-02T14:32:29.249226Z

Updated

2025-01-02T16:31:24.033227Z


 #PYTHON FUNDAMENTAL DATA TYPES - 1
 
              #Integer and Float
# print(type(2 + 4))
# print(2 - 4)
# print(type(2 / 4)) #0.5
# #2**2 ->4 (karesi)

# print(5//4)
# print(6%4) 

#math functions
# print(round(3.1))
# print(abs(-20))

#operator precedence
# 1st ()
# 2nd **
# 3rd * /
# 4th + -

#constants -> can't change
#__ -> dunder

# user_age = 20(expression) whole thing is statement

#augmented assingment operator -> some _value = 3 some_value +=2 output = 5


            #String
# print(type('hello world'))
# long_string = '''Hello 
# from the another world '''
# print(long_string)

#string concatenation -> adding strings, only works in strings
#type conversion -> str(100) type = string

 #escape squences
# weather = "It\'s \"kind of\" sunny"
# print(weather)
#\t -> adding space \n -> new line

 #formatted strings
# name = 'Johnny'
# age = 35
# print('Hi ' + name + '. You are ' + str(age) + ' years old') #normal way to do 
# print(f'Hi {name}. You are {age} years old') #formatted strings
# print('Hi {}. You are {} years old'.format(name, age)) #another way
 
#  string indexes
# selfish = 'me me me'
#           #01234567
# print(selfish[::-1]) # [start:stop:step_over] - = backwards(reverse)

# immutuability -> cannot be changed, strings are immutuable

#  #built-in functions
# value = 'josjgnam'
# print(len(value))
#  # .format() -> a sample method
# quote = 'to be or not to be'
# print(quote.capitalize())
INFO