I managed to solve the above BUT have another problem if anyone could look at it:

while True:

    x=float(input("First number: "))
    y=float(input("Second number: "))
    z=float(input("Third number: "))

    x=int(x)
    y=int(y)
    z=int(z)

    pf=(int(str(x)+str(y))*10**z)
    print(pf)
    print(float(pf*10**-3))
    print(float(pf*10**-6))

    replay=input("Would you like to calculate again? (yes/no) ")
    print('\n')
    if replay=="no":
        print("...Terminated Program.")
        break

print('\n')

The problem is shown in the outcome below:

First number: 1
Second number: 0
Third number: 4
100000
100.0
0.09999999999999999
Would you like to calculate again? (yes/no)

As can be seen in line 6, the result I get is supposed to be 0.1 but is instead a long decimal which is, technically equal to 0.1 if it is recurring, but I would rather it simply say 0.1. Anyway, this result is from line 14 in my script - any ideas how to adapt that line in order to solve my problem?

Cheers :)

I'm quite new to programming and i'm trying to write a formula to work out the capacitance of capacitors - and is what I have below. I then want to convert the value I have (in pico farrads) into micro farrads.

Here's what I have so far:

while True:

    x=float(input("First number: "))
    y=float(input("Second number: "))
    z=float(input("Third number: "))

    x=int(x)
    y=int(y)
    z=int(z)

    print(int(str(x)+str(y))*10**z)

    replay=input("Would you like to calculate again? (yes/no) ")
    print('\n')
    if replay=="no":
        print("...Terminated Program.")
        break

print('\n')

I want to assign the variable 'pf' to the result of line 11, so that I can then multiply the result by *10**-3. I've tried a few things but nothing seems to work. The rest of the script is as it should be and works fine, I just want to be able to add the ability to do what I said above.

Cheers :)

Thanks if you've taken an interest but have figured it out: needed to assign a variable to the function.

x=input('Would you like to:\nConvert centimeters to inches (a)\nConvert inches to centimeters (b)\n\ntype a or b: ')

if x=="a":
    dist_cent=float(input('measurement in centimeters: '))
    print(dist_cent /2.54)
elif x=="b":
    dist_inch=float(input('measurement in inches: '))
    print(dist_inch *2.54)

:)

Thanks, but am trying to remove an entire list from a set , like doing the following:

list1=[1,2,3,4,5,6]
list2=[2,5,6]
a=set(list1)

del(list2) from a

or something like

del(list2) from list1

I realize these aren't correct lines of code and won't work, but it's this kind of concept i'm trying to acheive. I my actual lists I have so many elements that deleting each element just isn't plausable.

Cheers:)

Thanks, but am trying to remove an entire list from a set , like doing the following:

list1=[1,2,3,4,5,6]
list2=[2,5,6]
a=set(list1)

del(list2) from list1

or something like

del(list2) from list1

I realize these aren't correct lines of code and won't work, but it's this kind of concept i'm trying to acheive. I my actual lists I have so many elements that deleting each element just isn't plausable.

Cheers:)

I'm quite new to Python, and am trying to make a simple unit converter - was hoping if anyone could tell me where i'm going wrong?

This is the script as it stands:

input('Would you like to convert centimeters to inches (a), or inches to centimeters (b)?\ntype a or b: ')
if type('a'):
    dist_cent=float(input('measurement in centimeters: '))
    print(dist_cent /2.54)
elif type('b'):
    dist_inch=float(input('measurement in inches: '))
    print(dist_inch *2.54)

If the user inputs 'a', the first 'if' works as it should. But if the user inputs 'b', instead of running the 'elif' statement, it runs the first 'if' statement as if the user had input 'a'.

Anybody able to explain this? Would be much appreciated.
Thanks!

I'm quite new to python and am trying to make a kind of 20Q thing, but am struggling - anybody know how to delete a list from a set, or if not a list from a list?

Thanks :)