<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohammad Alsuwaidi</title>
    <description>The latest articles on DEV Community by Mohammad Alsuwaidi (@tupac).</description>
    <link>https://dev.to/tupac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F772553%2F85f35361-484c-4797-8747-1faa8f14852f.png</url>
      <title>DEV Community: Mohammad Alsuwaidi</title>
      <link>https://dev.to/tupac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tupac"/>
    <language>en</language>
    <item>
      <title>A simple python calculator</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Wed, 22 Dec 2021 07:02:58 +0000</pubDate>
      <link>https://dev.to/tupac/a-simple-python-calculator-2f5b</link>
      <guid>https://dev.to/tupac/a-simple-python-calculator-2f5b</guid>
      <description>&lt;p&gt;i made a simple python calculator using while loop&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# simple calculator


def add(x, y):
    return x + y


def sub(x, y):
    return x - y


def mul(x, y):
    return x * y


def div(x, y):
    return x / y


print("Select operation.")
print("( + )for Add")
print("( - ) for Subtract")
print("( * ) for Multiply")
print("( / ) for Divide")

while True:
    choice = raw_input("Enter the operation: ")
    if choice in ('+', '-', '/', '*'):
        num1 = float(input("Enter first number: "))
        num2 = float(input("Enter second number: "))

        if choice == '+':
            print num1, "+", num2, "=", (add(num1, num2))
        elif choice == '-':
            print num1, "-", num2, "=", (sub(num1, num2))
        elif choice == "*":
            print num1, "*", num2, "=", (mul(num1, num2))
        elif choice == '/':
            print num1, "/", num2, "=", (div(num1, num2))
    n12 = raw_input("Do u want to calculate another equation (y/n): ")
    if n12 == 'y' or n12 == 'Y':
        continue
    else:
        break


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>python</category>
      <category>beginners</category>
      <category>easy</category>
    </item>
    <item>
      <title>Python bmi calcultor</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Wed, 15 Dec 2021 10:29:55 +0000</pubDate>
      <link>https://dev.to/tupac/python-bmi-calcultor-430h</link>
      <guid>https://dev.to/tupac/python-bmi-calcultor-430h</guid>
      <description>&lt;p&gt;wrote a quick bmi calculator for imperial and metric it might not be perfect but i wanna know how can i make it better&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;m_or_i = int(input("Enter 1 for metric and 2 for imperial: "))

if m_or_i == 1:
    h1 = float(input("Enter your height in cm: "))
    h = h1 / 100
    w = float(input("Enter your weight in kgs: "))
    an = w / h ** 2
    if an &amp;lt; 18.4:
        print"Your bmi is:", (round(an, 1)), "which means you are under weight"
    elif 18.5 &amp;lt;= an &amp;lt;= 24.9:
        print"Your bmi is:", (round(an, 1)), "which means you are normal weight"
    elif 25 &amp;lt;= an &amp;lt;= 29.9:
        print"Your bmi is:", (round(an, 1)), "which means you are over weight"
    elif 30 &amp;lt;= an &amp;lt;= 34.9:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 1"
    elif 35 &amp;lt;= an &amp;lt;= 39.9:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 2"
    elif an &amp;gt;= 40:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 3"

elif m_or_i == 2:
    h1 = float(input("Enter your height in feet: "))
    h2 = float(input("Enter the inches: "))
    h = h1 * 12 + h2
    w = float(input("Enter your weight in pounds: "))
    an = w * 703 / h ** 2
    if an &amp;lt; 18.4:
        print"Your bmi is:", (round(an, 1)), "which means you are under weight"
    elif 18.5 &amp;lt;= an &amp;lt;= 24.9:
        print"Your bmi is:", (round(an, 1)), "which means you are normal weight"
    elif 25 &amp;lt;= an &amp;lt;= 29.9:
        print"Your bmi is:", (round(an, 1)), "which means you are over weight"
    elif 30 &amp;lt;= an &amp;lt;= 34.9:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 1"
    elif 35 &amp;lt;= an &amp;lt;= 39.9:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 2"
    elif an &amp;gt;= 40:
        print"Your bmi is:", (round(an, 1)), "which means you are obese class 3"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>python</category>
    </item>
    <item>
      <title>Volume calculator</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Tue, 14 Dec 2021 06:13:18 +0000</pubDate>
      <link>https://dev.to/tupac/volume-calculator-2imj</link>
      <guid>https://dev.to/tupac/volume-calculator-2imj</guid>
      <description>&lt;p&gt;i made a shape volume calculator tell me if i can improve it even more&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# this is volume calculator according to calculator.net
import sys
from math import sqrt

shape = float(input(
    "Enter 1 for sphere, 2 for cone, 3 for cube, 4 for cylinder, 5 for Rectangular Tank, 6 for Capsule, \
7 for Conical Frustum, 8 for Ellipsoid, 9 "
    "for Square Pyramid, 10 for Tube, 11 for Spherical Cap: "))

if shape == 1:
    r = int(input("enter the radius of the sphere: "))
    an = 1.33333333333 * 3.141592653589793 * r ** 3
    unit = raw_input("Enter the unit: ")
    print an, unit, "^3"
elif shape == 2:
    r = int(input("Enter the base radius : "))
    h = int(input("Enter the height of the cone: "))
    an = 0.33333333333 * 3.141592653589793 * r ** 2 * h
    unit = raw_input("Enter the unit: ")
    print an, unit, "^3"
elif shape == 3:
    l = int(input("Enter the length of one edge: "))
    an = l ** 3
    unit = raw_input("Enter the unit: ")
    print an, unit, "^3"
elif shape == 4:
    r = float(input("Enter the base radius: "))
    h = float(input("Enter the height of the cylinder: "))
    an = 3.141592653589793 * r ** 2 * h
    unit = raw_input("Enter the unit: ")
    print an, unit, "^3"
elif shape == 5:
    l = int(input("Enter the length of Rectangular Tank: "))
    w = int(input("Enter the width of Rectangular Tank: "))
    h = int(input("Enter the height of Rectangular Tank: "))
    an = l * w * h
    unit = raw_input("Enter the unit: ")
    print an, unit, "^3"
elif shape == 6:
    r = int(input("Enter the base radius: "))
    h = int(input("Enter the height: "))
    unit = raw_input("Enter the unit: ")
    an = 1.33333333333 * 3.141592653589793 * r ** 3 + 3.141592653589793 * r ** 2 * h
    print an, unit, "^3"
elif shape == 7:
    r = int(input("Enter Top Radius: "))
    b = int(input("Enter Bottom Radius: "))
    h = int(input("Enter height: "))
    unit = raw_input("Enter the unit: ")
    an = 0.33333333333 * 3.141592653589793 * h * (r ** 2 + r * b + b ** 2)
    print an, unit, "^3"
elif shape == 8:
    a1 = int(input("Enter the first axis: "))
    a2 = int(input("Enter the second axis: "))
    a3 = int(input("Enter the third axis: "))
    unit = raw_input("Enter the unit: ")
    an = 1.33333333333 * 3.141592653589793 * a1 * a2 * a3
    print an, unit, "^3"
elif shape == 9:
    b = int(input("Enter the Base Edge: "))
    h = int(input("Enter the Height: "))
    unit = raw_input("Enter the unit: ")
    an = 0.33333333333 * 3.141592653589793 * b ** 2 * h
    print an, unit, "^3"
elif shape == 10:
    d1 = int(input("Enter the outer diameter: "))
    d2 = int(input("Enter the inner diameter: "))
    l = int(input("Enter the length of tube: "))
    unit = raw_input("Enter the unit: ")
    an = 3.141592653589793 * (d1 ** 2 - d2 ** 2) / 4 * l
    print an, unit, "^3"
elif shape == 11:
    RR = int(input("Enter 1 if u have base radius or 2 if u have ball radius: "))
    if RR == 1:
        r = int(input("Enter the Base radius: "))
        h = int(input("Enter the Height: "))
        unit = raw_input("Enter the unit: ")
        R = (h ** 2.0 + r ** 2.0) / (2.0 * h)
        an = 0.33333333333 * 3.141592653589793 * h ** 2 * (3 * R - h)
        print an, unit, "^3"
    elif RR == 2:
        R = int(input("Enter the ball radius: "))
        h = int(input("Enter the Height: "))
        r = sqrt(2 * R * h - h ** 2)
        unit = raw_input("Enter the unit: ")
        an = 0.33333333333 * 3.141592653589793 * h ** 2 * (3 * R - h)
        print an, unit, "^3"
else:
    sys.exit()


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Made a program that gives you the average of your school mark</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Mon, 13 Dec 2021 11:06:14 +0000</pubDate>
      <link>https://dev.to/tupac/made-a-program-that-gives-you-the-average-of-your-school-mark-4g7b</link>
      <guid>https://dev.to/tupac/made-a-program-that-gives-you-the-average-of-your-school-mark-4g7b</guid>
      <description>&lt;p&gt;i made this program and i want help to make it better i know i can but i don't know how i feel like the code is way too long&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import time
import os

task = float(input("Enter how many classes you take: "))
if task == 1:
    a = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    print "Your average is: ", a, "%"
    os.system("say %s" % a), os.system("say %s" % "Percent")
elif task == 2:
    a = float(input("Enter your grade: "))
    print "last grade"
    b = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    c = (a + b) / task
    print "Your average is: ", c, "%"
    os.system("say %s" % c), os.system("say %s" % "Percent")
elif task == 3:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    print "last grade"
    c = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    d = (a + b + c) / task
    print "Your average is: ", d, "%"
    os.system("say %s" % d), os.system("say %s" % "Percent")
elif task == 4:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    print "last grade"
    d = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    e = (a + b + c + d) / task
    print "Your average is: ", e, "%"
    os.system("say %s" % e), os.system("say %s" % "Percent")
elif task == 5:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    print "last grade"
    e = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    f = (a + b + c + d + e) / task
    print "Your average is: ", f, "%"
    os.system("say %s" % f), os.system("say %s" % "Percent")
elif task == 6:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    print "last grade"
    f = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    h = (a + b + c + d + e + f) / task
    print "Your average is: ", h, "%"
    os.system("say %s" % h), os.system("say %s" % "Percent")
elif task == 7:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    print "last grade"
    h = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    i = (a + b + c + d + e + f + h) / task
    print "Your average is: ", i, "%"
    os.system("say %s" % i), os.system("say %s" % "Percent")
elif task == 8:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    print "last grade"
    i = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    j = (a + b + c + d + e + f + h + i) / task
    print "Your average is: ", j, "%"
    os.system("say %s" % j), os.system("say %s" % "Percent")
elif task == 9:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    print "last grade"
    j = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    k = (a + b + c + d + e + f + h + i + j) / task
    print "Your average is: ", k, "%"
    os.system("say %s" % k), os.system("say %s" % "Percent")
elif task == 10:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    print "last grade"
    k = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    l = (a + b + c + d + e + f + h + i + j + k) / task
    print "Your average is: ", l, "%"
    os.system("say %s" % l), os.system("say %s" % "Percent")
elif task == 11:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    k = float(input("Enter your grade: "))
    print "last grade"
    l = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    m = (a + b + c + d + e + f + h + i + j + k + l) / task
    print "Your average is: ", m, "%"
    os.system("say %s" % m), os.system("say %s" % "Percent")
elif task == 12:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    k = float(input("Enter your grade: "))
    l = float(input("Enter your grade: "))
    print "last grade"
    m = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    n = (a + b + c + d + e + f + h + i + j + k + l + m) / task
    print "Your average is: ", n, "%"
    os.system("say %s" % n), os.system("say %s" % "Percent")
elif task == 13:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    k = float(input("Enter your grade: "))
    l = float(input("Enter your grade: "))
    m = float(input("Enter your grade: "))
    print "last grade"
    n = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    o = (a + b + c + d + e + f + h + i + j + k + l + m + n) / task
    print "Your average is: ", o, "%"
    os.system("say %s" % o), os.system("say %s" % "Percent")
elif task == 14:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    k = float(input("Enter your grade: "))
    l = float(input("Enter your grade: "))
    m = float(input("Enter your grade: "))
    n = float(input("Enter your grade: "))
    print "last grade"
    o = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    p = (a + b + c + d + e + f + h + i + j + k + l + m + n + o) / task
    print "Your average is: ", p, "%"
    os.system("say %s" % p), os.system("say %s" % "Percent")
elif task == 15:
    a = float(input("Enter your grade: "))
    b = float(input("Enter your grade: "))
    c = float(input("Enter your grade: "))
    d = float(input("Enter your grade: "))
    e = float(input("Enter your grade: "))
    f = float(input("Enter your grade: "))
    h = float(input("Enter your grade: "))
    i = float(input("Enter your grade: "))
    j = float(input("Enter your grade: "))
    k = float(input("Enter your grade: "))
    l = float(input("Enter your grade: "))
    m = float(input("Enter your grade: "))
    n = float(input("Enter your grade: "))
    o = float(input("Enter your grade: "))
    print "last grade"
    p = float(input("Enter your grade: "))
    print "calculating...."
    time.sleep(1)
    q = (a + b + c + d + e + f + h + i + j + k + l + m + n + o + p) / task
    print "Your average is: ", q, "%"
    os.system("say %s" % q), os.system("say %s" % "Percent")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python program that Counts down time</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Mon, 13 Dec 2021 11:04:18 +0000</pubDate>
      <link>https://dev.to/tupac/python-program-that-counts-down-time-29dp</link>
      <guid>https://dev.to/tupac/python-program-that-counts-down-time-29dp</guid>
      <description>&lt;p&gt;I Made a program that counts down the time and at the end makes a sound when the times up&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import sys
import time
import os

a = int(input("Enter the amount of seconds: "))
if a &amp;gt;= 1:
    for i in range(a - 1, 0, -1):
        print i, "seconds"
        time.sleep(1)
    print"Time is up"
    os.system('say "Time is up."')
else:
    sys.exit()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Fast text to speech python</title>
      <dc:creator>Mohammad Alsuwaidi</dc:creator>
      <pubDate>Mon, 13 Dec 2021 10:59:59 +0000</pubDate>
      <link>https://dev.to/tupac/fast-text-to-speech-python-4n2o</link>
      <guid>https://dev.to/tupac/fast-text-to-speech-python-4n2o</guid>
      <description>&lt;p&gt;i've written a code that can turn text into speech using the os system in python&lt;/p&gt;

&lt;p&gt;it's a simple 3 line code&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# Text to speech
import os

text = raw_input("ENTER ANYTHING: ")

os.system("say %s" % text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
