telsgrame.com Open in urlscan Pro
2606:4700:3037::ac43:ccbf  Public Scan

Submitted URL: http://telsgrame.com/
Effective URL: https://telsgrame.com/
Submission: On January 19 via api from SG — Scanned from SG

Form analysis 2 forms found in the DOM

/search

<form id="search" role="search" action="/search" class="s-topbar--searchbar js-searchbar " autocomplete="off">
  <div class="s-topbar--searchbar--input-group"> <input name="q" type="text" role="combobox" placeholder="Search…" value="" autocomplete="off" maxlength="240" class="s-input s-input__search js-search-field " aria-label="Search"
      aria-controls="top-search" data-controller="s-popover" data-action="focus->s-popover#show" data-s-popover-placement="bottom-start" aria-expanded="false"> <svg aria-hidden="true" class="s-input-icon s-input-icon__search svg-icon iconSearch"
      width="18" height="18" viewBox="0 0 18 18">
      <path d="m18 16.5-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5ZM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0Z"></path>
    </svg>
    <div class="s-popover p0 wmx100 wmn4 sm:wmn-initial js-top-search-popover" id="top-search" role="menu">
      <div class="s-popover--arrow"></div>
      <div class="js-spinner p24 d-flex ai-center jc-center d-none">
        <div class="s-spinner s-spinner__sm fc-orange-400">
          <div class="v-visible-sr">Loading…</div>
        </div>
      </div> <span class="v-visible-sr js-screen-reader-info"></span>
      <div class="js-ac-results overflow-y-auto hmx3 d-none"></div>
      <div class="js-search-hints" aria-describedby="Tips for searching"></div>
    </div>
  </div>
</form>

POST /questions/54171345/answer/submit

<form id="post-form" action="/questions/54171345/answer/submit" method="post" class="js-add-answer-component post-form"> <input type="hidden" id="post-id" value="54171345"> <input type="hidden" id="qualityBanWarningShown"
    name="qualityBanWarningShown" value="false"> <input type="hidden" name="referrer" value="">
  <h2 class="space" id="your-answer-header"> Your Answer </h2>
  <div id="post-editor" class="post-editor js-post-editor">
    <div class="ps-relative">
      <div class="wmd-container mb8">
        <div id="wmd-button-bar" class="wmd-button-bar btr-sm">
          <ul id="wmd-button-row" class="wmd-button-row">
            <li id="wmd-bold-button" class="wmd-button" style="left: 0px;"><span style="background-position: 0px -20px;"></span></li>
            <li id="wmd-italic-button" class="wmd-button" style="left: 25px;"><span style="background-position: -20px -20px;"></span></li>
            <li id="wmd-spacer1" class="wmd-spacer" style="left: 50px;"><span style="background-position: -40px -20px;"></span></li>
            <li id="wmd-link-button" class="wmd-button" style="left: 75px;"><span style="background-position: -40px -20px;"></span></li>
            <li id="wmd-quote-button" class="wmd-button" style="left: 100px;"><span style="background-position: -60px -20px;"></span></li>
            <li id="wmd-code-button" class="wmd-button" style="left: 125px;"><span style="background-position: -80px -20px;"></span></li>
            <li id="wmd-image-button" class="wmd-button" style="left: 150px;"><span style="background-position: -100px -20px;"></span></li>
            <li id="wmd-spacer2" class="wmd-spacer" style="left: 175px;"><span style="background-position: -120px -20px;"></span></li>
            <li id="wmd-olist-button" class="wmd-button" style="left: 200px;"><span style="background-position: -120px -20px;"></span></li>
            <li id="wmd-ulist-button" class="wmd-button" style="left: 225px;"><span style="background-position: -140px -20px;"></span></li>
            <li id="wmd-heading-button" class="wmd-button" style="left: 250px;"><span style="background-position: -160px -20px;"></span></li>
            <li id="wmd-hr-button" class="wmd-button" style="left: 275px;"><span style="background-position: -180px -20px;"></span></li>
            <li id="wmd-spacer3" class="wmd-spacer" style="left: 300px;"><span style="background-position: -200px -20px;"></span></li>
            <li id="wmd-undo-button" class="wmd-button" style="left: 325px;"><span style="background-position: -200px -20px;"></span></li>
            <li id="wmd-redo-button" class="wmd-button" style="left: 350px;"><span style="background-position: -220px -20px;"></span></li>
            <li class="wmd-spacer wmd-spacer-max"></li>
          </ul>
        </div>
        <div class="ai-content-policy-notice js-ai-policy-notice fc-black p8 bl br bc-black-300 d-none" aria-hidden="true">
          <div class="d-flex jc-space-between ac-center gsx gs2">
            <p class="flex--item as-center"><b>Reminder:</b> Answers generated by artificial intelligence tools are not allowed on Stack Overflow. <a href="/help/ai-policy">Learn more</a></p> <button
              class="flex--item js-dismiss-ai-banner s-btn s-btn__sm s-btn__icon fc-black"><svg aria-hidden="true" class="svg-icon iconClearSm" width="14" height="14" viewBox="0 0 14 14">
                <path d="M12 3.41 10.59 2 7 5.59 3.41 2 2 3.41 5.59 7 2 10.59 3.41 12 7 8.41 10.59 12 12 10.59 8.41 7 12 3.41Z"></path>
              </svg></button>
          </div>
        </div> <input type="hidden" name="AIPolicyNoticeShown" value="true">
        <div class="js-stacks-validation">
          <div class="ps-relative"> <textarea id="wmd-input" name="post-text" class="wmd-input s-input bar0 js-post-body-field" data-editor-type="wmd" data-post-type-id="2" cols="92" rows="15" aria-labelledby="your-answer-header" tabindex="101"
              data-min-length=""></textarea> </div>
          <div class="s-input-message mt4 d-none js-stacks-validation-message"></div>
        </div>
      </div>
    </div>
    <aside class="d-flex ai-start jc-space-between js-answer-help s-notice s-notice__warning pb0 pr4 pt4 mb8 d-none" role="status" aria-hidden="true">
      <div class="flex--item pt8">
        <p>Thanks for contributing an answer to Stack Overflow!</p>
        <ul>
          <li>Please be sure to <em>answer the question</em>. Provide details and share your research!</li>
        </ul>
        <p>But <em>avoid</em> …</p>
        <ul>
          <li>Asking for help, clarification, or responding to other answers.</li>
          <li>Making statements based on opinion; back them up with references or personal experience.</li>
        </ul>
        <p>To learn more, see our <a href="/help/how-to-answer">tips on writing great answers</a>.</p>
      </div> <button class="flex--item js-answer-help-close-btn s-btn s-btn__muted fc-black-600"> <svg aria-hidden="true" class="svg-icon iconClear" width="18" height="18" viewBox="0 0 18 18">
          <path d="M15 4.41 13.59 3 9 7.59 4.41 3 3 4.41 7.59 9 3 13.59 4.41 15 9 10.41 13.59 15 15 13.59 10.41 9 15 4.41Z"></path>
        </svg> </button>
    </aside>
    <div>
      <div id="draft-saved" class="fc-success h24" style="display:none;">Draft saved</div>
      <div id="draft-discarded" class="fc-error h24" style="display:none;">Draft discarded</div>
    </div>
    <div id="wmd-preview" class="s-prose mb16 wmd-preview js-wmd-preview"></div>
    <div></div>
    <div class="edit-block"> <input id="fkey" name="fkey" type="hidden" value="22d09102141c27689118afb882bd320b423422c479aaff1e547e2e71f8d933dd"> <input id="author" name="author" type="text"> </div>
  </div>
  <div class="ps-relative">
    <div class="form-item new-post-login p0 my16">
      <div class="d-flex gs16 md:fd-column new-login-form">
        <div class="d-flex fd-column w50 md:w-auto gsy gs8 jc-space-between new-login-left">
          <h3 class="flex--item fs-title">Sign up or
            <a id="login-link" href="/users/login?ssrc=question_page&amp;returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f54171345%2fhow-to-fix-valueerror-could-not-convert-string-to-float-east-python%23new-answer">log in</a></h3>
          <div class="flex--item s-btn s-btn__muted s-btn__outlined s-btn__icon google-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Started - Google&quot;,&quot;New Post&quot;,null,null]"> <svg aria-hidden="true"
              class="native svg-icon iconGoogle" width="18" height="18" viewBox="0 0 18 18">
              <path fill="#4285F4" d="M16.51 8H8.98v3h4.3c-.18 1-.74 1.48-1.6 2.04v2.01h2.6a7.8 7.8 0 0 0 2.38-5.88c0-.57-.05-.66-.15-1.18Z"></path>
              <path fill="#34A853" d="M8.98 17c2.16 0 3.97-.72 5.3-1.94l-2.6-2a4.8 4.8 0 0 1-7.18-2.54H1.83v2.07A8 8 0 0 0 8.98 17Z"></path>
              <path fill="#FBBC05" d="M4.5 10.52a4.8 4.8 0 0 1 0-3.04V5.41H1.83a8 8 0 0 0 0 7.18l2.67-2.07Z"></path>
              <path fill="#EA4335" d="M8.98 4.18c1.17 0 2.23.4 3.06 1.2l2.3-2.3A8 8 0 0 0 1.83 5.4L4.5 7.49a4.77 4.77 0 0 1 4.48-3.3Z"></path>
            </svg> Sign up using Google </div>
          <div class="flex--item s-btn s-btn__muted s-btn__icon facebook-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Started - Facebook&quot;,&quot;New Post&quot;,null,null]"> <svg aria-hidden="true" class="svg-icon iconFacebook" width="18"
              height="18" viewBox="0 0 18 18">
              <path fill="#4167B2"
                d="M3 1a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2H3Zm6.55 16v-6.2H7.46V8.4h2.09V6.61c0-2.07 1.26-3.2 3.1-3.2.88 0 1.64.07 1.87.1v2.16h-1.29c-1 0-1.19.48-1.19 1.18V8.4h2.39l-.31 2.42h-2.08V17h-2.5Z"></path>
            </svg> Sign up using Facebook </div>
          <div class="flex--item s-btn s-btn__muted s-btn__outlined s-btn__icon stackexchange-login" data-ga="[&quot;sign up&quot;,&quot;Sign Up Navigation&quot;,&quot;New Post&quot;,null,null]"> <svg aria-hidden="true"
              class="native svg-icon iconLogoGlyphXSm" width="18" height="18" viewBox="0 0 18 18">
              <path d="M14 16v-5h2v7H2v-7h2v5h10Z" fill="#BCBBBB"></path>
              <path d="m12.09.72-1.21.9 4.5 6.07 1.22-.9L12.09.71ZM5 15h8v-2H5v2Zm9.15-5.87L8.35 4.3l.96-1.16 5.8 4.83-.96 1.16Zm-7.7-1.47 6.85 3.19.63-1.37-6.85-3.2-.63 1.38Zm6.53 5L5.4 11.39l.38-1.67 7.42 1.48-.22 1.46Z" fill="#F48024"></path>
            </svg> Sign up using Email and Password </div>
        </div> <input type="hidden" name="use-facebook" class="use-facebook" value="false"> <input type="hidden" name="use-google" class="use-google" value="false"> <button type="button" class="d-none js-submit-openid">Submit</button>
        <div class="d-flex gsy gs8 fd-column w50 md:w-auto new-login-right form-item p0">
          <h3 class="flex--item fs-title">Post as a guest</h3>
          <div class="flex--item">
            <div class="d-flex gs4 gsy fd-column"> <label class="s-label" for="display-name">Name</label>
              <div class="d-flex ps-relative"> <input class="s-input" id="display-name" name="display-name" maxlength="30" type="text" value="" tabindex="105" placeholder=""> </div>
            </div>
          </div>
          <div class="flex--item">
            <div class="d-flex gs4 gsy fd-column">
              <div class="flex--item">
                <div class="d-flex gs2 gsy fd-column"> <label class="flex--item s-label" for="m-address">Email</label>
                  <p class="flex--item s-description">Required, but never shown</p>
                </div>
              </div>
              <div class="d-flex ps-relative"> <input class="s-input js-post-email-field" id="m-address" name="m-address" type="text" value="" size="40" tabindex="106" placeholder=""> </div>
            </div>
          </div>
        </div>
      </div>
    </div> <noscript>
      <h3 class="flex--item fs-title">Post as a guest</h3>
      <div class="flex--item">
        <div class="d-flex gs4 gsy fd-column"> <label class="s-label" for="display-name">Name</label>
          <div class="d-flex ps-relative"> <input class="s-input" id="display-name" name="display-name" maxlength="30" type="text" value="" tabindex="105" placeholder=""> </div>
        </div>
      </div>
      <div class="flex--item">
        <div class="d-flex gs4 gsy fd-column">
          <div class="flex--item">
            <div class="d-flex gs2 gsy fd-column"> <label class="flex--item s-label" for="m-address">Email</label>
              <p class="flex--item s-description">Required, but never shown</p>
            </div>
          </div>
          <div class="d-flex ps-relative"> <input class="s-input js-post-email-field" id="m-address" name="m-address" type="text" value="" size="40" tabindex="106" placeholder=""> </div>
        </div>
      </div>
    </noscript>
  </div>
  <div class="form-submit clear-both d-flex gsx gs4"> <button id="submit-button" class="flex--item s-btn s-btn__filled s-btn__icon" type="submit" tabindex="120" autocomplete="off"> Post Your Answer </button> <button
      class="flex--item s-btn s-btn__danger discard-answer dno"> Discard </button>
    <p class="privacy-policy-agreement"> By clicking “Post Your Answer”, you agree to our <a href="https://stackoverflow.com/legal/terms-of-service/public" name="tos" target="_blank" class="-link">terms of service</a> and acknowledge you have
      read our <a href="https://stackoverflow.com/legal/privacy-policy" name="privacy" target="_blank" class="-link">privacy policy</a>.<input type="hidden" name="legalLinksShown" value="1"> </p>
  </div>
  <div class="js-general-error general-error clear-both d-none" aria-live="polite"></div>
</form>

Text Content

Stack Overflow
 1. About
 2. Products
 3. For Teams

 1. Stack Overflow Public questions & answers
 2. Stack Overflow for Teams Where developers & technologists share private
    knowledge with coworkers
 3. Talent Build your employer brand
 4. Advertising Reach developers & technologists worldwide
 5. Labs The future of collective knowledge sharing
 6. About the company

Loading…




 1. CURRENT COMMUNITY
    
    
     * 
       Stack Overflow
       help chat
     * 
       Meta Stack Overflow
    
    
    YOUR COMMUNITIES
    
    Sign up or log in to customize your list.
    
    
    MORE STACK EXCHANGE COMMUNITIES
    
    company blog
    
 2. 
 3. Log in
 4. Sign up

 1. 1.  Home
    2.  Questions
    3.  Tags
    4.  
    5.  Users
    6.  Companies
    7.  Collectives
        
    8.  Explore Collectives
    9.  Labs
        
    10. Discussions
 2. Teams
    Stack Overflow for Teams – Start collaborating and sharing organizational
    knowledge. Create a free Team Why Teams?
 3. Teams
    
 4. Create free Team

COLLECTIVES„¢ ON STACK OVERFLOW

Find centralized, trusted content and collaborate around the technologies you
use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy
to search.

Learn more about Teams


Get early access and see previews of new features.

Learn more about Labs


HOW TO FIX "VALUEERROR: COULD NOT CONVERT STRING TO FLOAT: 'EAST'" (PYTHON)

Ask Question
Asked 5 years ago
Modified 5 years ago
Viewed 70 times
This question shows research effort; it is useful and clear

-3
This question does not show any research effort; it is unclear or not useful

Save this question.

Show activity on this post.


When the user enters "East" I want the output to be -1 not "East"

East = -1Xdirectioninput = float(input("Is the player South or East: "))Xdirectioninput = (Xdirectioninput)print (Xdirectioninput)

 * python

Share
Share a link to this question

Copy linkCC BY-SA 4.0

Improve this question
Follow
Follow this question to receive notifications


edited Jan 13, 2019 at 17:27

busybear
10.3k11 gold badge2626 silver badges4242 bronze badges
asked Jan 13, 2019 at 17:24

Myles McManusMyles McManus
922 bronze badges
2
 * 2
   So write a function that converts the input. You can't just cast it to float
   and expect it to work
   – UnholySheep
   Jan 13, 2019 at 17:30
 * Thanks, I'm new to coding! I will start doing my research on functions now!
   – Myles McManus
   Jan 13, 2019 at 17:34

Add a comment  | 
Report this ad


2 ANSWERS 2

Sorted by: Reset to default
Highest score (default) Trending (recent votes count more) Date modified (newest
first) Date created (oldest first)
This answer is useful

1
This answer is not useful

Save this answer.


Show activity on this post.


That will only work in Python 2. It works because in Python 2, what the user
types in response to input() is evaluated as a Python expression.

But you can't do that in Python 3. One way to do it is to set up a dictionary
with directions:

directions = {"East": -1.0, "South": -2.0}Xdirectioninput = directions[input("Is the player South or East: ")]

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Jan 13, 2019 at 17:36

BoarGulesBoarGules
16.6k22 gold badges2828 silver badges4545 bronze badges
Add a comment  | 

This answer is useful

0
This answer is not useful

Save this answer.


Show activity on this post.


I think conditional statement would be good solution. You could make a code as
follows:

Xdirectioninput = input("Is the player South or East: ")if Xdirectioninput == 'East':    Xdirection = -1print(Xdirection)

Share
Share a link to this answer

Copy linkCC BY-SA 4.0

Improve this answer
Follow
Follow this answer to receive notifications


answered Jan 13, 2019 at 17:50

GoatHeadGoatHead
11611 silver badge77 bronze badges
Add a comment  | 


YOUR ANSWER

 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 

Reminder: Answers generated by artificial intelligence tools are not allowed on
Stack Overflow. Learn more



Thanks for contributing an answer to Stack Overflow!

 * Please be sure to answer the question. Provide details and share your
   research!

But avoid …

 * Asking for help, clarification, or responding to other answers.
 * Making statements based on opinion; back them up with references or personal
   experience.

To learn more, see our tips on writing great answers.

Draft saved
Draft discarded





SIGN UP OR LOG IN

Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Submit


POST AS A GUEST

Name

Email

Required, but never shown




POST AS A GUEST

Name

Email

Required, but never shown


Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and
acknowledge you have read our privacy policy.


NOT THE ANSWER YOU'RE LOOKING FOR? BROWSE OTHER QUESTIONS TAGGED
 * PYTHON

OR ASK YOUR OWN QUESTION.

 * The Overflow Blog
 * How to build a role-playing video game in 24 hours
 * Featured on Meta
 * Sites can now request to enable a banner to warn about their policy on...
 * Temporary policy: Generative AI (e.g., ChatGPT) is banned





RELATED

0
ValueError: could not convert string to float in simple code
0
ValueError: could not convert string to float.
1
ValueError: could not convert string to float
1
Python ValueError: could not convert string to float:
1
Python, ValueError: could not convert string to float:
3
Why is Python showing 'ValueError: could not convert string to float'?
1
ValueError: could not convert string to float: '.'
1
cannot convert string to float python value error
1
Fix ValueError: could not convert string to float:
0
How to fix the ValueError: could not convert string to float: in python

HOT NETWORK QUESTIONS

 * 
   Cybernetic AIs get hacked, while sentient AGIs are immune?
 * 
   Seeking an English Equivalent for the Concept of "Evil Eye"
 * 
   If the universe only has one galaxy, how would people know the expansion of
   the universe?
 * 
   An alternative architecture for a mission to Mars
 * 
   An easy positive riddle
 * 
   There' a nice 3D graph in the help file of the Plot3D function. How can I
   reproduce it?
 * 
   What is the three-note ascending "toy piano" (e.g. C-G-C arpeggio) sound that
   interrupts the music I'm listening to in my AirPods?
 * 
   Virtualbox 6 stopped working After kernel upgrade in Ubuntu 22.04
 * 
   What is a Cleric in DnD?
 * 
   Does The Boot override Intangible?
 * 
   Extracting selected faces' info in python
 * 
   Is it ok to enforce a dual-licensing clause in a copyright header?
 * 
   I realized I made a huge mistake grading a student's thesis. Panicking and
   unsure what to do
 * 
   How did PHS researchers prevent Tuskegee experiment participants from
   obtaining treatment on their own?
 * 
   What commercial airplane broke the sound barrier in 1979?
 * 
   apt full-upgrade from Debian 10 to 11: missed selection of trusted
   certificates or something, how to fix it?
 * 
   Why would they call a petri dish of germs "preschool"?
 * 
   Does wire gauge matter for speaker cable for a home stereo system?
 * 
   Transparent search for a std::map with a std::pair as a key
 * 
   Is there an absolute geometry that underlies spherical, Euclidean and
   hyperbolic geometry?
 * 
   In Scrum, why don't you use aging and guaranteed time slice to prevent
   outdated tasks in the backlog?
 * 
   LED Fails to illuminate, what am I not seeing in my configuration(s)?
 * 
   A filter that decays proportionately to the wavelength of each freq? So for
   each wavelength at each freq, that freq's amplitude is attenuated by (*c)?
 * 
   Alternative names for "new liberalism" and "neoliberalism" to avoid confusion

Question feed


SUBSCRIBE TO RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.



lang-py

STACK OVERFLOW

 * Questions
 * Help

PRODUCTS

 * Teams
 * Advertising
 * Collectives
 * Talent

COMPANY

 * About
 * Press
 * Work Here
 * Legal
 * Privacy Policy
 * Terms of Service
 * Contact Us
 * Cookie Settings
 * Cookie Policy

STACK EXCHANGE NETWORK

 * Technology
 * Culture & recreation
 * Life & arts
 * Science
 * Professional
 * Business
 * API
 * Data

 * Blog
 * Facebook
 * Twitter
 * LinkedIn
 * Instagram

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under
CC BY-SA. rev 2024.1.10.3270

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies
on your device and disclose information in accordance with our Cookie Policy.

Accept all cookies Necessary cookies only
Customize settings