if you want to clear your python console, just type
import os
os.system('cls')
and press enter. this is for windows user only.
if you want to clear your python console, just type
import os
os.system('cls')
and press enter. this is for windows user only.
input function always produces a string output. If you want to output an integer you have to use int. example
If you want to number output from this below code
user_input = input("enter a number: ")
print(user_input ** 2)
it’ll show error like
Traceback (most recent call last):
File "try_input.py", line 2, in <module>
print(user_input ** 2)
So, you have to convert that string to an integer.
user_input = input("enter a number: ")
print(int(user_input) ** 2)
If you try this now under 10, you’ll get 100.
enter a number: 10 100
Mapping two lists to a dictionary:
keys = ["a","b","c"]
values = [1, 2, 3]
mydicts = dict(zip(keys, values))
mydicts
{'a': 1, 'b': 2, 'c': 3}
Python lists only contain one value divided by comma, dictionaries contain two values. Also, lists use [ ] third bracket and dictionaries use { } second bracket.
পাইথনের built in functions এর লিস্ট জানতে হলে পাইথন শেলে টাইপ করতে হবে
dir(__builtins__)
এন্টার দিলে বিল্ট ইন ফাংশনের লিস্ট চলে আসবে, লিস্টগুলো নিচে দেয়া হলোঃ
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'Child ProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ell ipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'I OError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'Runt imeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'Timeou tError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarn ing', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__na me__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'l ist', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'rev ersed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
The definition of a list is a data type that contains multiple items
A python program is made of data objects, functions, and variable. So basically these are the three components you need to know for python programming.
এরকম হতেই পারে যে আপনার কাছে এই মুহুর্তে কম্পিউটার নেই কিন্তু আপনার জরুরী কিছু পাইথন প্রোগ্রামিংয়ের কাজ করাই লাগবে। অনেকেই হয়তো রিমোট কোন এপ বা সফটওয়্যার ব্যবহার করে থাকেন এই ক্ষেত্রে। কিন্তু ধরুন রিমোটের সাহায্যেও আপনি আপনার কম্পিউটারে এক্সেস করতে পারলেন না, তাহলে কী করবেন? যদি আপনার কাছে ইন্টারনেট এক্সেসের মত কোন ডিভাইস থাকে তাহলে Pythonanywhere.com ওয়েব সাইট আপনাকে দিচ্ছে আপনার জরুরী প্রোগ্রামিংয়ের কাজ সেরে রাখার সম্পূর্ণ ফ্রি সুবিধা। কীভাবে এই ওয়েবসাইটে কোড/প্রোগ্রাম লিখে রাখতে পারবেন সেটি নিয়েই একদমই বেসিক কিছু জিনিস শেয়ার করছি এখানে। (More …)
গত কয়েকদিন ধরে উবুন্টুতে ওয়ার্ডপ্রেস ইন্সটল দেয়া সংক্রান্ত নানা টিউটোরিয়াল দেখছিলাম, কিন্তু পারছিলাম না। নানাভাবেই মাঝপথে আটকে যাচ্ছিলাম। এর প্রধান কারণ, আমি উবুন্টুতে নতুন। বিভিন্ন জায়গায় টার্মিনালে কোড লিখতে ভুল করছিলাম, ভুল করতে করতেই অবশেষে পেরে গেলাম পরিপূর্ণভাবে। তাই ভাবলাম এটা নিয়ে একটা টিউটোরিয়াল লিখে ফেলা যাক। (More …)
প্রথম পোষ্টে কী লিখবো বুঝে উঠিনি এখনও। এমনই থাকুক আপাতত।
Reply