zoukankan      html  css  js  c++  java
  • Introduction to Computer Science and Programming in Python chap2

    Branching and iteration

    Strings

    concatenate the strings

    hi = "hellothere"
    name = "ana"
    oscar = hi + name  
    print(oscar)
    ppi = hi+" "+name
    print(ppi)
    
    hellothereana
    hellothere ana
    

    Input/output

    cast ( ightarrow) strings

    text = input("Type anything... ")
    print(5*text)
    num = int(input("Type a number... "))
    print(5*num)
    
    Type anything... 4
    44444
    Type a number... 22
    110
    

    COMPARISON OPERATORS ON int,float,string

    while LOOP

    n = input("You are in the LookupErrorost Forest
    ****************
    ****************
     :)
    ****************
    ****************
     Go left or right? ")
    while n == "right" or n == "Right":
        n = input("You are in the Lost Forest
    ****************
    *********
    (╯°□°)╯︵ ┻━┻
    ****************
    ****************
    Go left or right? ")
    print("
     You got out of the Lost Forest!
    o/")
    
    You are in the LookupErrorost Forest
    ****************
    ****************
     :)
    ****************
    ****************
     Go left or right? right
    You are in the Lost Forest
    ****************
    *********
    (╯°□°)╯︵ ┻━┻
    ****************
    ****************
    Go left or right? left
    
     You got out of the Lost Forest!
    o/
  • 相关阅读:
    面试总结
    java高级开发
    idea的快捷键
    微服务面试题目
    windows下jenkins的安装与配置
    微服务面试集合
    springlcoud中使用consul作为注册中心
    乐观锁和悲观锁
    volatile与synchronized的区别
    Java CAS 和ABA问题
  • 原文地址:https://www.cnblogs.com/zonghanli/p/13602726.html
Copyright © 2011-2022 走看看